Skip to content

Commit

Permalink
Local dev minio and PostgreSQL changes (#4693)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
maskarb authored Sep 21, 2023
1 parent 84d93d5 commit 7a9c2e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a9c2e8

Please sign in to comment.