From e9b161e0110b1b9b5c40372a33ed6dde1f0f9ae2 Mon Sep 17 00:00:00 2001 From: Hannah Cushman Garland Date: Mon, 6 Jan 2025 16:11:01 -0600 Subject: [PATCH] Add Makefile for initializing Wagtail DB for review apps, update instructions --- Makefile | 2 ++ README.md | 5 ++--- wagtail.mk | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 wagtail.mk diff --git a/Makefile b/Makefile index a40876ee5..c88ddb07a 100644 --- a/Makefile +++ b/Makefile @@ -20,3 +20,5 @@ councilmatic_core_person.csv : SELECT name, slug \ FROM councilmatic_core_person \ ) TO STDOUT WITH CSV HEADER\"" > $@ + +include wagtail.mk diff --git a/README.md b/README.md index 3c5dec771..1fd772e88 100644 --- a/README.md +++ b/README.md @@ -157,9 +157,8 @@ This repo is set up to deploy review apps on Heroku, and those pull from the sta 1. Configure the S3 connection, as documented above. 2. Once a release phase successfully completes, provision an Essential 0 database for your review app. 3. Retrieve the URI from the Credentials tab. -4. Run `export HEROKU_DATABASE_URL=`. -5. If needed, run `docker compose run --rm -e DATABASE_URL=${HEROKU_DATABASE_URI} scrapers` to populate initial legislative data. -6. Run `docker compose run --rm -e DATABASE_URL=${HEROKU_DATABASE_URI} app python manage.py load_content` to populate initial CMS content from the version controlled fixtures. +4. Update the app's `DATABASE_URL` config value to the new URI. +5. On your local machine, run `DATABASE_URL= make -e wagtail_db`. This will populate initial legislative data and import content from the version controlled fixture data. ## Adding a new board member diff --git a/wagtail.mk b/wagtail.mk new file mode 100644 index 000000000..b827852a3 --- /dev/null +++ b/wagtail.mk @@ -0,0 +1,14 @@ +DATABASE_URL= + +wagtail_db : legislative_data cms_data + +cms_data : db + docker compose run --rm -e DATABASE_URL=${DATABASE_URL} app python manage.py load_content + +legislative_data : db + docker compose run --rm -e DATABASE_URL=${DATABASE_URL} scrapers + +db : + if [ -z "${DATABASE_URL}" ]; then \ + echo "Please set a value for DATABASE_URL env var" && exit 1; \ + fi