Migrating from file based service registry to DynamoDB service registry.

48 views
Skip to first unread message

Richard Nicholas

unread,
Apr 17, 2019, 7:04:56 AM4/17/19
to CAS Community
I've got a demo cas instance which worked well using JSON service registries, but I want to migrate the registry to DynamoDB (among other things to deliver a HA solution.)

What's not entirely clear is how I convert the JSON files into objects that can be put into the database.

I see there is an id field, which is a string.

I just need to know how a JSON file like below:

{
  "@class" : "org.apereo.cas.services.RegexRegisteredService",
  "serviceId" : "http://localhost:8080/.*",
  "name" : "Jenkins",
  "id" : 1,
  "attributeReleasePolicy" : {
    "@class" : "org.apereo.cas.services.ReturnAllowedAttributeReleasePolicy",
    "allowedAttributes" : [ "java.util.ArrayList", [ "name", "email", "groups" ] ]
  }
}

translates into an item in the dynamoDB table, so I can load in the services.   I tried to see if loading the default service would cause it to be persisted into dynamoDB, but the database stays empty although the registry on cas shows one entry.

Using the management console wasn't much help, as it wasn't clear to me how I create an object like the above (which also would not import).

David Curry

unread,
Apr 17, 2019, 7:44:28 AM4/17/19
to cas-...@apereo.org
At least on CAS 5.2.x with a Mongo DB service registry, the way you did it was:
  1. Edit the dependencies in pom.xml and:
    1. REMOVE the cas-server-support-json-service-registry dependency
    2. ADD the cas-server-support-mongo-service-registry dependency
  2. Rebuild the server.
  3. Add the Mongo DB service registry configuration properties to cas.properties.
  4. Add the settings to cas.properties to tell it to initialize the service registry from JSON:
         cas.serviceRegistry.json.location:     file:/etc/cas/services
         cas.serviceRegistry.initFromJson:      true
  5. Start the new server built in Step 2. This should initialize the service registry from the JSON files and create all the entries in the Mongo DB service registry. (You only need to start one server; you don't need to start all of them if you're in a pool.)
  6. Use the MongoDB command line shell to check the database and verify that the service registry entries have been created.
  7. Shut down the server.
  8. Remove the JSON service registry properties (added in Step 4) from cas.properties.
  9. Restart the server and now you're using a Mongo DB service registry.
  10. Don't forget to make the dependency and property changes (Steps 1 and 3) to the management webapp as well.

No guarantees, but my guess is that something similar would/should work for DynamoDB.

--Dave

--

DAVID A. CURRY, CISSP
DIRECTOR OF INFORMATION SECURITY
THE NEW SCHOOL  INFORMATION TECHNOLOGY

71 FIFTH AVE., 9TH FL., NEW YORK, NY 10003
+1 212 229-5300 x4728david...@newschool.edu




--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/cb887d94-d5c2-487c-a319-1cadda92e6c6%40apereo.org.
Reply all
Reply to author
Forward
0 new messages