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:
parent
4a2aa00ce2
commit
208d535d95
14
Makefile
14
Makefile
|
@ -1,3 +1,5 @@
|
||||||
|
SHELL=/bin/bash -e -o pipefail
|
||||||
|
|
||||||
.PHONY: *
|
.PHONY: *
|
||||||
|
|
||||||
phpcs:
|
phpcs:
|
||||||
|
@ -20,6 +22,18 @@ phpstan:
|
||||||
phpunit:
|
phpunit:
|
||||||
vendor/bin/phpunit web/modules/custom
|
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:
|
start:
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
symfony server:start -d
|
symfony server:start -d
|
||||||
|
|
|
@ -6,13 +6,10 @@
|
||||||
vars_files:
|
vars_files:
|
||||||
- vars/vars.yml
|
- vars/vars.yml
|
||||||
|
|
||||||
tasks:
|
vars:
|
||||||
- name: Generate the name for the export
|
export_filename: /tmp/dump.sql
|
||||||
set_fact:
|
|
||||||
export_filename: "~/{{ lookup('pipe', 'date -u +%Y%m%d%H%M%SZ') }}.sql"
|
|
||||||
run_once: true
|
|
||||||
when: export_filename is not defined
|
|
||||||
|
|
||||||
|
tasks:
|
||||||
- name: Export the database
|
- name: Export the database
|
||||||
command:
|
command:
|
||||||
cmd: >
|
cmd: >
|
||||||
|
|
Loading…
Reference in a new issue