-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
.lagoon.yml
133 lines (121 loc) Β· 5.29 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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:
# # The `username` field must be set as a scalar value.
# # Environment variable VORTEX_CONTAINER_REGISTRY_PASS needs to be set via Lagoon CLI.
# username: your_registry_username
# password: VORTEX_CONTAINER_REGISTRY_PASS
tasks:
post-rollout:
- run:
name: Show Vortex variables.
command: |
[ "${VORTEX_DEBUG-}" = "1" ] && env -0 | sort -z | tr '\0' '\n' | grep ^VORTEX_ || true
service: cli
shell: bash
#;< !NOTIFICATIONS
- run:
name: Notify about pre-deployment.
command: |
if [ -n "$LAGOON_PR_NUMBER" ]; then export VORTEX_NOTIFY_REF=$LAGOON_PR_NUMBER;export VORTEX_NOTIFY_SHA=${LAGOON_PR_HEAD_SHA#origin/};export VORTEX_NOTIFY_BRANCH=$LAGOON_PR_HEAD_BRANCH;else export VORTEX_NOTIFY_REF=$LAGOON_GIT_BRANCH;export VORTEX_NOTIFY_SHA=$LAGOON_GIT_SHA;export VORTEX_NOTIFY_BRANCH=$LAGOON_GIT_BRANCH;fi
VORTEX_NOTIFY_PROJECT=$LAGOON_PROJECT \
VORTEX_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \
VORTEX_NOTIFY_EVENT=pre_deployment ./scripts/vortex/notify.sh || true
service: cli
shell: bash
#;> !NOTIFICATIONS
- run:
name: Backup DB before deployment in production
command: |
if [ "$LAGOON_ENVIRONMENT_TYPE" = "production" ] || [ "$LAGOON_GIT_BRANCH" = "${VORTEX_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
echo "==> Running in PRODUCTION environment."
VORTEX_DB_DIR=/app/web/sites/default/files/private/pre_deployment_backups ./scripts/vortex/export-db-file.sh
fi
service: cli
#;< !PROVISION_USE_PROFILE
- run:
name: Download database in non-production environments
command: |
if [ "$LAGOON_ENVIRONMENT_TYPE" != "production" ] && [ "$LAGOON_GIT_BRANCH" != "${VORTEX_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
# No need to load SSH file to access production DB as Lagoon has SSH agent keys.
export VORTEX_DB_DOWNLOAD_SSH_FILE=false
export VORTEX_DB_DIR=/tmp/data
rm -Rf $VORTEX_DB_DIR || true
./scripts/vortex/download-db.sh
fi
service: cli
#;> !PROVISION_USE_PROFILE
- run:
name: Provision site
command: |
#;< PROVISION_USE_PROFILE
if [ "$VORTEX_PROVISION_USE_PROFILE" = "1" ]; then
# Explicitly set DB overwrite flag to the value from .env file for deployments from the profile.
# @see https://github.com/uselagoon/lagoon/issues/1922
export VORTEX_PROVISION_OVERRIDE_DB="$(cat .env | grep ^VORTEX_PROVISION_OVERRIDE_DB | cut -c31-)"
fi
#;> PROVISION_USE_PROFILE
if [ "$LAGOON_ENVIRONMENT_TYPE" = "production" ] || [ "$LAGOON_GIT_BRANCH" = "${VORTEX_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
echo "==> Running in PRODUCTION environment."
#;< !PROVISION_USE_PROFILE
# Never overwrite existing DB when production site already exists.
export VORTEX_PROVISION_OVERRIDE_DB=0
#;> !PROVISION_USE_PROFILE
# Never unblock admin user in production.
export DRUPAL_UNBLOCK_ADMIN=0
# Never sanitize DB in production.
export VORTEX_PROVISION_SANITIZE_DB_SKIP=1
fi
export VORTEX_DB_DIR=/tmp/data
./scripts/vortex/provision.sh
service: cli
shell: bash
#;< !NOTIFICATIONS
- run:
name: Send deployment notifications
command: |
if [ -n "$LAGOON_PR_NUMBER" ]; then export VORTEX_NOTIFY_REF=$LAGOON_PR_NUMBER; export VORTEX_NOTIFY_SHA=${LAGOON_PR_HEAD_SHA#origin/}; export VORTEX_NOTIFY_BRANCH=$LAGOON_PR_HEAD_BRANCH; else export VORTEX_NOTIFY_REF=$LAGOON_GIT_BRANCH; export VORTEX_NOTIFY_SHA=$LAGOON_GIT_SHA; export VORTEX_NOTIFY_BRANCH=$LAGOON_GIT_BRANCH; fi
VORTEX_NOTIFY_EVENT=post_deployment \
VORTEX_NOTIFY_PROJECT=$LAGOON_PROJECT \
VORTEX_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \
./scripts/vortex/notify.sh || true
service: cli
shell: bash
#;> !NOTIFICATIONS
environments:
# Branch name that represents production environment.
main:
cronjobs:
- name: drush cron
schedule: '*/15 * * * *'
command: drush cron --root=/app
service: cli
# Uncomment to enable installing a custom SSL certificate.
# By default, Lagoon installs Let's Encrypt certificates for all environments.
# routes:
# - nginx-php:
# - www.your-site-url.example:
# tls-acme: 'false'
monitoring_urls:
- www.your-site-url.example
# Branch name that represents development environment.
develop:
cronjobs:
- name: drush cron
schedule: '*/15 * * * *'
command: drush cron --root=/app
service: cli
# Uncomment to enable installing a custom SSL certificate.
# By default, Lagoon installs Let's Encrypt certificates for all environments.
# routes:
# - nginx-php:
# - dev.your-site-url.example:
# tls-acme: 'false'
monitoring_urls:
- dev.your-site-url.example
routes:
insecure: Redirect