Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database migration entrypoint #677

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
13 changes: 5 additions & 8 deletions docker/openshift/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ COPY / /var/www/html/
WORKDIR /var/www/html
RUN composer install --no-progress --profile --prefer-dist --no-interaction --no-dev --optimize-autoloader

# Copy ALL deploy scripts
# Copy custom entrypoint, deploy and cron entrypoints.
RUN mkdir -p /crons /entrypoints /deploy
COPY docker/openshift/entrypoints/ /entrypoints
RUN chmod +x /entrypoints/*
COPY docker/openshift/crons/ /crons
COPY docker/openshift/deploy /deploy
RUN chmod +x /entrypoints/* /deploy/* /crons/*

COPY docker/openshift/init.sh /

# Copy cron scripts
RUN mkdir /crons
COPY docker/openshift/crons/ /crons
COPY docker/openshift/cron-entrypoint.sh /usr/local/bin/cron-entrypoint
RUN chmod +x /crons/* /usr/local/bin/cron-entrypoint

# Copy nginx overrides.
COPY docker/openshift/custom.locations /etc/nginx/conf.d/custom.locations
11 changes: 11 additions & 0 deletions docker/openshift/deploy/10-preflight.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

source /init.sh

if [ -f "../docker/openshift/preflight/preflight.php" ]; then
echo "Running preflight checks ..."
if ! php ../docker/openshift/preflight/preflight.php; then
exit 1
fi
fi

21 changes: 21 additions & 0 deletions docker/openshift/deploy/20-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

source /init.sh

echo "Starting deploy: $(date)"

# Populate deploy ID so 20-deploy.sh is skipped.
# @todo Remove this once 20-deploy.sh is removed.
set_deploy_id $OPENSHIFT_BUILD_NAME

drush state:set system.maintenance_mode 1 --input-format=integer
# Run pre-deploy tasks.
# @see https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/blob/main/documentation/deploy-hooks.md
drush helfi:pre-deploy || true
# Run maintenance tasks (config import, database updates etc)
drush deploy
# Run post-deploy tasks.
# @see https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/blob/main/documentation/deploy-hooks.md
drush helfi:post-deploy || true
# Disable maintenance mode
drush state:set system.maintenance_mode 0 --input-format=integer
21 changes: 21 additions & 0 deletions docker/openshift/drush-deploy-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

source /init.sh

echo "Starting deploy: $(date)"

# Populate deploy ID so 20-deploy.sh is skipped.
# @todo Remove this once 20-deploy.sh is removed.
set_deploy_id $OPENSHIFT_BUILD_NAME

drush state:set system.maintenance_mode 1 --input-format=integer
# Run pre-deploy tasks.
# @see https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/blob/main/documentation/deploy-hooks.md
drush helfi:pre-deploy || true
# Run maintenance tasks (config import, database updates etc)
drush deploy
# Run post-deploy tasks.
# @see https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/blob/main/documentation/deploy-hooks.md
drush helfi:post-deploy || true
# Disable maintenance mode
drush state:set system.maintenance_mode 0 --input-format=integer
Loading