Initial commit required to build a Docker image.
This commit is contained in:
40
Dockerfile
Normal file
40
Dockerfile
Normal file
@@ -0,0 +1,40 @@
|
||||
FROM ubuntu:15.04
|
||||
|
||||
MAINTAINER Roberto Rosario "roberto.rosario@mayan-edms.com"
|
||||
|
||||
# Install base Ubuntu libraries
|
||||
RUN apt-get update && apt-get install -y netcat-openbsd python-dev python-pip gpgv nginx libpq-dev git-core libjpeg-dev libmagic1 libpng-dev libreoffice libtiff-dev gcc ghostscript gpgv tesseract-ocr unpaper poppler-utils && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV MAYAN_INSTALL_DIR=/usr/local/lib/python2.7/dist-packages/mayan
|
||||
|
||||
# Install Mayan EDMS, latest production release
|
||||
RUN pip install mayan-edms==2.0.0rc1
|
||||
|
||||
# Install Python clients for PostgreSQL, REDIS, and uWSGI
|
||||
RUN pip install psycopg2 redis uwsgi
|
||||
|
||||
# Create Mayan EDMS basic settings/local.py file
|
||||
RUN mayan-edms.py createsettings
|
||||
|
||||
# Install Mayan EDMS static media files
|
||||
RUN mayan-edms.py collectstatic --noinput
|
||||
|
||||
ADD docker /docker
|
||||
|
||||
# Setup Mayan EDMS settings file overrides
|
||||
RUN cat /docker/conf/mayan/settings.py >> $MAYAN_INSTALL_DIR/settings/local.py
|
||||
|
||||
# Setup NGINX
|
||||
RUN rm /etc/nginx/sites-enabled/default
|
||||
RUN ln -s /docker/conf/nginx/mayan-edms /etc/nginx/sites-enabled/mayan-edms
|
||||
|
||||
# Setup UWSGI
|
||||
RUN mkdir /var/log/uwsgi
|
||||
|
||||
# Persistent Mayan EDMS files
|
||||
VOLUME $MAYAN_INSTALL_DIR/media
|
||||
|
||||
ENTRYPOINT ["/docker/entrypoint.sh"]
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["/docker/bin/run.sh"]
|
||||
10
docker/bin/run.sh
Executable file
10
docker/bin/run.sh
Executable 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
|
||||
15
docker/conf/mayan/settings.py
Normal file
15
docker/conf/mayan/settings.py
Normal 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'))
|
||||
22
docker/conf/nginx/mayan-edms
Normal file
22
docker/conf/nginx/mayan-edms
Normal 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;
|
||||
}
|
||||
}
|
||||
14
docker/conf/uwsgi/uwsgi.ini
Normal file
14
docker/conf/uwsgi/uwsgi.ini
Normal 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
17
docker/docker-entrypoint.sh
Executable 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 "$@"
|
||||
Reference in New Issue
Block a user