Skip to content

Commit

Permalink
Includes commands in Makefile to create and remove databases needed w…
Browse files Browse the repository at this point in the history
…hen using the worldmap contrib application
  • Loading branch information
capooti committed Jul 31, 2018
1 parent 6bbb83a commit 81f4423
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,32 @@ reset: down up wait sync
hardreset: pull build reset

develop: pull build up sync

setup_worldmap:
# setup databases for using the worldmap application
export PG_USERNAME=$(PG_USERNAME); \
export PG_PASSWORD=$(PG_PASSWORD); \
export PG_WORLDMAP_DJANGO_DB=$(PG_WORLDMAP_DJANGO_DB); \
export PG_WORLDMAP_UPLOADS_DB=$(PG_WORLDMAP_UPLOADS_DB); \
export OWNER=$(OWNER); \
sudo -u postgres psql -c "CREATE USER $(PG_USERNAME) WITH SUPERUSER PASSWORD '$(PG_PASSWORD)';" ;
sudo -u postgres psql -c "CREATE DATABASE $(PG_WORLDMAP_DJANGO_DB) WITH OWNER $(OWNER);"
sudo -u postgres psql -d $(PG_WORLDMAP_DJANGO_DB) -c "CREATE EXTENSION postgis;"
sudo -u postgres psql -d $(PG_WORLDMAP_DJANGO_DB) -c "CREATE EXTENSION dblink;"
sudo -u postgres psql -c "CREATE DATABASE $(PG_WORLDMAP_UPLOADS_DB) WITH OWNER $(OWNER);"
sudo -u postgres psql -d $(PG_WORLDMAP_UPLOADS_DB) -c "CREATE EXTENSION postgis;"
python manage.py migrate --noinput
python manage.py loaddata sample_admin
python manage.py loaddata geonode/base/fixtures/default_oauth_apps_docker.json
python manage.py loaddata geonode/base/fixtures/initial_data.json

remove_worldmap:
# remove databases for using the worldmap application
sudo -u postgres psql -c "DROP DATABASE $(PG_WORLDMAP_DJANGO_DB);"
sudo -u postgres psql -c "DROP DATABASE $(PG_WORLDMAP_UPLOADS_DB);"
sudo -u postgres psql -c "DROP ROLE $(PG_USERNAME);"
unset PG_USERNAME; \
unset PG_PASSWORD; \
unset PG_WORLDMAP_DJANGO_DB; \
unset PG_WORLDMAP_UPLOADS_DB; \
unset OWNER; \

0 comments on commit 81f4423

Please sign in to comment.