Use supervisord for runserver in docker
This commit is contained in:
Родитель
7f3af544bd
Коммит
5bf6773865
|
@ -52,3 +52,7 @@ user-media/*
|
|||
.tox/
|
||||
.cache/
|
||||
MANIFEST
|
||||
docker/artifacts/*
|
||||
logs/*
|
||||
supervisord.pid
|
||||
.ipython
|
||||
|
|
15
Dockerfile
15
Dockerfile
|
@ -8,6 +8,8 @@ ENV LC_ALL en_US.UTF-8
|
|||
# Fix multilib issues when installing openssl-devel.
|
||||
RUN yum install -y --enablerepo=centosplus libselinux-devel && yum clean all
|
||||
|
||||
RUN yum install -y supervisor bash-completion && yum clean all
|
||||
|
||||
ADD docker-mysql.repo /etc/yum.repos.d/mysql.repo
|
||||
|
||||
RUN yum update -y \
|
||||
|
@ -36,5 +38,16 @@ RUN cd /pip && \
|
|||
-r requirements/docker.txt && \
|
||||
rm -r build cache
|
||||
|
||||
RUN mkdir /code
|
||||
|
||||
COPY . /code
|
||||
WORKDIR /code
|
||||
|
||||
# Preserve bash history across image updates.
|
||||
# This works best when you link your local source code
|
||||
# as a volume.
|
||||
ENV HISTFILE /code/docker/artifacts/bash_history
|
||||
# Configure bash history.
|
||||
ENV HISTSIZE 50000
|
||||
ENV HISTIGNORE ls:exit:"cd .."
|
||||
# This prevents dupes but only in memory for the current session.
|
||||
ENV HISTCONTROL erasedups
|
||||
|
|
|
@ -11,18 +11,20 @@ worker: &worker
|
|||
- redis
|
||||
- rabbitmq
|
||||
environment:
|
||||
- DATABASE_URL=mysql://root:@mysqld/olympia
|
||||
- MEMCACHE_LOCATION=memcached:11211
|
||||
- ELASTICSEARCH_LOCATION=elasticsearch:9200
|
||||
- REDIS_LOCATION=redis:6379
|
||||
- MYSQL_ROOT_PASSWORD='docker'
|
||||
- MYSQL_DATABASE='olympia'
|
||||
- PYTHONDONTWRITEBYTECODE=1
|
||||
- BROKER_URL=amqp://olympia:olympia@rabbitmq/olympia
|
||||
- DATABASE_URL=mysql://root:@mysqld/olympia
|
||||
- ELASTICSEARCH_LOCATION=elasticsearch:9200
|
||||
- MEMCACHE_LOCATION=memcached:11211
|
||||
- MYSQL_DATABASE='olympia'
|
||||
- MYSQL_ROOT_PASSWORD='docker'
|
||||
- PYTHONDONTWRITEBYTECODE=1
|
||||
- PYTHONUNBUFFERED=1
|
||||
- REDIS_LOCATION=redis:6379
|
||||
- TERM=xterm-256color
|
||||
|
||||
web:
|
||||
<<: *worker
|
||||
command: python manage.py runserver 0.0.0.0:8000
|
||||
command: supervisord -n -c /code/docker/supervisor.conf
|
||||
ports:
|
||||
- "8000:8000"
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
This directory contains ephemeral artifacts from your running Docker container.
|
|
@ -0,0 +1,21 @@
|
|||
[supervisord]
|
||||
logfile=/code/logs/supervisord.log
|
||||
|
||||
[program:olympia]
|
||||
command=python /code/manage.py runserver 0.0.0.0:8000
|
||||
directory=/code
|
||||
stopasgroup=true
|
||||
autostart=true
|
||||
redirect_stderr=true
|
||||
stdout_logfile=logs/docker.log
|
||||
stdout_logfile_maxbytes=1MB
|
||||
stopsignal=KILL
|
||||
|
||||
# The following sections enable supervisorctl.
|
||||
|
||||
[inet_http_server]
|
||||
port=9001
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
Загрузка…
Ссылка в новой задаче