-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1029 from devgateway/OCE-546-upgrade
Oce 546 upgrade
- Loading branch information
Showing
984 changed files
with
76,897 additions
and
35,454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
JWT_SECRET=1321323232 | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=1234 | ||
MONGO_INITDB_ROOT_USERNAME=root | ||
MONGO_INITDB_ROOT_PASSWORD=1234 | ||
RECAPTCHA_SECRET=431243325342 | ||
INFOBIP_KEY=452789534289 | ||
SMSGATEWAY_KEY=98459432897 | ||
SMTP_PORT=25 | ||
SMTP_HOST=host.docker.internal | ||
SERVER_URL=http://localhost:8090 | ||
SPRING_DEVTOOLS_RESTART_ENABLED=false | ||
DISABLE_EMAIL_SENDING=false | ||
APP_IMAGE=ocportal-client/admin/dev | ||
TAG=latest | ||
PROJECT_NAME=ocmakueni | ||
|
||
#Organization properties | ||
ORG_NAME=Wakanda | ||
ORG_SHORT_NAME=DOGEdd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
pull_request: | ||
branches: [ "develop" ] | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build the Docker image | ||
run: docker compose build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v14.15.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Base image for compiling | ||
FROM maven:3.8-openjdk-17 as compiler | ||
|
||
WORKDIR /tmp/build | ||
|
||
# Install required tools | ||
RUN microdnf install zip | ||
|
||
# Define a build argument for project name (default: ocportal) | ||
ARG PROJECT_NAME=ocportal | ||
|
||
# Copy pom.xml files | ||
COPY forms/pom.xml forms/pom.xml | ||
COPY persistence/pom.xml persistence/pom.xml | ||
COPY persistence-mongodb/pom.xml persistence-mongodb/pom.xml | ||
COPY web/pom.xml web/pom.xml | ||
COPY pom.xml . | ||
|
||
# Set Maven options | ||
ENV MAVEN_OPTS="-XX:-TieredCompilation -XX:TieredStopAtLevel=1" | ||
|
||
# Use a cache-friendly Maven dependency resolution | ||
RUN --mount=type=cache,target=/root/.m2,id=${PROJECT_NAME}-m2 \ | ||
find . -name pom.xml | xargs -I@ mvn -B -f @ dependency:go-offline dependency:resolve-plugins || true | ||
|
||
# Copy all source code | ||
COPY . . | ||
#we compile the code then we explode the fat jar. This is useful to create a reusable layer and save image space/compile time | ||
RUN --mount=type=cache,target=/root/.m2,id=${PROJECT_NAME}-m2 \ | ||
mvn -T 1C clean package -DskipTests -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -Dmaven.gitcommitid.skip=true | ||
|
||
# Extract compiled JAR to save space and improve caching | ||
RUN mkdir -p forms/target/deps \ | ||
&& cd forms/target/deps \ | ||
&& unzip -qo '../*.jar' || ( e=$? && if [ $e -ne 1 ]; then exit $e; fi ) \ | ||
&& rm -f ../*.* | ||
|
||
# Production image | ||
FROM openjdk:17-jdk-slim as prod | ||
|
||
WORKDIR /opt/app | ||
|
||
# Install required dependencies | ||
RUN apt-get update && apt-get install -y fontconfig libfreetype6 && rm -rf /var/lib/apt/lists/* | ||
#we copy artifacts from exploded jar, one by one, each COPY command will create a separate docker layer | ||
#this means that for example if lib folder gets unchanged in between builds (no jars were updated) the same layer is reused | ||
COPY --from=compiler /tmp/build/forms/target/deps/BOOT-INF/lib lib | ||
COPY --from=compiler /tmp/build/forms/target/deps/META-INF META-INF | ||
COPY --from=compiler /tmp/build/forms/target/deps/BOOT-INF/classes . | ||
|
||
# Copy entrypoint script | ||
COPY --chmod=0755 entrypoint.sh . | ||
|
||
# Expose application port | ||
EXPOSE 8090 | ||
|
||
# Wait for dependencies before starting app | ||
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.12.0/wait /wait | ||
RUN chmod +x /wait | ||
|
||
# Start application | ||
CMD /wait && /opt/app/entrypoint.sh admin | ||
|
||
# Development image | ||
FROM openjdk:17-jdk-slim as dev | ||
|
||
WORKDIR /opt/app | ||
|
||
# Install required dependencies | ||
RUN apt-get update && apt-get install -y fontconfig libfreetype6 && rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy compiled dependencies | ||
COPY --from=compiler /tmp/build/forms/target/deps/BOOT-INF/lib lib | ||
|
||
# Remove development-specific JARs to avoid conflicts | ||
RUN rm -f lib/persistence*-SNAPSHOT.jar | ||
RUN rm -f lib/web*-SNAPSHOT.jar | ||
|
||
# Copy entrypoint script | ||
COPY --chmod=0755 entrypoint.sh . | ||
|
||
# Expose application and debug ports | ||
EXPOSE 8090 | ||
EXPOSE 8000 | ||
|
||
# Enable remote debugging | ||
ENV JAVA_TOOL_OPTIONS "-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n" | ||
|
||
# Wait for database readiness before starting the app | ||
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.12.0/wait /wait | ||
RUN chmod +x /wait | ||
|
||
# Start application in development mode | ||
CMD /wait && /opt/app/entrypoint.sh admin-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
pipeline { | ||
agent any | ||
tools { | ||
maven 'Maven36' | ||
} | ||
|
||
stages { | ||
stage('Build') { | ||
steps { | ||
sh 'mvn -T 4C clean package -Dmaven.javadoc.skip=true -Dmaven.compile.fork=true -Dmaven.junit.fork=true -DskipTests' | ||
archiveArtifacts artifacts: 'forms/target/forms*.jar', fingerprint: true | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
cleanWs(cleanWhenNotBuilt: false, deleteDirs: true) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
version: '3.8' | ||
|
||
services: | ||
|
||
app: | ||
image: ${APP_IMAGE:-ocportal/admin/dev}:${TAG:-local} | ||
restart: 'no' | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" #required so docker connects to host interface (this is for sending emails) | ||
build: | ||
target: dev | ||
args: | ||
PROJECT_NAME: ${PROJECT_NAME:-ocportal} | ||
depends_on: | ||
- db | ||
- mongo | ||
ports: | ||
- "8090:8090" | ||
- "8000:8000" | ||
env_file: | ||
- .env | ||
environment: | ||
# Set environment variables that the app can use at runtime | ||
ORG_NAME: ${ORG_NAME:-Makueni County Government} | ||
ORG_SHORT_NAME: ${ORG_SHORT_NAME:-Makueni} | ||
#entrypoint: /bin/sh -c "while sleep 1000; do :; done" | ||
volumes: | ||
- ./forms/target/classes:/opt/app/forms/classes | ||
- ./persistence/target/classes:/opt/app/persistence/classes | ||
- ./persistence-mongodb/target/classes:/opt/app/persistence-mongodb/classes | ||
- ./web/target/classes:/opt/app/web/classes | ||
- ./ui:/opt/app/ui | ||
|
||
db: | ||
image: postgis/postgis:11-3.3 | ||
restart: 'no' | ||
volumes: | ||
- pgdata:/var/lib/postgresql/data | ||
ports: | ||
- "5432:5432" | ||
env_file: | ||
- .env | ||
|
||
mongo: | ||
image: mongo:4.2 | ||
restart: 'no' | ||
command: [--auth] | ||
volumes: | ||
- mongodata:/data/db | ||
ports: | ||
- "27017:27017" | ||
env_file: | ||
- .env | ||
|
||
# pgbackups: | ||
# image: prodrigestivill/postgres-backup-local | ||
# restart: 'no' | ||
# volumes: | ||
# - /opt/pgbackups:/backups | ||
# env_file: | ||
# - .env | ||
# depends_on: | ||
# - db | ||
# environment: | ||
# - POSTGRES_HOST=db | ||
# - POSTGRES_DB=ocportal | ||
# - POSTGRES_USER=$POSTGRES_USER | ||
# - POSTGRES_PASSWORD=$POSTGRES_PASSWORD | ||
# - SCHEDULE=@daily | ||
# - BACKUP_KEEP_DAYS=30 | ||
# - BACKUP_KEEP_WEEKS=12 | ||
# - BACKUP_KEEP_MONTHS=24 | ||
# - HEALTHCHECK_PORT=5432 | ||
|
||
volumes: | ||
pgdata: | ||
mongodata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
version: '3.8' | ||
|
||
services: | ||
|
||
app: | ||
image: ${APP_IMAGE:-ocportal/admin/dev}:${TAG:-local} | ||
restart: always | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" #required so docker connects to host interface (this is for sending emails) | ||
build: | ||
target: prod | ||
args: | ||
PROJECT_NAME: ${PROJECT_NAME:-ocportal} | ||
depends_on: | ||
- db | ||
- mongo | ||
ports: | ||
- "127.0.0.1:8090:8090" | ||
env_file: | ||
- .env | ||
|
||
db: | ||
image: postgis/postgis:11-3.3 | ||
restart: always | ||
volumes: | ||
- pgdata:/var/lib/postgresql/data | ||
env_file: | ||
- .env | ||
|
||
mongo: | ||
image: mongo:4.2 | ||
restart: always | ||
command: [--auth] | ||
volumes: | ||
- mongodata:/data/db | ||
env_file: | ||
- .env | ||
|
||
pgbackups: | ||
image: prodrigestivill/postgres-backup-local | ||
restart: always | ||
volumes: | ||
- /opt/pgbackups:/backups | ||
env_file: | ||
- .env | ||
depends_on: | ||
- db | ||
environment: | ||
- POSTGRES_HOST=db | ||
- POSTGRES_DB=ocportal | ||
- POSTGRES_USER=$POSTGRES_USER | ||
- POSTGRES_PASSWORD=$POSTGRES_PASSWORD | ||
- SCHEDULE=@daily | ||
- BACKUP_KEEP_DAYS=30 | ||
- BACKUP_KEEP_WEEKS=12 | ||
- BACKUP_KEEP_MONTHS=24 | ||
- HEALTHCHECK_PORT=5432 | ||
|
||
volumes: | ||
pgdata: | ||
mongodata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/sh | ||
|
||
COMMON_JAVA_ARGS="$(tr '\n' ' ' <<-EOF | ||
-server | ||
-DjwtSecret=$JWT_SECRET | ||
-Dserver.address=0.0.0.0 | ||
-Dwicket.configuration=deployment | ||
-Dfile.encoding=UTF-8 | ||
-DserverURL=$SERVER_URL | ||
-DdisableEmailSending=$DISABLE_EMAIL_SENDING | ||
-Dspring.devtools.restart.enabled=$SPRING_DEVTOOLS_RESTART_ENABLED | ||
-Xms512m | ||
-Xmx6144m | ||
--add-opens=java.naming/jakarta.naming=ALL-UNNAMED | ||
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED | ||
--add-opens=java.base/java.lang.ref=ALL-UNNAMED | ||
--add-opens=java.base/java.lang=ALL-UNNAMED | ||
--add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED | ||
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED | ||
--add-opens=java.base/java.io=ALL-UNNAMED | ||
--add-opens=java.base/java.security=ALL-UNNAMED | ||
--add-opens=java.base/java.util=ALL-UNNAMED | ||
--add-opens=java.management/jakarta.management=ALL-UNNAMED | ||
-Dspring.mail.port=$SMTP_PORT | ||
-Dspring.mail.host=$SMTP_HOST | ||
-XX:MaxMetaspaceSize=512m | ||
-XX:ReservedCodeCacheSize=256m | ||
-Dspring.jmx.enabled=true | ||
-Dspring.datasource.username=$POSTGRES_USER | ||
-Dspring.datasource.password=$POSTGRES_PASSWORD | ||
-DJava.awt.headless=true | ||
-XX:+UseG1GC | ||
-Dspring.data.mongodb.uri=mongodb://$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@mongo:27017/ocportal?authSource=admin | ||
-Dspring.datasource.url=jdbc:postgresql://db/ocportal | ||
-Dgoogle.recaptcha.secret=$RECAPTCHA_SECRET | ||
-Dinfobip.key=$INFOBIP_KEY | ||
-Dsmsgateway.key=$SMSGATEWAY_KEY | ||
EOF | ||
)" | ||
|
||
case "$1" in | ||
admin) | ||
JAVA_ARGS="${COMMON_JAVA_ARGS} $(tr '\n' ' ' <<-EOF | ||
-cp .:lib/* | ||
org.devgateway.toolkit.forms.wicket.FormsWebApplication | ||
EOF | ||
)" | ||
exec java $JAVA_ARGS $@ | ||
;; | ||
admin-dev) | ||
JAVA_ARGS="${COMMON_JAVA_ARGS} $(tr '\n' ' ' <<-EOF | ||
-Dspring.devtools.restart.additional-exclude=logs/**,META-INF/**,ehcache-disk-store/** | ||
-Dspring.devtools.restart.poll-interval=3s | ||
-Dspring.devtools.restart.quiet-period=2s | ||
-XX:+TieredCompilation | ||
-XX:TieredStopAtLevel=1 | ||
-noverify | ||
-cp forms/classes:persistence-mongodb/classes:web/classes:persistence/classes:lib/* | ||
org.devgateway.toolkit.forms.wicket.FormsWebApplication | ||
EOF | ||
)" | ||
exec java $JAVA_ARGS $@ | ||
;; | ||
*) | ||
exec "$@" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ORG_NAME=Wakanda | ||
ORG_SHORT_NAME=REDDIT | ||
LOGO_PATH=assets/img/logo.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
JAVA_OPTS="-Dspring.profiles.active=default -Djava.awt.headless=true -Xmx4096M -Dwicket.configuration=deployment -Dderby.optimizer.optimizeJoinOrder=false -Dspringfox.documentation.swagger.v2.host=website.url" | ||
JAVA_OPTS="-Dspring.profiles.active=default -Djava.awt.headless=true -Xmx4096M -Dwicket.configuration=deployment -Dderby.optimizer.optimizeJoinOrder=false" |
Oops, something went wrong.