-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy path.lagoon.yml
More file actions
155 lines (142 loc) Β· 5.65 KB
/
Copy path.lagoon.yml
File metadata and controls
155 lines (142 loc) Β· 5.65 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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: Send pre-deployment notifications
command: |
export VORTEX_NOTIFY_PROJECT=$LAGOON_PROJECT
export VORTEX_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE
export VORTEX_NOTIFY_BRANCH="${LAGOON_PR_HEAD_BRANCH:-$LAGOON_GIT_BRANCH}"
export VORTEX_NOTIFY_SHA="${LAGOON_GIT_SHA}"
export VORTEX_NOTIFY_PR_NUMBER="${LAGOON_PR_NUMBER:-}"
export VORTEX_NOTIFY_LABEL="$LAGOON_GIT_BRANCH"
[ -n "$LAGOON_PR_NUMBER" ] && export VORTEX_NOTIFY_LABEL="PR-${LAGOON_PR_NUMBER}"
export VORTEX_NOTIFY_EVENT=pre_deployment
./vendor/bin/vortex-notify
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 ./vendor/bin/vortex-export-db
fi
service: cli
shell: bash
#;< !PROVISION_TYPE_PROFILE
- run:
name: Fetch 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_FETCH_DB_SSH_FILE=false
export VORTEX_DB_DIR=/tmp/data
rm -Rf $VORTEX_DB_DIR || true
./vendor/bin/vortex-fetch-db
fi
service: cli
shell: bash
#;> !PROVISION_TYPE_PROFILE
#;< MIGRATION
- run:
name: Fetch migration database
command: |
export VORTEX_FETCH_DB_SSH_FILE=false
export VORTEX_DB_DIR=/tmp/data
VORTEX_DB_INDEX=2 ./vendor/bin/vortex-fetch-db
service: cli
shell: bash
#;> MIGRATION
- run:
name: Provision site
command: |
#;< PROVISION_TYPE_PROFILE
if [ "${VORTEX_PROVISION_TYPE}" = "profile" ]; then
# Lagoon does not pass .env values through to task containers, so the
# flag has to be read out of the file directly.
export VORTEX_PROVISION_OVERRIDE_DB="$(cat .env | grep ^VORTEX_PROVISION_OVERRIDE_DB | cut -c31-)"
fi
#;> PROVISION_TYPE_PROFILE
if [ "$LAGOON_ENVIRONMENT_TYPE" = "production" ] || [ "$LAGOON_GIT_BRANCH" = "${VORTEX_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
echo "==> Running in PRODUCTION environment."
#;< !PROVISION_TYPE_PROFILE
# Never overwrite existing DB when production site already exists.
export VORTEX_PROVISION_OVERRIDE_DB=0
#;> !PROVISION_TYPE_PROFILE
# Never unblock admin user in production.
export VORTEX_UNBLOCK_ADMIN=0
# Never sanitize DB in production.
export VORTEX_PROVISION_SANITIZE_DB_SKIP=1
fi
export VORTEX_DB_DIR=/tmp/data
./vendor/bin/vortex-provision
service: cli
shell: bash
#;< !NOTIFICATIONS
- run:
name: Send post-deployment notifications
command: |
export VORTEX_NOTIFY_PROJECT=$LAGOON_PROJECT
export VORTEX_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE
export VORTEX_NOTIFY_BRANCH="${LAGOON_PR_HEAD_BRANCH:-$LAGOON_GIT_BRANCH}"
export VORTEX_NOTIFY_SHA="${LAGOON_GIT_SHA}"
export VORTEX_NOTIFY_PR_NUMBER="${LAGOON_PR_NUMBER:-}"
export VORTEX_NOTIFY_LABEL="$LAGOON_GIT_BRANCH"
[ -n "$LAGOON_PR_NUMBER" ] && export VORTEX_NOTIFY_LABEL="PR-${LAGOON_PR_NUMBER}"
export VORTEX_NOTIFY_EVENT=post_deployment
./vendor/bin/vortex-notify
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-domain.example:
# tls-acme: 'false'
monitoring_urls:
- www.your-site-domain.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-domain.example:
# tls-acme: 'false'
monitoring_urls:
- dev.your-site-domain.example
routes:
insecure: Redirect