-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathdrupal.yml
88 lines (87 loc) · 3.54 KB
/
drupal.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
version: '3'
tasks:
composer:development:
desc: Install composer dependencies
summary: |
This command is typically used when a developer updates their local after
pulling new changes from source control. Generally when bootstrapping a
fresh clone of the site from git, you'll need to run `composer install`
anyway to get task and drainpipe.
cmds:
- composer install --optimize-autoloader
sources:
- composer.json
- composer.lock
generates:
- ./vendor/composer/installed.json
- ./vendor/autoload.php
status:
- >
test -f ./vendor/composer/installed.json && grep -q '"dev": true' ./vendor/composer/installed.json
composer:production:
desc: Install composer dependencies without devDependencies
cmds:
- composer install --no-dev --optimize-autoloader
sources:
- composer.json
- composer.lock
generates:
- ./vendor/composer/installed.json
- ./vendor/autoload.php
status:
- >
test -f ./vendor/composer/installed.json && grep -q '"dev": false' ./vendor/composer/installed.json
install:
desc: "Runs the site installer"
cmds:
- ./vendor/bin/drush --yes site:install --existing-config {{.CLI_ARGS}}
import-db:
desc: "Imports a database fetched with a *:fetch-db command"
env:
DB_DIR: '{{default "/var/www/html/files/db" .DB_DIR}}'
cmds:
- echo "🚮 Dropping existing database"
- ./vendor/bin/drush {{ .site }} sql:drop --yes
- echo "📰 Importing database"
- gunzip --keep --force $DB_DIR/db.sql.gz
- ./vendor/bin/drush {{ .site }} sql:query --file=$DB_DIR/db.sql
- defer: rm -f $DB_DIR/db.sql
export-db:
desc: "Exports a database fetched with a *:fetch-db command"
env:
DB_DIR: '{{default "/var/www/html/files/db" .DB_DIR}}'
cmds:
- echo "➡ Exporting database"
- ./vendor/bin/drush {{.site }} sql:dump --gzip --result-file=$DB_DIR/db.sql
update:
desc: Run Drupal update tasks after deploying new code
cmds:
# See https://www.drush.org/12.x/deploycommand/
- ./vendor/bin/drush {{.site}} --yes updatedb --no-cache-clear
- ./vendor/bin/drush {{.site}} --yes cache:rebuild
# Run config:import twice to make sure we catch any config that didn't declare
# a dependency correctly. This is also useful when importing large config sets
# as it can sometimes hit an out of memory error.
- ./vendor/bin/drush {{.site}} --yes config:import || true
- ./vendor/bin/drush {{.site}} --yes config:import
- ./vendor/bin/drush {{.site}} --yes cache:rebuild
- ./vendor/bin/drush {{.site}} --yes deploy:hook
- |
# drush config:status --format=json is outputting notices in Pantheon even with the json format,
# so we need to tail the last line.
config_status_output=$(./vendor/bin/drush {{.site}} config:status --format=json --state=Different | tail -n1)
if [[ $config_status_output != '[]' ]]; then
echo "Config export does not match database."
./vendor/bin/drush {{.site}} config:status
exit 1;
fi
# Run cron after updating to refresh items.
- ./vendor/bin/drush {{ .site }} core:cron --verbose
maintenance:on:
desc: Turn on Maintenance Mode
cmds:
- ./vendor/bin/drush {{.site}} --yes state:set system.maintenance_mode 1 --input-format=integer
maintenance:off:
desc: Turn off Maintenance Mode
cmds:
- ./vendor/bin/drush {{.site}} --yes state:set system.maintenance_mode 0 --input-format=integer