add proper healthcheck/wait for postgres in docker-compose and fix docker/local_settings.py

This commit is contained in:
Jonathan Math 2021-03-14 16:17:14 -05:00
parent 2e7647a715
commit ee49bc97b2
2 changed files with 20 additions and 18 deletions

View file

@ -13,10 +13,14 @@ services:
tty: true tty: true
restart: always restart: always
depends_on: depends_on:
- db_mongo db_mongo:
- db_postgres condition: service_started
- db_redis db_postgres:
- db_elasticsearch condition: service_healthy
db_redis:
condition: service_started
db_elasticsearch:
condition: service_started
ulimits: ulimits:
nproc: 10000 nproc: 10000
nofile: nofile:
@ -177,8 +181,6 @@ services:
- 80:80 - 80:80
- 443:443 - 443:443
- 1936:1936 - 1936:1936
environment:
- DOCKERBUILD=True
volumes: volumes:
- ./docker/haproxy/haproxy.docker-compose.cfg:/usr/local/etc/haproxy/haproxy.cfg - ./docker/haproxy/haproxy.docker-compose.cfg:/usr/local/etc/haproxy/haproxy.cfg
- app-files:/srv/newsblur - app-files:/srv/newsblur

View file

@ -29,7 +29,7 @@ ENFORCE_SIGNUP_CAPTCHA = False
CACHES = { CACHES = {
'default': { 'default': {
'BACKEND': 'redis_cache.RedisCache', 'BACKEND': 'redis_cache.RedisCache',
'LOCATION': 'redis:6379', 'LOCATION': 'db_redis:6379',
'OPTIONS': { 'OPTIONS': {
'DB': 6, 'DB': 6,
'PARSER_CLASS': 'redis.connection.HiredisParser' 'PARSER_CLASS': 'redis.connection.HiredisParser'
@ -75,19 +75,19 @@ DATABASES = {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'newsblur', 'USER': 'newsblur',
'PASSWORD': 'newsblur', 'PASSWORD': 'newsblur',
'HOST': 'postgres', 'HOST': 'db_postgres',
}, },
} }
MONGO_DB = { MONGO_DB = {
'name': 'newsblur', 'name': 'newsblur',
'host': 'mongo', 'host': 'db_mongo',
'port': 27017 'port': 27017
} }
MONGO_ANALYTICS_DB = { MONGO_ANALYTICS_DB = {
'name': 'analytics', 'name': 'analytics',
'host': 'mongo', 'host': 'db_mongo',
'port': 27017 'port': 27017
} }
@ -96,27 +96,27 @@ MONGODB_SLAVE = {
} }
# Celery RabbitMQ/Redis Broker # Celery RabbitMQ/Redis Broker
BROKER_URL = "redis://redis:6379/0" BROKER_URL = "redis://db_redis:6379/0"
CELERY_RESULT_BACKEND = BROKER_URL CELERY_RESULT_BACKEND = BROKER_URL
REDIS = { REDIS = {
'host': 'redis', 'host': 'db_redis',
} }
REDIS_PUBSUB = { REDIS_PUBSUB = {
'host': 'redis', 'host': 'db_redis',
} }
REDIS_PUBSUB_POOL = { REDIS_PUBSUB_POOL = {
'host': 'redis', 'host': 'db_redis',
} }
REDIS_STORY = { REDIS_STORY = {
'host': 'redis', 'host': 'db_redis',
} }
REDIS_SESSIONS = { REDIS_SESSIONS = {
'host': 'redis', 'host': 'db_redis',
} }
ELASTICSEARCH_FEED_HOSTS = ["elasticsearch:9200"] ELASTICSEARCH_FEED_HOSTS = ["db_elasticsearch:9200"]
ELASTICSEARCH_STORY_HOSTS = ["elasticsearch:9200"] ELASTICSEARCH_STORY_HOSTS = ["db_elasticsearch:9200"]
BACKED_BY_AWS = { BACKED_BY_AWS = {
'pages_on_node': False, 'pages_on_node': False,