Skip to content

Commit

Permalink
feat(ct): enable skipping all deployments on app server start #9590
Browse files Browse the repository at this point in the history
With using the env var "SKIP_DEPLOY" or the Maven property "-Dapp.deploy.skip"
we can make the application server not deploy Dataverse on container start.
This is necessary to save on time and manual undeploy when using Payara IDE tools
to hot deploy changes.
  • Loading branch information
poikilotherm committed Nov 8, 2023
1 parent 5630e76 commit 76b87b0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ APP_IMAGE=gdcc/dataverse:unstable
POSTGRES_VERSION=13
DATAVERSE_DB_USER=dataverse
SOLR_VERSION=9.3.0
SKIP_DEPLOY=0
1 change: 1 addition & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
- DATAVERSE_DB_USER=${DATAVERSE_DB_USER}
- ENABLE_JDWP=1
- ENABLE_RELOAD=1
- SKIP_DEPLOY=${SKIP_DEPLOY}
- DATAVERSE_FEATURE_API_BEARER_AUTH=1
- DATAVERSE_AUTH_OIDC_ENABLED=1
- DATAVERSE_AUTH_OIDC_CLIENT_ID=test
Expand Down
3 changes: 2 additions & 1 deletion modules/container-base/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ ENV PATH="${PATH}:${PAYARA_DIR}/bin:${SCRIPT_DIR}" \
JVM_DUMPS_ARG="-XX:+HeapDumpOnOutOfMemoryError" \
ENABLE_JMX=0 \
ENABLE_JDWP=0 \
ENABLE_RELOAD=0
ENABLE_RELOAD=0 \
SKIP_DEPLOY=0

### PART 1: SYSTEM ###
ARG UID=1000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#
##########################################################################################################

set -euo pipefail

# Check required variables are set
if [ -z "$DEPLOY_DIR" ]; then echo "Variable DEPLOY_DIR is not set."; exit 1; fi
if [ -z "$PREBOOT_COMMANDS" ]; then echo "Variable PREBOOT_COMMANDS is not set."; exit 1; fi
Expand All @@ -51,8 +53,12 @@ deploy() {
if grep -q "$1" "$POSTBOOT_COMMANDS"; then
echo "post boot commands already deploys $1";
else
echo "Adding deployment target $1 to post boot commands";
echo "$DEPLOY_STATEMENT" >> "$POSTBOOT_COMMANDS";
if [ -n "$SKIP_DEPLOY" ] && { [ "$SKIP_DEPLOY" = "1" ] || [ "$SKIP_DEPLOY" = "true" ]; }; then
echo "Skipping deployment of $1 as requested.";
else
echo "Adding deployment target $1 to post boot commands";
echo "$DEPLOY_STATEMENT" >> "$POSTBOOT_COMMANDS";
fi
fi
}

Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,7 @@

<app.image>gdcc/dataverse:${app.image.tag}</app.image>
<app.image.tag>unstable</app.image.tag>
<app.deploy.skip>false</app.deploy.skip>
<base.image>gdcc/base:${base.image.tag}</base.image>
<base.image.tag>unstable</base.image.tag>
<conf.image>gdcc/configbaker:${conf.image.tag}</conf.image>
Expand All @@ -923,6 +924,7 @@
<POSTGRES_VERSION>${postgresql.server.version}</POSTGRES_VERSION>
<SOLR_VERSION>${solr.version}</SOLR_VERSION>
<DATAVERSE_DB_USER>dataverse</DATAVERSE_DB_USER>
<SKIP_DEPLOY>${app.deploy.skip}</SKIP_DEPLOY>
</properties>

<build>
Expand Down

0 comments on commit 76b87b0

Please sign in to comment.