diff --git a/README.md b/README.md index 537ef4223e49502ce0e52222e8d5b2d1307bb73e..517e05d28109b9c11493827ce952bd327e7290bf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# user-manager Project +# user-manager This project uses Quarkus, the Supersonic Subatomic Java Framework. @@ -36,12 +36,21 @@ You can run your application in dev mode that enables live coding using: > ```yaml > keycloak: > realm: your-realm -> kop: -> keycloak: -> sync: -> period: "6h" +> ozgcloud: +> usersync: +> period: "6h" > ``` +## Running the server with custom realm +In order to start user-manager-server connecting againts dev keycloak locally with custom realm +use below configuration in your IDE or CLI. +``` +-Dquarkus.profile=local,remotekc +-Dquarkus.oidc.auth-server-url=https://sso.dev.by.ozg-cloud.de/realms/sebo-test +-Dkop.keycloak.api.realm=sebo-test +-Dozgcloud.usersync.period="5s" +``` + ## Packaging and running the application The application can be packaged using: @@ -133,7 +142,7 @@ Usermanager als native Anwendung erstellen und lokal starten: -Dkop.keycloak.api.password=hlc_j1I1Ji0trC0 \ -Dkop.keycloak.api.realm=by-kiel-dev \ -Dkop.keycloak.api.client=alfa \ - -Dkop.keycloak.sync.cron="* */3 * * * ?" \ + -Dozgcloud.usersync.period="5m" \ -Xmx32m ``` diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index af8cb38b76d848478eda646f4511eb4b661d8e19..c00aeea69396b4d7f79681670f7c5b1560f7d8a6 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -98,8 +98,10 @@ spec: value: {{ include "app.ssoServerUrl" . }} - name: KOP_USER_MANAGER_URL value: {{ include "app.baseUrl" . }} - - name: KOP_KEYCLOAK_SYNC_CRON - value: {{ .Values.kop.keycloak.sync.cron }} + {{- if ((.Values.ozgcloud).usersync).period }} + - name: OZGCLOUD_USERSYNC_PERIOD + value: {{ .Values.ozgcloud.usersync.period }} + {{- end }} - name: QUARKUS_HTTP_CORS_ORIGINS value: {{ (include "app.goofyAddress" .) }} {{- with (.Values.env).customList }} diff --git a/src/main/helm/values.yaml b/src/main/helm/values.yaml index fc0f63d4bb1dffd9bab24772e002c3fa0db9a591..78a2d65144db9cc541ea178ca8fc44de0ac4be05 100644 --- a/src/main/helm/values.yaml +++ b/src/main/helm/values.yaml @@ -38,8 +38,6 @@ kop: keycloak: api: user: userManagerApiUser - sync: - cron: 0 15 1 * * ? imageCredentials: registry: docker.ozg-sh.de diff --git a/src/test/helm/deployment-keycloak-values-test.yaml b/src/test/helm/deployment-keycloak-values-test.yaml index 3554cc6ee2454279c5c739d8455eafeb5a7731d9..5aabfe98e118fd878089b379c262814c35348fcf 100644 --- a/src/test/helm/deployment-keycloak-values-test.yaml +++ b/src/test/helm/deployment-keycloak-values-test.yaml @@ -52,11 +52,6 @@ tests: content: name: KOP_KEYCLOAK_API_REALM value: sh-helm-test - - contains: - path: spec.template.spec.containers[0].env - content: - name: KOP_KEYCLOAK_SYNC_CRON - value: 0 15 1 * * ? - contains: path: spec.template.spec.containers[0].env content: diff --git a/src/test/helm/deployment_env_test.yaml b/src/test/helm/deployment_env_test.yaml index d179014a732fd8693d1082a9472609e836b6ffa9..34eb94b430f6cc97d4414d142d0f7dd82d9540f0 100644 --- a/src/test/helm/deployment_env_test.yaml +++ b/src/test/helm/deployment_env_test.yaml @@ -68,4 +68,20 @@ tests: path: spec.template.spec.containers[0].env content: name: QUARKUS_MONGODB_DATABASE - value: test-database \ No newline at end of file + value: test-database + - it: check user sync period set + set: + ozgcloud.usersync.period: "6h" + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: OZGCLOUD_USERSYNC_PERIOD + value: "6h" + - it: check user sync period NOT set + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: OZGCLOUD_USERSYNC_PERIOD + value: "6h" \ No newline at end of file diff --git a/user-manager-server/src/main/java/de/itvsh/kop/user/sync/SyncScheduler.java b/user-manager-server/src/main/java/de/itvsh/kop/user/sync/SyncScheduler.java index 885875d02e1d679c18fd35e8280cfb08aa6f20c6..86d8def9a360dfc89dda56b7b5f0b6f72c753223 100644 --- a/user-manager-server/src/main/java/de/itvsh/kop/user/sync/SyncScheduler.java +++ b/user-manager-server/src/main/java/de/itvsh/kop/user/sync/SyncScheduler.java @@ -41,7 +41,7 @@ public class SyncScheduler { @Inject LockService syncLockService; - @Scheduled(every = "{kop.keycloak.sync.period}", concurrentExecution = SKIP) + @Scheduled(every = "{ozgcloud.usersync.period}", concurrentExecution = SKIP) public void start() { if (syncLockService.isNotLocked()) { var lock = syncLockService.lockCollection(); diff --git a/user-manager-server/src/main/resources/application-e2e.yaml b/user-manager-server/src/main/resources/application-e2e.yaml index 27aafbd0e3f4cb441c07514480e5d6ea4f041e19..5a5bccbd9d5b634f65988a21cf419a1c3b517efc 100644 --- a/user-manager-server/src/main/resources/application-e2e.yaml +++ b/user-manager-server/src/main/resources/application-e2e.yaml @@ -21,8 +21,10 @@ kop: password: S9UEMuLG9y9ev99 realm: by-e2e-local-dev client: alfa - sync: - period: disabled keycloak: - url: https://sso.dev.by.ozg-cloud.de \ No newline at end of file + url: https://sso.dev.by.ozg-cloud.de + +ozgcloud: + usersync: + period: disabled \ No newline at end of file diff --git a/user-manager-server/src/main/resources/application-remotekc.yaml b/user-manager-server/src/main/resources/application-remotekc.yaml index e88917a52d89aba749f433ff0f164354285c4f40..368b647bd2ba01778932ac8c7d88c887da0e444b 100644 --- a/user-manager-server/src/main/resources/application-remotekc.yaml +++ b/user-manager-server/src/main/resources/application-remotekc.yaml @@ -15,8 +15,6 @@ kop: user-manager: url: http://localhost:9092 keycloak: - sync: - period: disabled api: user: userManagerApiUser password: hlc_j1I1Ji0trC0 @@ -24,3 +22,7 @@ kop: organisations-einheit-id-key: organisationseinheitId client: alfa ldap-id-key: LDAP_ID + +ozgcloud: + usersync: + period: disabled \ No newline at end of file diff --git a/user-manager-server/src/main/resources/application.yaml b/user-manager-server/src/main/resources/application.yaml index 7eeff0d9cc01dfe24f1dc8653510a11c4b804e27..6efd2f1f6ad34f0e2f2493c9db44e041c37d7f91 100644 --- a/user-manager-server/src/main/resources/application.yaml +++ b/user-manager-server/src/main/resources/application.yaml @@ -42,5 +42,7 @@ kop: password: "-" realm: by-kiel-dev client: alfa - sync: - period: "6h" \ No newline at end of file + +ozgcloud: + usersync: + period: "6h" \ No newline at end of file diff --git a/user-manager-server/src/test/resources/application.yml b/user-manager-server/src/test/resources/application.yml index 2a586a62747350892ade14dd764cc4b09982a105..f79dce9046b519b1c9c06b7b847ef069763818da 100644 --- a/user-manager-server/src/test/resources/application.yml +++ b/user-manager-server/src/test/resources/application.yml @@ -1,33 +1,35 @@ quarkus: - keycloak: - devservices: - enabled: false - application: - name: kopusermanager - mongodb: - devservices: - enabled: false - database: usermanager - scheduler: - metrics: - enabled: true - log: - level: INFO - oidc: - auth-server-url: https://sso.dev.by.ozg-cloud.de/realms/by-kiel-dev + keycloak: + devservices: + enabled: false + application: + name: kopusermanager + mongodb: + devservices: + enabled: false + database: usermanager + scheduler: + metrics: + enabled: true + log: + level: INFO + oidc: + auth-server-url: https://sso.dev.by.ozg-cloud.de/realms/by-kiel-dev kop: - keycloak: - sync: - cron: "0 15 13 * * ?" - api: - user: "-" - password: "-" - realm: by-kiel-dev - organisations-einheit-id-key: organisationseinheitId - ldap-id-key: LDAP_ID - client: sh-kiel-dev-goofy - user-manager: - url: http://localhost:9092 + keycloak: + api: + user: "-" + password: "-" + realm: by-kiel-dev + organisations-einheit-id-key: organisationseinheitId + ldap-id-key: LDAP_ID + client: sh-kiel-dev-goofy + user-manager: + url: http://localhost:9092 keycloak: - url: http://localhost:8088 \ No newline at end of file + url: http://localhost:8088 + +ozgcloud: + usersync: + period: disabled \ No newline at end of file