From ee49bc97b2604dba8f85bcdb916ff39f438c0e79 Mon Sep 17 00:00:00 2001 From: Jonathan Math Date: Sun, 14 Mar 2021 16:17:14 -0500 Subject: [PATCH] add proper healthcheck/wait for postgres in docker-compose and fix docker/local_settings.py --- docker-compose.yml | 14 ++++++++------ docker/local_settings.py | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 82c972d2e..b33ec1dd1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,10 +13,14 @@ services: tty: true restart: always depends_on: - - db_mongo - - db_postgres - - db_redis - - db_elasticsearch + db_mongo: + condition: service_started + db_postgres: + condition: service_healthy + db_redis: + condition: service_started + db_elasticsearch: + condition: service_started ulimits: nproc: 10000 nofile: @@ -177,8 +181,6 @@ services: - 80:80 - 443:443 - 1936:1936 - environment: - - DOCKERBUILD=True volumes: - ./docker/haproxy/haproxy.docker-compose.cfg:/usr/local/etc/haproxy/haproxy.cfg - app-files:/srv/newsblur diff --git a/docker/local_settings.py b/docker/local_settings.py index 88d5b0567..42a26428f 100644 --- a/docker/local_settings.py +++ b/docker/local_settings.py @@ -29,7 +29,7 @@ ENFORCE_SIGNUP_CAPTCHA = False CACHES = { 'default': { 'BACKEND': 'redis_cache.RedisCache', - 'LOCATION': 'redis:6379', + 'LOCATION': 'db_redis:6379', 'OPTIONS': { 'DB': 6, 'PARSER_CLASS': 'redis.connection.HiredisParser' @@ -75,19 +75,19 @@ DATABASES = { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'USER': 'newsblur', 'PASSWORD': 'newsblur', - 'HOST': 'postgres', + 'HOST': 'db_postgres', }, } MONGO_DB = { 'name': 'newsblur', - 'host': 'mongo', + 'host': 'db_mongo', 'port': 27017 } MONGO_ANALYTICS_DB = { 'name': 'analytics', - 'host': 'mongo', + 'host': 'db_mongo', 'port': 27017 } @@ -96,27 +96,27 @@ MONGODB_SLAVE = { } # Celery RabbitMQ/Redis Broker -BROKER_URL = "redis://redis:6379/0" +BROKER_URL = "redis://db_redis:6379/0" CELERY_RESULT_BACKEND = BROKER_URL REDIS = { - 'host': 'redis', + 'host': 'db_redis', } REDIS_PUBSUB = { - 'host': 'redis', + 'host': 'db_redis', } REDIS_PUBSUB_POOL = { - 'host': 'redis', + 'host': 'db_redis', } REDIS_STORY = { - 'host': 'redis', + 'host': 'db_redis', } REDIS_SESSIONS = { - 'host': 'redis', + 'host': 'db_redis', } -ELASTICSEARCH_FEED_HOSTS = ["elasticsearch:9200"] -ELASTICSEARCH_STORY_HOSTS = ["elasticsearch:9200"] +ELASTICSEARCH_FEED_HOSTS = ["db_elasticsearch:9200"] +ELASTICSEARCH_STORY_HOSTS = ["db_elasticsearch:9200"] BACKED_BY_AWS = { 'pages_on_node': False,