-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.lagoon.yml
118 lines (106 loc) · 4.6 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
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
- 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
- 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
- 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
- run:
name: Provision site
command: |
if [ "$LAGOON_ENVIRONMENT_TYPE" = "production" ] || [ "$LAGOON_GIT_BRANCH" = "${VORTEX_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
echo "==> Running in PRODUCTION environment."
# Never overwrite existing DB when production site already exists.
export VORTEX_PROVISION_OVERRIDE_DB=0
# 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
- 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
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:
# - drevops.com:
# tls-acme: 'false'
#monitoring_urls:
# - drevops.com
# 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.drevops.com:
# tls-acme: 'false'
#monitoring_urls:
# - dev.drevops.com
routes:
insecure: Redirect