From 9c0d01ae6c491d643531e4d60ad43938eb6339d0 Mon Sep 17 00:00:00 2001 From: Michael Chouinard Date: Fri, 6 Sep 2024 16:33:45 -0400 Subject: [PATCH] [Issue #191] Cleanup makefile commands around OpenSearch --- api/Makefile | 19 ++++++++++--------- .../api/database/database-management.md | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/api/Makefile b/api/Makefile index dcdbf23c9..717de89b9 100644 --- a/api/Makefile +++ b/api/Makefile @@ -91,20 +91,22 @@ setup-local: build: docker compose build -start: +start: ## Start the API docker compose up --detach start-debug: docker compose -f docker-compose.yml -f docker-compose.debug.yml up --detach -run-logs: start +run-logs: start ## Start the API and follow the logs docker compose logs --follow --no-color $(APP_NAME) init: build init-db init-opensearch init-localstack -clean-volumes: ## Remove project docker volumes (which includes the DB state) +clean-volumes: ## Remove project docker volumes - which includes the DB, and OpenSearch state docker compose down --volumes +volume-recreate: clean-volumes init ## Destroy current volumes, setup new ones - will remove all existing data + stop: docker compose down @@ -126,9 +128,6 @@ start-db: docker compose up --detach grants-db ./bin/wait-for-local-db.sh -## Destroy current DB, setup new one -db-recreate: clean-volumes init-db - ######################### # DB Migrations ######################### @@ -166,7 +165,7 @@ db-migrate-history: ## Show migration history db-migrate-heads: ## Show migrations marked as a head $(alembic_cmd) heads $(args) -db-seed-local: +db-seed-local: ## Generate records into your local database $(PY_RUN_CMD) db-seed-local $(args) db-check-migrations: ## Verify the DB schema matches the DB migrations generated @@ -183,8 +182,7 @@ setup-postgres-db: ## Does any initial setup necessary for our local database to # Opensearch ################################################## -init-opensearch: start-opensearch -# TODO - in subsequent PRs, we'll add more to this command to setup the search index locally +init-opensearch: start-opensearch ## Start the opensearch service locally start-opensearch: docker compose up --detach opensearch-node @@ -275,6 +273,9 @@ setup-foreign-tables: seed-local-legacy-tables: $(PY_RUN_CMD) python3 -m tests.lib.seed_local_legacy_tables +populate-search-opportunities: ## Load opportunities from the DB into the search index, run "make db-seed-local" first to populate your database + $(FLASK_CMD) load-search-data load-opportunity-data $(args) + ################################################## # Miscellaneous Utilities ################################################## diff --git a/documentation/api/database/database-management.md b/documentation/api/database/database-management.md index 4431c20ac..ef439b37e 100644 --- a/documentation/api/database/database-management.md +++ b/documentation/api/database/database-management.md @@ -30,7 +30,7 @@ This command is not needed when starting the application with `make start` To clean the database, use the following command: ```sh -make db-recreate +make volume-recreate ``` This will remove _all_ docker project volumes, rebuild the database volume, and