From e8124806b163bd0d0c00ae6f10d0bb1de2c3b13c Mon Sep 17 00:00:00 2001 From: bcj Date: Mon, 17 May 2021 00:03:11 -0500 Subject: [PATCH 1/6] Don't hardcode postres port in bookwyrm.settings Have bookwyrm.settings check for an alternative postgres port. --- .env.prod.example | 1 + bookwyrm/settings.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.env.prod.example b/.env.prod.example index ac9fe70f8..a82499a32 100644 --- a/.env.prod.example +++ b/.env.prod.example @@ -21,6 +21,7 @@ BOOKWYRM_DATABASE_BACKEND=postgres MEDIA_ROOT=images/ +POSTGRES_PORT=5432 POSTGRES_PASSWORD=securedbpassword123 POSTGRES_USER=fedireads POSTGRES_DB=fedireads diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 45d8cb9d6..d694e33fd 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -118,7 +118,7 @@ BOOKWYRM_DBS = { "USER": env("POSTGRES_USER", "fedireads"), "PASSWORD": env("POSTGRES_PASSWORD", "fedireads"), "HOST": env("POSTGRES_HOST", ""), - "PORT": 5432, + "PORT": env("POSTGRES_PORT", 5432), }, } From 892d338adc5fec6e7f1fdb982b90398a085524ff Mon Sep 17 00:00:00 2001 From: bcj Date: Mon, 17 May 2021 00:03:51 -0500 Subject: [PATCH 2/6] Read flower port from .env --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d961a3c06..be0d08149 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -93,7 +93,7 @@ services: restart: on-failure flower: build: . - command: flower --port=8888 --basic_auth=${FLOWER_USER}:${FLOWER_PASSWORD} + command: flower --port=${FLOWER_PORT} --basic_auth=${FLOWER_USER}:${FLOWER_PASSWORD} env_file: .env environment: - CELERY_BROKER_URL=${CELERY_BROKER} From 83078cd424f4203257ef06d910015ff3eafd6987 Mon Sep 17 00:00:00 2001 From: bcj Date: Mon, 17 May 2021 00:05:11 -0500 Subject: [PATCH 3/6] Combine duplicate redis_* volumes in compose file. I _think_ yaml handles duplicates by overwriting so the conf file was not being added --- docker-compose.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index be0d08149..fa251d1a8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -56,27 +56,25 @@ services: command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes volumes: - ./redis.conf:/etc/redis/redis.conf + - redis_activity_data:/data env_file: .env ports: - 6378:6378 networks: - main restart: on-failure - volumes: - - redis_activity_data:/data redis_broker: image: redis command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} --appendonly yes volumes: - ./redis.conf:/etc/redis/redis.conf + - redis_broker_data:/data env_file: .env ports: - 6379:6379 networks: - main restart: on-failure - volumes: - - redis_broker_data:/data celery_worker: env_file: .env build: . From bad39aef556f2f37452f24acc3de367ceefaf129 Mon Sep 17 00:00:00 2001 From: bcj Date: Mon, 17 May 2021 00:07:59 -0500 Subject: [PATCH 4/6] Remove the redis_activity ports listing It is misleading, it isn't binding to that port --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index fa251d1a8..28ca6d93a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -58,8 +58,6 @@ services: - ./redis.conf:/etc/redis/redis.conf - redis_activity_data:/data env_file: .env - ports: - - 6378:6378 networks: - main restart: on-failure From 238862a4cf24d44ffc931583214c72b9f7d6418d Mon Sep 17 00:00:00 2001 From: bcj Date: Tue, 18 May 2021 00:54:15 -0500 Subject: [PATCH 5/6] Have redis_* grab port information from .env --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 28ca6d93a..1990801d4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,7 +53,7 @@ services: - 8000:8000 redis_activity: image: redis - command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes + command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes --port ${REDIS_ACTIVITY_PORT} volumes: - ./redis.conf:/etc/redis/redis.conf - redis_activity_data:/data @@ -63,7 +63,7 @@ services: restart: on-failure redis_broker: image: redis - command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} --appendonly yes + command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} --appendonly yes --port ${REDIS_BROKER_PORT} volumes: - ./redis.conf:/etc/redis/redis.conf - redis_broker_data:/data From 9302aa6ce4c111f8fde10b45c05590d58039ae8f Mon Sep 17 00:00:00 2001 From: bcj Date: Tue, 18 May 2021 13:21:19 -0500 Subject: [PATCH 6/6] Add POSTGRES_PORT to .env.dev --- .env.dev.example | 1 + 1 file changed, 1 insertion(+) diff --git a/.env.dev.example b/.env.dev.example index 191d2de9d..4e21f1ca6 100644 --- a/.env.dev.example +++ b/.env.dev.example @@ -21,6 +21,7 @@ BOOKWYRM_DATABASE_BACKEND=postgres MEDIA_ROOT=images/ +POSTGRES_PORT=5432 POSTGRES_PASSWORD=securedbpassword123 POSTGRES_USER=fedireads POSTGRES_DB=fedireads