Commit 0c76d766 authored by BERJON Matthieu's avatar BERJON Matthieu

Update of the docker container

I updated the container in order to:

- update the wsgi file in order to load the environment variables and
which config file to read
- update of the docker file in with the packages to install
- update of the supervisor config file
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent ba1377f0
......@@ -3,14 +3,21 @@ FROM debian:stretch
# install system packages
# Installation of gunicorn through pip because the debian package
# python3-gunicorn doesn't install any binary
RUN apt-get update && apt-get install -y \
mysql-server default-libmysqlclient-dev \
nginx-light zip \
python3 python3-dev python3-pip python3-django python3-mysqldb python-mysqldb \
python3-django-environ supervisor && pip3 install gunicorn
# Install Stretch backport
RUN echo "deb http://ftp.debian.org/debian stretch-backports main" \
>> /etc/apt/sources.list.d/stretch.list
RUN apt-get update && apt-get -t stretch-backports install -y \
python3-django python3-django-allauth
RUN apt-get install -y mysql-server default-libmysqlclient-dev \
nginx-light zip python3-dev python3-pip python3-mysqldb python-mysqldb \
supervisor && pip3 install gunicorn
COPY . /opt/allgo
COPY .env /opt/allgo
COPY init /dk/container_init
RUN patch /etc/nginx/nginx.conf < /opt/allgo/setup/dk/nginx.patch
......
......@@ -8,6 +8,14 @@ app_path = os.path.abspath(os.path.join(
os.path.dirname(os.path.abspath(__file__)), os.pardir))
sys.path.append(os.path.join(app_path, 'allgo'))
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.production')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
if os.environ.get('ALLGO_SECRET_KEY') is None:
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip().split('=')
if len(var) == 2:
os.environ[var[0]] = var[1]
application = get_wsgi_application()
......@@ -14,9 +14,8 @@ mkdir -p \
/vol/cache/redis \
/vol/cache/nginx
# dump the database and execute the migration
while ! mysql -u allgo -h dev-mysql --password=allgo -e ";"
while ! mysql -u allgo -h dev-mysql allgo --password=allgo -e ";"
do
sleep 2
done
......
; supervisor config file
[unix_http_server]
file=/vol/cache/supervisor.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)
file = /vol/cache/supervisor.sock ; (the path to the socket file)
chmod = 0700 ; socket file mode (default 0700)
username = dummy ; avoid a critical error on authentication
password = dummy ; avoid a critical error on authentication
[supervisord]
logfile=/vol/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/vol/log/supervisor ; ('AUTO' child log dir, default $TEMP)
logfile = /vol/log/supervisor/supervisord.log
pidfile = /tmp/supervisord.pid
childlogdir = /vol/log/supervisor ; ('AUTO' child log dir, default $TEMP)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///vol/cache/supervisor.sock ; use a unix:// URL for a unix socket
serverurl = unix:///vol/cache/supervisor.sock ; use a unix:// URL for a unix socket
username = dummy ; avoid a critical error on authentication
password = dummy ; avoid a critical error on authentication
[program:django]
command=gunicorn config.wsgi:application -w 2 -b :4000
startsecs=10
command = gunicorn config.wsgi:application -w 2 -b :4000
startsecs = 10
[program:nginx]
command=nginx -g "daemon off;"
command = nginx -g "daemon off;"
username = www-data
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment