Skip to content

Commit

Permalink
Merge pull request #924 from LibraryOfCongress/update-docker-compose-…
Browse files Browse the repository at this point in the history
…config

Update docker-compose config
  • Loading branch information
rstorey committed Apr 29, 2019
2 parents d70ae55 + b1741e6 commit 1b39e24
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 54 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
@@ -1,5 +1,9 @@
FROM python:3.7

## Add the wait script to the image
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait /wait
RUN chmod +x /wait

ENV DEBIAN_FRONTEND="noninteractive"

RUN echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list.d/stretch-backports.list
Expand Down Expand Up @@ -36,8 +40,4 @@ RUN pipenv install --system --dev --deploy

EXPOSE 80

## Add the wait script to the image
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait /wait
RUN chmod +x /wait

CMD /wait && /bin/bash entrypoint.sh
6 changes: 5 additions & 1 deletion celerybeat/Dockerfile
@@ -1,5 +1,9 @@
FROM python:3.7

## Add the wait script to the image
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait /wait
RUN chmod +x /wait

ENV DEBIAN_FRONTEND="noninteractive"

RUN echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list.d/stretch-backports.list
Expand Down Expand Up @@ -31,4 +35,4 @@ COPY . /app

RUN pipenv install --system --dev --deploy

CMD [ "/bin/bash", "celerybeat/entrypoint.sh" ]
CMD /wait && ./celerybeat/entrypoint.sh
Empty file modified celerybeat/entrypoint.sh 100644 → 100755
Empty file.
13 changes: 0 additions & 13 deletions concordia/settings_dev.py
Expand Up @@ -17,12 +17,6 @@

ALLOWED_HOSTS = ["127.0.0.1", "0.0.0.0", "*"]

CELERY_HOST = "localhost"
CELERY_PORT = 63791

CELERY_BROKER_URL = "redis://%s:%d/0" % (CELERY_HOST, CELERY_PORT)
CELERY_RESULT_BACKEND = CELERY_BROKER_URL

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
EMAIL_FILE_PATH = "/tmp/concordia-messages" # change this to a proper location
DEFAULT_FROM_EMAIL = os.environ.get("DEFAULT_FROM_EMAIL", "")
Expand All @@ -48,10 +42,3 @@
("concordia.utils", "get_anonymous_user"),
("concordia.models", "TranscriptionStatus"),
]

CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {"hosts": [(CELERY_HOST, CELERY_PORT)]},
}
}
66 changes: 32 additions & 34 deletions docker-compose.yml
@@ -1,9 +1,20 @@
### Start Docker containers with the following command :
# sudo make up

version: '3.6'
services:
elasticsearch:
restart: unless-stopped
image: elasticsearch:6.7.0
ports:
- 9200:9200

redis:
restart: unless-stopped
image: redis:latest
hostname: redis
ports:
- 63791:6379

db:
restart: unless-stopped
image: postgres
environment:
POSTGRES_PASSWORD: ${POSTGRESQL_PW}
Expand All @@ -15,84 +26,71 @@ services:
- ./postgresql:/docker-entrypoint-initdb.d
- db_volume:/var/lib/postgresl/data/

redis:
hostname: redis
image: redis:latest
ports:
- 63791:6379

app:
restart: unless-stopped
build: .
environment:
# The concordia app needs to wait for the db to completely start. Use docker-compose-wait
# as defined at https://github.com/ufoscout/docker-compose-wait
WAIT_HOSTS: db:5432
environment: &django-environment
WAIT_HOSTS: db:5432, redis:6379
POSTGRESQL_HOST: db
POSTGRESQL_PW: ${POSTGRESQL_PW}
CONCORDIA_ENVIRONMENT: development
S3_BUCKET_NAME: crowd-dev-content
DJANGO_SETTINGS_MODULE: concordia.settings_docker
DEBUG: ${DEBUG:-}
REDIS_ADDRESS: redis
REDIS_PORT: 6379
depends_on:
- redis
- db
volumes:
- .:/app
- images_volume:/concordia_images
links:
- redis

ports:
- 80:80

importer:
restart: unless-stopped
build:
context: .
dockerfile: importer/Dockerfile
environment:
POSTGRESQL_HOST: db
POSTGRESQL_PW: ${POSTGRESQL_PW}
S3_BUCKET_NAME: crowd-dev-content
DJANGO_SETTINGS_MODULE: concordia.settings_docker
DEBUG: ${DEBUG:-}
environment: *django-environment
depends_on:
- redis
- db
links:
- redis
- db
volumes:
- images_volume:/concordia_images

elasticsearch:
image: elasticsearch:6.7.0
ports:
- 9200:9200

indexer:
restart: unless-stopped
build:
context: .
dockerfile: indexer/Dockerfile
environment:
POSTGRESQL_HOST: db
POSTGRESQL_PW: ${POSTGRESQL_PW}
<<: *django-environment
WAIT_HOSTS: db:5432, redis:6379, elasticsearch:9200
ELASTICSEARCH_ENDPOINT: http://elasticsearch:9200
DJANGO_SETTINGS_MODULE: concordia.settings_docker
DEBUG: ${DEBUG:-}
depends_on:
- db
- elasticsearch
links:
- elasticsearch

celerybeat:
restart: unless-stopped
build:
context: .
dockerfile: celerybeat/Dockerfile
environment:
POSTGRESQL_HOST: db
POSTGRESQL_PW: ${POSTGRESQL_PW}
DJANGO_SETTINGS_MODULE: concordia.settings_docker
DEBUG: ${DEBUG:-}
environment: *django-environment
depends_on:
- redis
- db
links:
- redis

volumes:
db_volume:
Expand Down
6 changes: 5 additions & 1 deletion importer/Dockerfile
@@ -1,5 +1,9 @@
FROM python:3.7

## Add the wait script to the image
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait /wait
RUN chmod +x /wait

ENV DEBIAN_FRONTEND="noninteractive"

RUN echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list.d/stretch-backports.list
Expand Down Expand Up @@ -31,4 +35,4 @@ COPY . /app

RUN pipenv install --system --dev --deploy

CMD [ "/bin/bash", "importer/entrypoint.sh" ]
CMD /wait && ./importer/entrypoint.sh
Empty file modified importer/entrypoint.sh 100644 → 100755
Empty file.
6 changes: 5 additions & 1 deletion indexer/Dockerfile
@@ -1,5 +1,9 @@
FROM python:3.7

## Add the wait script to the image
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait /wait
RUN chmod +x /wait

ENV DEBIAN_FRONTEND="noninteractive"

RUN echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list.d/stretch-backports.list
Expand Down Expand Up @@ -33,4 +37,4 @@ COPY . /app

RUN pipenv install --system --dev --deploy

CMD /bin/bash indexer/entrypoint.sh
CMD /wait && ./indexer/entrypoint.sh
Empty file modified indexer/entrypoint.sh 100644 → 100755
Empty file.

0 comments on commit 1b39e24

Please sign in to comment.