From 7a9c2e8ee4b874b35e5ce3482447b899eb179808 Mon Sep 17 00:00:00 2001 From: Michael Skarbek Date: Thu, 21 Sep 2023 10:33:37 -0400 Subject: [PATCH] Local dev minio and PostgreSQL changes (#4693) - Only delete minio bucket contents, not all minio settings - Bind mount the PostgreSQL data directory since it is a volume inside the container image More details in the PGDATA section of https://hub.docker.com/_/postgres - Delete contents of pg_data/data/* when deleting the database, leaving the directory intact --- Makefile | 8 ++++---- docker-compose.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index b69d645259..3932f26ab7 100644 --- a/Makefile +++ b/Makefile @@ -173,7 +173,7 @@ delete-trino: @$(PREFIX) rm -rf $(TOPDIR)/.trino/trino/* delete-trino-data: - @$(PREFIX) rm -rf $(TOPDIR)/.trino/parquet_data/{*,.minio*} + @$(PREFIX) rm -rf $(TOPDIR)/.trino/parquet_data/koku-bucket/* delete-redis-cache: $(DOCKER) exec -it koku_redis redis-cli -n 1 flushall @@ -214,7 +214,7 @@ make-migrations: $(DJANGO_MANAGE) makemigrations api reporting reporting_common cost_models delete-db: - $(PREFIX) rm -rf $(TOPDIR)/pg_data/* + $(PREFIX) rm -rf $(TOPDIR)/pg_data/data/* delete-test-db: @PGPASSWORD=$$DATABASE_PASSWORD psql -h $$POSTGRES_SQL_SERVICE_HOST \ @@ -401,12 +401,12 @@ docker-iqe-api-tests: docker-reinitdb _set-test-dir-permissions delete-testing docker-iqe-vortex-tests: docker-reinitdb _set-test-dir-permissions delete-testing ./testing/run_vortex_api_tests.sh -CONTAINER_DIRS = $(TOPDIR)/pg_data $(TOPDIR)/.trino/{parquet_data,trino} +CONTAINER_DIRS = $(TOPDIR)/pg_data/data $(TOPDIR)/.trino/{parquet_data,trino} docker-host-dir-setup: $(DOCKER_COMPOSE) build --no-cache koku-minio mkdir -p -m 0755 $(CONTAINER_DIRS) 2>&1 > /dev/null chown -R $(USER_ID) $(CONTAINER_DIRS) - chmod 0755 $(CONTAINER_DIRS) + chmod -R 0755 $(CONTAINER_DIRS) docker-trino-setup: delete-trino docker-host-dir-setup diff --git a/docker-compose.yml b/docker-compose.yml index 430062cf96..1546ce7a3f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -452,7 +452,7 @@ services: ports: - 15432:5432 volumes: - - ./pg_data:/var/lib/${DATABASE_DATA_DIR-postgresql} + - ./pg_data/data:/var/lib/${DATABASE_DATA_DIR-postgresql}/data - ./pg_init:/docker-entrypoint-initdb.d command: # This command give more precise control over the parameter settings