-
Notifications
You must be signed in to change notification settings - Fork 16
/
.lagoon.yml
94 lines (86 loc) · 3.69 KB
/
.lagoon.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
docker-compose-yaml: docker-compose.yml
# Inject the deployed Git SHA.
environment_variables:
git_sha: 'true'
# Uncomment to login into container registries if using private images.
# container-registries:
# dockerhub:
# # Environment variables DOCKER_USER and DOCKER_PASS needs to be set via Lagoon CLI.
# username: DOCKER_USER
# password: DOCKER_PASS
tasks:
post-rollout:
- run:
name: Show DrevOps variables.
command: env -0 | sort -z | tr '\0' '\n' | grep ^DREVOPS_ || true
service: cli
shell: bash
- run:
name: Notify about pre-deployment.
command: |
if [ -n "$LAGOON_PR_NUMBER" ]; then export DREVOPS_NOTIFY_REF=$LAGOON_PR_NUMBER;export DREVOPS_NOTIFY_SHA=${LAGOON_PR_HEAD_SHA#origin/};export DREVOPS_NOTIFY_BRANCH=$LAGOON_PR_HEAD_BRANCH;else export DREVOPS_NOTIFY_REF=$LAGOON_GIT_BRANCH;export DREVOPS_NOTIFY_SHA=$LAGOON_GIT_SHA;export DREVOPS_NOTIFY_BRANCH=$LAGOON_GIT_BRANCH;fi
DREVOPS_NOTIFY_PROJECT=$LAGOON_PROJECT \
DREVOPS_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \
DREVOPS_NOTIFY_EVENT=pre_deployment ./scripts/drevops/notify.sh || true
service: cli
shell: bash
- run:
name: Provision site
command: |
if [ "$LAGOON_ENVIRONMENT_TYPE" = "production" ] || [ "$LAGOON_GIT_BRANCH" = "${DREVOPS_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
echo "==> Running in PRODUCTION environment."
# Never unblock admin user in production.
export DRUPAL_UNBLOCK_ADMIN=0
# Never sanitize DB in production.
export DREVOPS_PROVISION_SANITIZE_DB_SKIP=1
fi
# Deployments from UI are not able to bypass the value of
# DREVOPS_PROVISION_OVERRIDE_DB set by the deploy-lagoon.sh
# during previous deployments (it sets value to '0' to mitigate Lagoon bug
# where environment variables cannot be deleted and have to be set to a value).
# @see https://github.com/uselagoon/lagoon/issues/1922
# Explicitly set DB overwrite flag to the value from .env file for
# deployments from the profile.
if [ "${DREVOPS_PROVISION_USE_PROFILE}" = "1" ]; then
export DREVOPS_PROVISION_OVERRIDE_DB="$(cat .env | grep ^DREVOPS_PROVISION_OVERRIDE_DB | cut -c31-)"
fi
./scripts/drevops/provision.sh
service: cli
shell: bash
- run:
name: Send deployment notifications
command: |
if [ -n "$LAGOON_PR_NUMBER" ]; then export DREVOPS_NOTIFY_REF=$LAGOON_PR_NUMBER; export DREVOPS_NOTIFY_SHA=${LAGOON_PR_HEAD_SHA#origin/}; export DREVOPS_NOTIFY_BRANCH=$LAGOON_PR_HEAD_BRANCH; else export DREVOPS_NOTIFY_REF=$LAGOON_GIT_BRANCH; export DREVOPS_NOTIFY_SHA=$LAGOON_GIT_SHA; export DREVOPS_NOTIFY_BRANCH=$LAGOON_GIT_BRANCH; fi
DREVOPS_NOTIFY_EVENT=post_deployment \
DREVOPS_NOTIFY_PROJECT=$LAGOON_PROJECT \
DREVOPS_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \
./scripts/drevops/notify.sh
service: cli
shell: bash
environments:
# Branch name that represents production environment.
main:
cronjobs:
- name: drush cron
schedule: '*/15 * * * *'
command: drush cron --root=/app
service: cli
routes:
- nginx-php:
- default.civictheme.io
monitoring_urls:
- default.civictheme.io
# Branch name that represents development environment.
develop:
cronjobs:
- name: drush cron
schedule: '*/15 * * * *'
command: drush cron --root=/app
service: cli
routes:
- nginx-php:
- defaultdev.civictheme.io
monitoring_urls:
- defaultdev.civictheme.io
routes:
insecure: Redirect