diff --git a/Dockerfile b/Dockerfile index d6c00605..12f2f110 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,11 @@ USER folio ENV VERTICLE_FILE mod-camunda.jar -# Set the location of the verticles +# Set the location of the verticles. ENV VERTICLE_HOME /usr/verticles -# Copy your fat jar to the container -COPY target/fat/${VERTICLE_FILE} ${VERTICLE_HOME}/${VERTICLE_FILE} +# Copy your jar to the container. +COPY target/mod-camunda*.jar ${VERTICLE_HOME}/${VERTICLE_FILE} # Expose this port locally in the container. -EXPOSE 9000 +EXPOSE 8081 diff --git a/descriptors/DeploymentDescriptor-template.json b/descriptors/DeploymentDescriptor-template.json new file mode 100644 index 00000000..84ec910a --- /dev/null +++ b/descriptors/DeploymentDescriptor-template.json @@ -0,0 +1,7 @@ +{ + "srvcId": "${project.artifactId}-${project.version}", + "nodeId": "localhost", + "descriptor": { + "exec": "java -Dport=%p -jar ../${artifactId}/target/${project.artifactId}-${project.version}.jar -Dspring.config.location=classpath:/ -Dhttp.port=%p --server.port=%p" + } +} diff --git a/src/main/resources/descriptors/ModuleDescriptor.json b/descriptors/ModuleDescriptor-template.json similarity index 92% rename from src/main/resources/descriptors/ModuleDescriptor.json rename to descriptors/ModuleDescriptor-template.json index fd989324..27fc9643 100644 --- a/src/main/resources/descriptors/ModuleDescriptor.json +++ b/descriptors/ModuleDescriptor-template.json @@ -1,5 +1,5 @@ { - "id": "@project.artifactId@-@project.version@", + "id": "${project.artifactId}-${project.version}", "name": "Camnuda BPM Module", "provides": [ { @@ -382,12 +382,35 @@ "visible": false } ], - "requires": [ ], + "requires": [ + { + "id": "mod-workflow", + "version": "1.1" + } + ], "launchDescriptor": { - "dockerImage": "@project.artifactId@:@project.version@", + "dockerImage": "${project.artifactId}:${project.version}", + "dockerPull" : false, "dockerArgs": { - "HostConfig": { "PortBindings": { "8081/tcp": [{ "HostPort": "%p" }] } } - }, - "dockerPull" : false + "HostConfig": { + "Memory": 402653184, + "PortBindings": { "8081/tcp": [ { "HostPort": "%p" } ] } + } + }, + "env": [ + { + "name": "JAVA_OPTIONS", + "value": "-XX:MaxRAMPercentage=66.0" + }, + { "name": "DB_HOST", "value": "postgres" }, + { "name": "DB_PORT", "value": "5432" }, + { "name": "DB_USERNAME", "value": "folio_admin" }, + { "name": "DB_PASSWORD", "value": "folio_admin" }, + { "name": "DB_DATABASE", "value": "okapi_modules" }, + { "name": "DB_QUERYTIMEOUT", "value": "60000" }, + { "name": "DB_CHARSET", "value": "UTF-8" }, + { "name": "DB_MAXPOOLSIZE", "value": "16" }, + { "name": "OKAPI_URL", "value": "http://10.0.2.15:9130", "description": "The URL to the OKAPI service." } + ] } -} \ No newline at end of file +} diff --git a/pom.xml b/pom.xml index fbcc8e40..5b1807b3 100644 --- a/pom.xml +++ b/pom.xml @@ -80,25 +80,50 @@ org.apache.maven.plugins - maven-shade-plugin - 3.5.1 + maven-resources-plugin - package + filter-descriptor-inputs + generate-resources - shade + copy-resources - - - - org.folio.inventory.Launcher - true - - - - - ${project.build.directory}/fat/${project.artifactId}.jar + ${project.build.directory} + + + ${basedir}/descriptors + *Descriptor*-template.json + true + + + + + + + + + com.coderplus.maven.plugins + copy-rename-maven-plugin + 1.0.1 + + + rename-descriptor-outputs + generate-resources + + rename + + + + + ${project.build.directory}/ModuleDescriptor-template.json + ${project.build.directory}/ModuleDescriptor.json + + + ${project.build.directory}/DeploymentDescriptor-template.json + ${project.build.directory}/DeploymentDescriptor.json + + @@ -140,24 +165,6 @@ application.yml - - true - src/main/resources/descriptors - descriptors - - DeploymentDescriptor.json - ModuleDescriptor.json - - - - true - src/main/resources/descriptors - ../descriptors - - DeploymentDescriptor.json - ModuleDescriptor.json - - @@ -362,6 +369,11 @@ 22.3.3 + + org.springframework.boot + spring-boot-starter-actuator + + diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index be0e4de1..e487cbe1 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -26,33 +26,35 @@ spring: returnBodyOnUpdate: true sql: init: - platform: h2 + #platform: h2 + platform: postgres datasource: hikari: leakDetectionThreshold: 1800000 connectionTimeout: 30000 idleTimeout: 600000 maxLifetime: 1800000 - maximumPoolSize: 16 - url: jdbc:h2:./target/mod-camunda;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - driverClassName: org.h2.Driver - # platform: postgres - # driverClassName: org.postgresql.Driver - # url: jdbc:postgresql://localhost:5432/mod_camunda + maximumPoolSize: ${DB_MAXPOOLSIZE:16} + #url: jdbc:h2:./target/mod-camunda;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + #driverClassName: org.h2.Driver + #platform: h2 + driverClassName: org.postgresql.Driver + url: jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_DATABASE:mod_camunda} + platform: postgres - username: folio_admin - password: folio_admin + username: ${DB_USERNAME:folio_admin} + password: ${DB_PASSWORD:folio_admin} h2: console: - enabled: true + enabled: false path: /h2console settings: web-allow-others: true jpa: - database-platform: org.hibernate.dialect.H2Dialect - # database-platform: org.hibernate.dialect.PostgreSQLDialect + #database-platform: org.hibernate.dialect.H2Dialect + database-platform: org.hibernate.dialect.PostgreSQLDialect properties.hibernate.jdbc.lob.non_contextual_creation: true generate-ddl: false @@ -116,7 +118,7 @@ tenant: - classpath:/org/camunda/bpm/engine/db/create/activiti.h2.create.decision.engine.sql - classpath:/org/camunda/bpm/engine/db/create/activiti.h2.create.decision.history.sql -okapi.url: http://localhost:9130 +okapi.url: ${OKAPI_URL:http://localhost:9130} error: handling: @@ -125,6 +127,18 @@ error: # comma seperated email addresses emailTo: support@mailinator.com +management: + endpoints: + web: + exposure: + include: health + base-path: /admin + health: + defaults: + enabled: true + readinessstate: + enabled: true + info: build: artifact: "@project.artifactId@" diff --git a/src/main/resources/descriptors/DeploymentDescriptor.json b/src/main/resources/descriptors/DeploymentDescriptor.json deleted file mode 100644 index 6128a5a9..00000000 --- a/src/main/resources/descriptors/DeploymentDescriptor.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "srvcId": "@project.artifactId@-@project.version@", - "nodeId": "localhost", - "descriptor": { - "exec": "java -jar ../mod-camunda/target/mod-camunda-@project.version@.jar -Dspring.config.location=classpath:/ --server.port=%p" - } -} \ No newline at end of file