Expanded Makefile

This commit is contained in:
Oleg Lavrovsky 2017-04-25 16:00:32 +02:00
parent 584a085117
commit df251d5b5c
4 changed files with 28 additions and 35 deletions

View file

@ -57,21 +57,38 @@ django-shell:
logs:
docker-compose logs -f --tail=500
django-backup:
docker-compose exec web ./manage.py dumpdata --natural-foreign --indent=4 -e contenttypes -e auth.Permission -e sessions -e wagtailcore.pagerevision -e wagtailcore.groupcollectionpermission > ~/publichealth.home.json
backup-archive:
gzip -1q ~/publichealth.home.json
backup: django-backup backup-archive
django-loaddata:
gunzip ~/publichealth.home.json.gz
docker-compose exec web ./manage.py loaddata ~/publichealth.home.json
restore: django-loaddata django-restart-detached
psql:
docker-compose exec postgres psql -U postgres -d postgres
pg-run-detached:
# start pg service
docker-compose up -d pg_database
# start pg service
docker-compose up -d postgres
pg-exec:
docker-compose exec pg_database bash
docker-compose exec postgres bash
pg-dump:
docker-compose exec pg_database bash -c 'pg_dump -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" -f ./dumps/latest.sql'
docker-compose exec postgres bash -c 'pg_dump -U postgres -d postgres -f ./dumps/latest.sql'
pg-restore:
docker-compose exec pg_database bash -c 'psql -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" -f ./dumps/latest.sql'
docker-compose exec postgres bash -c 'psql -U postgres -d postgres -f ./dumps/latest.sql'
pg-surefire-drop-restore-db:
# drop existing database, recreate it, and then restore its content from backup.
-docker-compose exec pg_database bash -c 'dropdb -h localhost -U "$$POSTGRES_USER" "$$POSTGRES_DB"'
docker-compose exec pg_database bash -c 'createdb -h localhost -U "$$POSTGRES_USER" "$$POSTGRES_DB"'
# drop existing database, recreate it, and then restore its content from backup.
-docker-compose exec postgres bash -c 'dropdb -h localhost -U postgres postgres'
docker-compose exec postgres bash -c 'createdb -h localhost -U postgres postgres'
make pg-restore

View file

@ -16,4 +16,6 @@
dest: "{{ release_dir }}/docker-compose.yml"
- name: Deploy Docker site
shell: docker-compose build
shell: make setup
args:
chdir: "{{ release_dir }}"

View file

@ -16,10 +16,3 @@
- frontend
- nodejs
- setup
- include: manage.yaml
tags:
- manage
- docker
- setup
- run

View file

@ -1,19 +0,0 @@
---
#- name: Build a current site
# shell: "docker-compose build web"
- name: Migrate the site data
shell: "docker-compose exec web ./manage.py migrate"
- name: Create administrative user
shell: "docker-compose exec web ./manage.py createsuperuser"
- name: Compress site frontend
shell: "docker-compose exec web ./manage.py compress"
- name: Collect static frontend files
shell: "docker-compose exec web ./manage.py collectstatic --noinput"
- name: Start Docker site
shell: "docker-compose up -d"