Skip to content

Commit

Permalink
Merge pull request #228 from TAMULib/issue_219-deploy_as_folio
Browse files Browse the repository at this point in the history
Issue 219: Mod Camunda needs to be registered/deployed as a FOLIO module.
  • Loading branch information
kaladay authored Nov 10, 2023
2 parents a63fa1d + 1a65b07 commit 4ffc836
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 63 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions descriptors/DeploymentDescriptor-template.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "@project.artifactId@-@project.version@",
"id": "${project.artifactId}-${project.version}",
"name": "Camnuda BPM Module",
"provides": [
{
Expand Down Expand Up @@ -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." }
]
}
}
}
76 changes: 44 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,50 @@

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<id>filter-descriptor-inputs</id>
<phase>generate-resources</phase>
<goals>
<goal>shade</goal>
<goal>copy-resources</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>org.folio.inventory.Launcher</Main-Class>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</transformer>
</transformers>
<artifactSet />
<outputFile>${project.build.directory}/fat/${project.artifactId}.jar</outputFile>
<outputDirectory>${project.build.directory}</outputDirectory>
<resources>
<resource>
<directory>${basedir}/descriptors</directory>
<include>*Descriptor*-template.json</include>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>rename-descriptor-outputs</id>
<phase>generate-resources</phase>
<goals>
<goal>rename</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<sourceFile>${project.build.directory}/ModuleDescriptor-template.json</sourceFile>
<destinationFile>${project.build.directory}/ModuleDescriptor.json</destinationFile>
</fileSet>
<fileSet>
<sourceFile>${project.build.directory}/DeploymentDescriptor-template.json</sourceFile>
<destinationFile>${project.build.directory}/DeploymentDescriptor.json</destinationFile>
</fileSet>
</fileSets>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -140,24 +165,6 @@
<include>application.yml</include>
</includes>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/main/resources/descriptors</directory>
<targetPath>descriptors</targetPath>
<includes>
<include>DeploymentDescriptor.json</include>
<include>ModuleDescriptor.json</include>
</includes>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/main/resources/descriptors</directory>
<targetPath>../descriptors</targetPath>
<includes>
<include>DeploymentDescriptor.json</include>
<include>ModuleDescriptor.json</include>
</includes>
</resource>
</resources>

</build>
Expand Down Expand Up @@ -362,6 +369,11 @@
<version>22.3.3</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

</dependencies>

<distributionManagement>
Expand Down
40 changes: 27 additions & 13 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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@"
Expand Down
7 changes: 0 additions & 7 deletions src/main/resources/descriptors/DeploymentDescriptor.json

This file was deleted.

0 comments on commit 4ffc836

Please sign in to comment.