From 9a1988bdb7634286ac169485fd22a88801ee7838 Mon Sep 17 00:00:00 2001 From: Ryan Dawson Date: Mon, 9 Oct 2017 16:48:06 +0100 Subject: [PATCH] initial setup --- .gitignore | 18 ++++++++++++++ .idea/vcs.xml | 6 +++++ README.md | 22 +++++++++++++++- audit.properties | 31 +++++++++++++++++++++++ gateway.properties | 33 ++++++++++++++++++++++++ query.properties | 34 +++++++++++++++++++++++++ registry.properties | 3 +++ runtime-bundle1.properties | 51 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 .idea/vcs.xml create mode 100644 audit.properties create mode 100644 gateway.properties create mode 100644 query.properties create mode 100644 registry.properties create mode 100644 runtime-bundle1.properties diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4e6032 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +target +/local + +# Netbeans and IntelliJ files +!.gitignore +/nbproject +/*.ipr +/*.iws +*.iml +.idea + +# Repository wide ignore mac DS_Store files +.DS_Store + +# Eclipse +.project +.classpath +.settings \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 3764090..59d7391 100644 --- a/README.md +++ b/README.md @@ -1 +1,21 @@ -# activiti-cloud-config-repo \ No newline at end of file +# activiti-cloud-config-repo + +Config repository to provide config files for some Activiti cloud projects. A spring cloud config server can be pointed at this repo to host the config files contained here. + +Can be hosted using a standard spring cloud config server e.g. docker image https://hub.docker.com/r/hyness/spring-cloud-config-server/ and using environment variable SPRING_CLOUD_CONFIG_SERVER_GIT_URI=https://github.com/ryandawsonuk/activiti-cloud-config-repo + +Each client will need to have a bootstrap.properties and the spring-cloud-starter-config dependency. The bootstrap.properties needs to provide at least spring.application.name (which should match to the property file in the config server) and the spring.cloud.config.uri to find the config server. The client will look for the config server very early in its startup. + +Let's say we run the config server using name activiti-cloud-config-server on port 8888 (similar to https://github.com/hyness/spring-cloud-config-server/blob/master/docker-compose.yml). Then we could use this value in all of the bootstrap.properties: + +spring.cloud.config.uri=http://activiti-cloud-config-server:8888 + +And in each of the client's its own application name will feature in the bootstrap.properties: + +spring.application.name=${ACT_RB_APP_NAME:runtime-bundle1} +spring.application.name=${ACT_GATEWAY_APP_NAME:gateway} +spring.application.name=${ACT_REGISTRY_APP_NAME:registry +spring.application.name=${ACT_AUDIT_APP_NAME:audit} +spring.application.name=${ACT_QUERY_APP_NAME:query} + +Note that if a new runtime bundle (or any other app) is deployed with a new name (e.g. runtime-bundle2) then it will only find a config file in the repo if it is named runtime-bundle2.properties (or otherwise matches the convention based on app name and profile name). \ No newline at end of file diff --git a/audit.properties b/audit.properties new file mode 100644 index 0000000..ffa6625 --- /dev/null +++ b/audit.properties @@ -0,0 +1,31 @@ +server.port=${ACT_AUDIT_PORT:8181} +spring.application.name=${ACT_AUDIT_APP_NAME:audit} + +spring.cloud.stream.bindings.auditConsumer.destination=${ACT_AUDIT_CONSUMER_DEST:engineEvents} +spring.cloud.stream.bindings.auditConsumer.group=${ACT_AUDIT_CONSUMER_GROUP:audit} +spring.cloud.stream.bindings.auditConsumer.contentType=${ACT_AUDIT_CONSUMER_CONTENT_TYPE:application/json} +spring.jackson.serialization.fail-on-unwrapped-type-identifiers=${ACT_AUDIT_JACKSON_FAIL_ON_UNWRAPPED_IDS:false} + +keycloak.auth-server-url=${ACT_KEYCLOAK_URL:http://activiti-cloud-sso-idm:8180/auth} +keycloak.realm=${ACT_KEYCLOAK_REALM:springboot} +keycloak.resource=${ACT_KEYCLOAK_RESOURCE:activiti} +keycloak.ssl-required=${ACT_KEYCLOAK_SSL_REQUIRED:none} +keycloak.public-client=${ACT_KEYCLOAK_CLIENT:true} + +keycloak.security-constraints[0].authRoles[0]=${ACT_KEYCLOAK_ROLES:user} +keycloak.security-constraints[0].securityCollections[0].patterns[0]=${ACT_KEYCLOAK_PATTERNS:/*} + +keycloak.principal-attribute=${ACT_KEYCLOAK_PRINCIPAL_ATTRIBUTE:preferred-username} +# see https://issues.jboss.org/browse/KEYCLOAK-810 for configuration options + +keycloakadminclientapp=${ACT_KEYCLOAK_CLIENT_APP:admin-cli} +keycloakclientuser=${ACT_KEYCLOAK_CLIENT_USER:client} +keycloakclientpassword=${ACT_KEYCLOAK_CLIENT_PASSWORD:client} +# this user needs to have the realm management roles assigned + +spring.rabbitmq.host=${ACT_RABBITMQ_HOST:rabbitmq} +eureka.client.serviceUrl.defaultZone=${ACT_EUREKA_URL:http://activiti-cloud-registry:8761/eureka/} + +#hostname as declared to eureka +eureka.instance.hostname=${ACT_AUDIT_HOST:activiti-cloud-audit} +eureka.client.enabled=${ACT_AUDIT_EUREKA_CLIENT_ENABLED:true} \ No newline at end of file diff --git a/gateway.properties b/gateway.properties new file mode 100644 index 0000000..b2ea652 --- /dev/null +++ b/gateway.properties @@ -0,0 +1,33 @@ +server.port=${ACT_GATEWAY_PORT:8080} +spring.application.name=${ACT_GATEWAY_APP_NAME:gateway} +management.security.enabled=${ACT_GATEWAY_MANAGEMENT_SECURITY:false} + +spring.rabbitmq.host=${ACT_RABBITMQ_HOST:rabbitmq} +eureka.client.serviceUrl.defaultZone=${ACT_EUREKA_URL:http://activiti-cloud-registry:8761/eureka/} + +hystrix.command.default.execution.timeout.enabled=${ACT_GATEWAY_HYSTRIX_TIMEOUT_ENABLED:false} +hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=${ACT_GATEWAY_HYSTRIX_TIMEOUT:210000} + +zuul.sensitive-headers=${ACT_GATEWAY_SENSITIVE_HEADERS:Cookie,Set-Cookie} + +keycloak.auth-server-url=${ACT_KEYCLOAK_URL:http://activiti-cloud-sso-idm:8180/auth} +keycloak.realm=${ACT_KEYCLOAK_REALM:springboot} +keycloak.resource=${ACT_KEYCLOAK_RESOURCE:activiti} +keycloak.public-client=${ACT_KEYCLOAK_CLIENT:true} + +keycloak.security-constraints[0].authRoles[0]=${ACT_KEYCLOAK_ROLES:user} +keycloak.security-constraints[0].securityCollections[0].patterns[0]=${ACT_KEYCLOAK_PATTERNS:/*} + +keycloak.principal-attribute=${ACT_KEYCLOAK_PRINCIPAL_ATTRIBUTE:preferred-username} +# see https://issues.jboss.org/browse/KEYCLOAK-810 for configuration options + +#hostname as declared to eureka +eureka.instance.hostname=${ACT_GATEWAY_HOST:activiti-cloud-gateway} +eureka.client.enabled=${ACT_GATEWAY_EUREKA_CLIENT_ENABLED:true} + +activiti.cors=${ACT_GATEWAY_CORS:false} +keycloak.cors=${ACT_KEYCLOAK_CORS:true} +keycloak.cors-max-age=${ACT_KEYCLOAK_CORS_MAX_AGE:1000} +keycloak.cors-allowed-methods=${ACT_KEYCLOAK_CORS_METHODS:POST,PUT,DELETE,GET} +keycloak.cors-allowed-headers=${ACT_KEYCLOAK_CORS_HEADERS:Access-Control-Allow-Origin,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization} +keycloak.ssl-required=${ACT_KEYCLOAK_SSL_REQUIRED:none} \ No newline at end of file diff --git a/query.properties b/query.properties new file mode 100644 index 0000000..3257d86 --- /dev/null +++ b/query.properties @@ -0,0 +1,34 @@ +server.port=${ACT_QUERY_PORT:8182} +spring.application.name=${ACT_QUERY_APP_NAME:query} + +spring.cloud.stream.bindings.producer.destination=${ACT_QUERY_PRODUCER_DEST:engineEvents} +spring.cloud.stream.bindings.producer.contentType=${ACT_QUERY_PRODUCER_CONTENT_TYPE:application/json} +spring.cloud.stream.bindings.queryConsumer.destination=${ACT_QUERY_CONSUMER_DEST:engineEvents} +spring.cloud.stream.bindings.queryConsumer.group=${ACT_QUERY_CONSUMER_GROUP:query} +spring.cloud.stream.bindings.queryConsumer.contentType=${ACT_QUERY_CONSUMER_CONTENT_TYPE:application/json} +spring.jackson.serialization.fail-on-unwrapped-type-identifiers=${ACT_QUERY_JACKSON_FAIL_ON_UNWRAPPED_IDS:false} + +keycloak.auth-server-url=${ACT_KEYCLOAK_URL:http://activiti-cloud-sso-idm:8180/auth} +keycloak.realm=${ACT_KEYCLOAK_REALM:springboot} +keycloak.resource=${ACT_KEYCLOAK_RESOURCE:activiti} +keycloak.public-client=${ACT_KEYCLOAK_CLIENT:true} + +keycloak.ssl-required=${ACT_KEYCLOAK_SSL_REQUIRED:none} + +keycloak.security-constraints[0].authRoles[0]=${ACT_KEYCLOAK_ROLES:user} +keycloak.security-constraints[0].securityCollections[0].patterns[0]=${ACT_KEYCLOAK_PATTERNS:/*} + +keycloak.principal-attribute=${ACT_KEYCLOAK_PRINCIPAL_ATTRIBUTE:preferred-username} +# see https://issues.jboss.org/browse/KEYCLOAK-810 for configuration options + +keycloakadminclientapp=${ACT_KEYCLOAK_CLIENT_APP:admin-cli} +keycloakclientuser=${ACT_KEYCLOAK_CLIENT_USER:client} +keycloakclientpassword=${ACT_KEYCLOAK_CLIENT_PASSWORD:client} +# this user needs to have the realm management roles assigned + +spring.rabbitmq.host=${ACT_RABBITMQ_HOST:rabbitmq} +eureka.client.serviceUrl.defaultZone=${ACT_EUREKA_URL:http://activiti-cloud-registry:8761/eureka/} + +#hostname as declared to eureka +eureka.instance.hostname=${ACT_QUERY_HOST:activiti-cloud-query} +eureka.client.enabled=${ACT_QUERY_EUREKA_CLIENT_ENABLED:true} \ No newline at end of file diff --git a/registry.properties b/registry.properties new file mode 100644 index 0000000..75e6d3b --- /dev/null +++ b/registry.properties @@ -0,0 +1,3 @@ +server.port=${ACT_REGISTRY_PORT:8761} +eureka.client.register-with-eureka=${ACT_REGISTRY_REGISTER_WITH_EUREKA:false} +eureka.client.fetch-registry=${ACT_REGISTRY_FETCH:false} \ No newline at end of file diff --git a/runtime-bundle1.properties b/runtime-bundle1.properties new file mode 100644 index 0000000..942fb7c --- /dev/null +++ b/runtime-bundle1.properties @@ -0,0 +1,51 @@ +#currently having fix port as eureka otherwise uses port 0 as with 11jan comment on https://github.com/spring-cloud/spring-cloud-config/issues/93 and in https://stackoverflow.com/questions/33270996/with-spring-cloud-brixton-m1-random-port-not-registered-with-eureka +server.port=${ACT_RB_PORT:8081} +spring.application.name=${ACT_RB_APP_NAME:runtime-bundle1} + +spring.cloud.stream.bindings.auditProducer.destination=${ACT_RB_AUDIT_PRODUCER_DEST:engineEvents} +spring.cloud.stream.bindings.auditProducer.contentType=${ACT_RB_AUDIT_PRODUCER_CONTENT_TYPE:application/json} +spring.cloud.stream.bindings.myCmdResults.destination=${ACT_RB_COMMAND_RESULTS_DEST:commandResults} +spring.cloud.stream.bindings.myCmdResults.group=${ACT_RB_COMMAND_RESULTS_GROUP:myCmdGroup} +spring.cloud.stream.bindings.myCmdResults.contentType=${ACT_RB_COMMAND_RESULTS_CONTENT_TYPE:application/json} +spring.cloud.stream.bindings.myCmdProducer.destination=${ACT_RB_COMMAND_RESULTS_DEST:commandConsumer} +spring.cloud.stream.bindings.myCmdProducer.contentType=${ACT_RB_COMMAND_RESULTS_CONTENT_TYPE:application/json} +spring.jackson.serialization.fail-on-unwrapped-type-identifiers=${ACT_RB_JACKSON_FAIL_ON_UNWRAPPED_IDS:false} + +keycloak.auth-server-url=${ACT_KEYCLOAK_URL:http://activiti-cloud-sso-idm:8180/auth} +keycloak.realm=${ACT_KEYCLOAK_REALM:springboot} +keycloak.resource=${ACT_KEYCLOAK_RESOURCE:activiti} +keycloak.public-client=${ACT_KEYCLOAK_CLIENT:true} + +keycloak.security-constraints[0].authRoles[0]=${ACT_KEYCLOAK_ROLES:user} +keycloak.security-constraints[0].securityCollections[0].patterns[0]=${ACT_KEYCLOAK_PATTERNS:/*} + +keycloak.principal-attribute=${ACT_KEYCLOAK_PRINCIPAL_ATTRIBUTE:preferred-username} +# see https://issues.jboss.org/browse/KEYCLOAK-810 for configuration options + +keycloakadminclientapp=${ACT_KEYCLOAK_CLIENT_APP:admin-cli} +keycloakclientuser=${ACT_KEYCLOAK_CLIENT_USER:client} +keycloakclientpassword=${ACT_KEYCLOAK_CLIENT_PASSWORD:client} +# this user needs to have the realm management roles assigned + +#change this for prod envs +keycloak.ssl-required=${ACT_KEYCLOAK_SSL_REQUIRED:none} + +spring.rabbitmq.host=${ACT_RABBITMQ_HOST:rabbitmq} +eureka.client.serviceUrl.defaultZone=${ACT_EUREKA_URL:http://activiti-cloud-registry:8761/eureka/} + +#hostname as declared to eureka +eureka.instance.hostname=${ACT_RB_HOST:activiti-cloud-runtime-bundle} + +spring.datasource.driverClassName=${ACT_RB_DB_DRIVER:org.postgresql.Driver} +spring.datasource.url=${ACT_RB_DB_URI:jdbc:postgresql://rb-postgres:5432/activitidb} +spring.datasource.username=${ACT_RB_DB_USER:postgres} +spring.datasource.password=${ACT_RB_DB_PASS:password} + +spring.jpa.database-platform=${ACT_RB_DB_PLATFORM:org.hibernate.dialect.PostgreSQLDialect} +spring.jpa.generate-ddl=${ACT_RB_GENERATEDDL:true} +spring.jpa.hibernate.ddl-auto=${ACT_RB_DDLAUTO:create} + +#env variable or /processes/ fallback - or if below is removed classpath:/processes/ is used as per ActivitiProperties class +spring.activiti.process-definition-location-prefix=file:${ACT_RB_PROCESSES_PATH:/processes/} +eureka.client.enabled=${ACT_RB_EUREKA_CLIENT_ENABLED:true} +loader.path=${ACT_RB_LIBDIR:lib/} \ No newline at end of file -- 2.26.0