Skip to content

Commit b327a7e

Browse files
authored
Updated quant deploy script for no-database deploys. (#1452)
1 parent c27c577 commit b327a7e

File tree

13 files changed

+51
-333
lines changed

13 files changed

+51
-333
lines changed

.circleci/config.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -449,27 +449,6 @@ jobs:
449449
DREVOPS_EXPORT_CODE_DIR: '/tmp/workspace/code_unused'
450450
<<: *job-build
451451

452-
# Deploy primary branches.
453-
deploy: &job_deploy
454-
<<: *runner_config
455-
steps:
456-
- attach_workspace:
457-
at: /tmp/workspace
458-
- add_ssh_keys:
459-
fingerprints:
460-
- *deploy_ssh_fingerprint
461-
- checkout
462-
- *step_process_codebase
463-
- run:
464-
command: |
465-
DREVOPS_DEPLOY_BRANCH="$CIRCLE_BRANCH" \
466-
DREVOPS_DEPLOY_PR="$(echo $CIRCLE_PULL_REQUEST | cut -d'/' -f 7)" \
467-
DREVOPS_DEPLOY_PR_HEAD=$CIRCLE_SHA1 \
468-
./scripts/drevops/deploy.sh
469-
no_output_timeout: 30m
470-
- store_artifacts:
471-
path: *artifacts
472-
473452
# Deploy artifact.
474453
deploy_artifact:
475454
<<: *runner_config

.docker/cli.dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,6 @@ RUN cd /app/web/themes/contrib/civictheme \
111111
RUN npm --prefix web/themes/custom/civictheme_demo install --no-audit --no-progress --unsafe-perm \
112112
&& cd /app/web/themes/custom/civictheme_demo && npm run build
113113
COPY .docker/entrypoints/cli/* /quant-entrypoint.d/
114+
115+
# Custom PHP configuration.
116+
COPY .docker/config/php/*.ini /usr/local/etc/php/conf.d/

.docker/config/php/zzz-memory.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
; Custom PHP memory limit
2+
memory_limit = 768M

.docker/entrypoints/cli/03-provision-site.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Post-rollout task: Provision site
5+
# Generated from .lagoon.yml
6+
7+
if [ "$LAGOON_ENVIRONMENT_TYPE" = "production" ] || [ "$LAGOON_GIT_BRANCH" = "${DREVOPS_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
8+
echo "==> Running in PRODUCTION environment."
9+
# Never unblock admin user in production.
10+
export DRUPAL_UNBLOCK_ADMIN=0
11+
# Never sanitize DB in production.
12+
export DREVOPS_PROVISION_SANITIZE_DB_SKIP=1
13+
fi
14+
#
15+
# Deployments from UI are not able to bypass the value of
16+
# DREVOPS_PROVISION_OVERRIDE_DB set by the deploy-lagoon.sh
17+
# during previous deployments (it sets value to '0' to mitigate Lagoon bug
18+
# where environment variables cannot be deleted and have to be set to a value).
19+
# @see https://github.com/uselagoon/lagoon/issues/1922
20+
# Explicitly set DB overwrite flag to the value from .env file for
21+
# deployments from the profile.
22+
if [ "${DREVOPS_PROVISION_USE_PROFILE}" = "1" ]; then
23+
export DREVOPS_PROVISION_OVERRIDE_DB="$(cat .env | grep ^DREVOPS_PROVISION_OVERRIDE_DB | cut -c31-)"
24+
fi
25+
./scripts/drevops/provision.sh

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ LAGOON_PROJECT=civictheme-monorepo-drupal
124124
# `artifact`,`docker`, `webhook`, `lagoon`.
125125
#
126126
# See https://docs.drevops.com/workflows/deploy
127-
DREVOPS_DEPLOY_TYPES=lagoon
127+
DREVOPS_DEPLOY_TYPES=none
128128

129129
# Dedicated branch to identify the production environment.
130130
DREVOPS_LAGOON_PRODUCTION_BRANCH=main

.github/workflows/build-deploy.yml

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ name: Build and Push civictheme-monorepo-drupal to Quant Cloud
1010
- release/*
1111
- hotfix/*
1212
- feature/editorial-*
13+
- project/quant-provision
1314
tags:
1415
- '*'
1516

@@ -37,28 +38,18 @@ jobs:
3738
quant_application: civictheme-monorepo-drupal
3839
master_branch_override: main
3940

40-
- name: Override outputs for quant-cloud-migration branch
41+
- name: Override outputs for special branches
4142
id: override-outputs
4243
run: |-
43-
# Override outputs for quant-cloud-migration branch to treat it as production
44-
if [[ "${{ github.ref }}" == "refs/heads/quant-cloud-migration" ]]; then
45-
echo "image_suffix=-latest" >> $GITHUB_OUTPUT
46-
echo "image_suffix_clean=latest" >> $GITHUB_OUTPUT
47-
echo "is_production=true" >> $GITHUB_OUTPUT
48-
echo "environment_name=production" >> $GITHUB_OUTPUT
49-
echo "environment_exists=true" >> $GITHUB_OUTPUT
50-
echo "Overriding outputs for quant-cloud-migration branch: using -latest suffix and production environment"
51-
else
52-
# Use the original action outputs
53-
echo "image_suffix=${{ steps.init.outputs.image_suffix }}" >> $GITHUB_OUTPUT
54-
# Remove leading hyphen from image_suffix for image_suffix parameter
55-
suffix="${{ steps.init.outputs.image_suffix }}"
56-
clean_suffix="${suffix#-}"
57-
echo "image_suffix_clean=$clean_suffix" >> $GITHUB_OUTPUT
58-
echo "is_production=${{ steps.init.outputs.is_production }}" >> $GITHUB_OUTPUT
59-
echo "environment_name=${{ steps.init.outputs.environment_name }}" >> $GITHUB_OUTPUT
60-
echo "environment_exists=${{ steps.init.outputs.environment_exists }}" >> $GITHUB_OUTPUT
61-
fi
44+
echo "image_suffix=${{ steps.init.outputs.image_suffix }}" >> $GITHUB_OUTPUT
45+
# Remove leading hyphen from image_suffix for image_suffix parameter
46+
suffix="${{ steps.init.outputs.image_suffix }}"
47+
clean_suffix="${suffix#-}"
48+
echo "image_suffix_clean=$clean_suffix" >> $GITHUB_OUTPUT
49+
echo "is_production=${{ steps.init.outputs.is_production }}" >> $GITHUB_OUTPUT
50+
echo "environment_name=${{ steps.init.outputs.environment_name }}" >> $GITHUB_OUTPUT
51+
echo "environment_exists=${{ steps.init.outputs.environment_exists }}" >> $GITHUB_OUTPUT
52+
6253
6354
- name: Build and push cli image
6455
uses: docker/build-push-action@v5
@@ -119,21 +110,6 @@ jobs:
119110
from_environment: production
120111
image_suffix: ${{ steps.override-outputs.outputs.image_suffix_clean }}
121112

122-
- name: Sync database from production to new environment
123-
if: ${{ !startsWith(github.ref, 'refs/tags/') && steps.override-outputs.outputs.environment_exists == 'false' && steps.override-outputs.outputs.environment_name
124-
!= 'production' }}
125-
uses: quantcdn/[email protected]
126-
with:
127-
api_key: ${{ secrets.QUANT_API_KEY }}
128-
organization: ${{ secrets.QUANT_ORGANIZATION }}
129-
app_name: ${{ steps.init.outputs.quant_application }}
130-
environment_name: ${{ steps.override-outputs.outputs.environment_name }}
131-
source: production
132-
type: database
133-
wait: true
134-
wait_interval: 10
135-
max_retries: 30
136-
137113
- name: Redeploy existing environment
138114
if: ${{ !startsWith(github.ref, 'refs/tags/') && steps.override-outputs.outputs.environment_exists == 'true' }}
139115
uses: quantcdn/quant-cloud-environment-state-action@v1

0 commit comments

Comments
 (0)