Initial commit required to build a Docker image.

This commit is contained in:
Roberto Rosario
2015-11-29 19:00:21 -04:00
parent 6ef9b25e74
commit ad439fb9ce
6 changed files with 118 additions and 0 deletions

10
docker/bin/run.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
# Launch NGINX daemon
nginx
# Launch the workers
mayan-edms.py celery worker --settings=mayan.settings.production -Ofair -l ERROR -B -D
# Launch uWSGI in foreground
/usr/local/bin/uwsgi --ini /docker/conf/uwsgi/uwsgi.ini

View File

@@ -0,0 +1,15 @@
import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ.get('POSTGRES_DB'),
'USER': os.environ.get('POSTGRES_USER'),
'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR'),
'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT'),
}
}
BROKER_URL = 'redis://{}:{}/0'.format(os.environ.get('REDIS_PORT_6379_TCP_ADDR'), os.environ.get('REDIS_PORT_6379_TCP_PORT'))
CELERY_RESULT_BACKEND = 'redis://{}:{}/0'.format(os.environ.get('REDIS_PORT_6379_TCP_ADDR'), os.environ.get('REDIS_PORT_6379_TCP_PORT'))

View File

@@ -0,0 +1,22 @@
server {
listen 80;
server_name localhost;
location / {
include uwsgi_params;
uwsgi_pass unix:/run/mayan.sock;
client_max_body_size 30M; # Increse if your plan to upload bigger documents
proxy_read_timeout 30s; # Increase if your document uploads take more than 30 seconds
}
location /static {
alias /usr/local/lib/python2.7/dist-packages/mayan/media/static;
expires 1h;
}
location /favicon.ico {
alias /usr/local/lib/python2.7/dist-packages/mayan/media/static/appearance/images/favicon.ico;
expires 1h;
}
}

View File

@@ -0,0 +1,14 @@
[uwsgi]
chdir = $(MAYAN_INSTALL_DIR)
chmod-socket = 664
chown-socket = www-data:www-data
env = DJANGO_SETTINGS_MODULE=mayan.settings.production
gid = root
logto = /var/log/uwsgi/%n.log
pythonpath = /usr/local/lib/python2.7/dist-packages
master = True
max-requests = 5000
socket = /run/mayan.sock
uid = root
vacuum = True
wsgi-file = $(MAYAN_INSTALL_DIR)/wsgi.py

17
docker/docker-entrypoint.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -e
if [[ -z $POSTGRES_PORT_5432_TCP_ADDR ]]; then
echo "** ERROR: You need to link the Postgres container."
exit 1
fi
until nc -z $POSTGRES_PORT_5432_TCP_ADDR $POSTGRES_PORT_5432_TCP_PORT; do
echo "$(date) - waiting for Postgres..."
sleep 1
done
# Migrate database, create initial admin user
mayan-edms.py initialsetup
exec "$@"