Add pull-from-prod to Makefile

Add `pull-from-prod` to the Makefile, which downloads a database from
production, imports it and runs the post-import steps.

Fixes #79
This commit is contained in:
Oliver Davies 2020-06-01 12:38:58 +01:00
parent 4a2aa00ce2
commit 208d535d95
2 changed files with 17 additions and 6 deletions

View file

@ -1,3 +1,5 @@
SHELL=/bin/bash -e -o pipefail
.PHONY: *
phpcs:
@ -20,6 +22,18 @@ phpstan:
phpunit:
vendor/bin/phpunit web/modules/custom
pull-from-prod:
# Download and import the database.
ansible-playbook tools/ansible/download-database.yml
zcat < dump.sql.gz | bin/drush.sh sql-cli
rm dump.sql.gz
# Post import steps.
bin/drush.sh sql-sanitize -y --sanitize-password=password
bin/drush.sh updatedb -y
bin/drush.sh cache-rebuild
bin/drush.sh user-login 1
start:
docker-compose up -d
symfony server:start -d

View file

@ -6,13 +6,10 @@
vars_files:
- vars/vars.yml
tasks:
- name: Generate the name for the export
set_fact:
export_filename: "~/{{ lookup('pipe', 'date -u +%Y%m%d%H%M%SZ') }}.sql"
run_once: true
when: export_filename is not defined
vars:
export_filename: /tmp/dump.sql
tasks:
- name: Export the database
command:
cmd: >