diff --git a/Makefile b/Makefile index 35c2f2f03..8e70ac2cc 100644 --- a/Makefile +++ b/Makefile @@ -114,6 +114,8 @@ install: conda # pip install git+https://github.com/mskcc/beagle_cli.git@develop # pip install -r requirements-cli.txt # <- what happened to this file? +BEAGLE_BACKUP_DB_FOLDER=/juno/work/ci/beagle_backups/ + export ENVIRONMENT=dev # ~~~~~ Set Up Demo Postgres Database for Dev ~~~~~ # export BEAGLE_DB_NAME=db @@ -172,13 +174,18 @@ db-backup: $(DB_BACKUP_DIR) db-restore: @echo ">>> restoring db from DBFILE: $(DBFILE)" if [ -n "$(DBFILE)" ]; then \ - psql "$(PGDATABASE)" < "$(DBFILE)" ; fi + pg_restore -h $(PGHOST) -p $(PGPORT) --no-privileges --no-owner --clean -d $(PGDATABASE) < "$(DBFILE)" ; fi # interactive Postgres console # use command `\dt` to show all tables db-inter: psql -p "$(PGPORT)" -U "$(PGUSER)" -W "$(PGDATABASE)" +db-sync-prod: + LATEST_DUMP=`ssh voyager ls -Art $(BEAGLE_BACKUP_DB_FOLDER) | tail -n 1` && \ + rsync --progress voyager:$(BEAGLE_BACKUP_DB_FOLDER)$$LATEST_DUMP . && \ + pg_restore -d $(PGDATABASE) < $$LATEST_DUMP + # ~~~~~~ Celery tasks & RabbitMQ setup ~~~~~ # # !! need to start RabbitMQ before celery, and both before running Django app servers !!