Update the Docker install to mirror the new recommended installation process at /opt. Use virtualenv for the Docker install.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -11,7 +11,7 @@ MAINTAINER Roberto Rosario "roberto.rosario@mayan-edms.com"
|
|||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
ENV LC_ALL C.UTF-8
|
ENV LC_ALL C.UTF-8
|
||||||
ENV PROJECT_INSTALL_DIR=/usr/local/lib/python2.7/dist-packages/mayan
|
ENV PROJECT_INSTALL_DIR=/opt/mayan-edms
|
||||||
|
|
||||||
ARG APT_PROXY
|
ARG APT_PROXY
|
||||||
# Package caching
|
# Package caching
|
||||||
@@ -38,6 +38,7 @@ apt-get install -y --no-install-recommends \
|
|||||||
python-dev \
|
python-dev \
|
||||||
python-pip \
|
python-pip \
|
||||||
python-setuptools \
|
python-setuptools \
|
||||||
|
python-virtualenv \
|
||||||
python-wheel \
|
python-wheel \
|
||||||
redis-server \
|
redis-server \
|
||||||
sane-utils \
|
sane-utils \
|
||||||
@@ -54,8 +55,8 @@ rm -f /var/cache/apt/archives/*.deb
|
|||||||
ADD https://raw.githubusercontent.com/guilhem/apt-get-install/master/apt-get-install /usr/bin/
|
ADD https://raw.githubusercontent.com/guilhem/apt-get-install/master/apt-get-install /usr/bin/
|
||||||
RUN chmod +x /usr/bin/apt-get-install
|
RUN chmod +x /usr/bin/apt-get-install
|
||||||
|
|
||||||
# Install Python clients for PostgreSQL, REDIS, librabbitmq
|
# Install Python clients for librabbitmq, MySQL, PostgreSQL, REDIS
|
||||||
RUN pip install psycopg2==2.7.3.2 redis==2.10.6 mysql-python==1.2.5 librabbitmq==1.6.1
|
RUN pip install librabbitmq==1.6.1 mysql-python==1.2.5 psycopg2==2.7.3.2 redis==2.10.6
|
||||||
|
|
||||||
RUN adduser mayan --disabled-password --disabled-login --no-create-home --gecos ""
|
RUN adduser mayan --disabled-password --disabled-login --no-create-home --gecos ""
|
||||||
|
|
||||||
@@ -107,7 +108,11 @@ RUN chmod 777 dist -R
|
|||||||
|
|
||||||
FROM BASE_IMAGE
|
FROM BASE_IMAGE
|
||||||
|
|
||||||
WORKDIR /root/
|
RUN mkdir -p /opt
|
||||||
|
|
||||||
|
RUN virtualenv $PROJECT_INSTALL_DIR
|
||||||
|
|
||||||
|
WORKDIR /opt/mayan-edms/
|
||||||
|
|
||||||
COPY --from=BUILDER_IMAGE /code/dist/*.whl .
|
COPY --from=BUILDER_IMAGE /code/dist/*.whl .
|
||||||
|
|
||||||
@@ -117,18 +122,18 @@ COPY --from=BUILDER_IMAGE /code/requirements/testing-base.txt requirements-testi
|
|||||||
|
|
||||||
COPY --from=BUILDER_IMAGE /code/docker/version .
|
COPY --from=BUILDER_IMAGE /code/docker/version .
|
||||||
|
|
||||||
|
# Fix ownership
|
||||||
|
RUN chown -R mayan:mayan $PROJECT_INSTALL_DIR
|
||||||
|
|
||||||
# Install build Mayan EDMS
|
# Install build Mayan EDMS
|
||||||
RUN pip install *.whl && \
|
RUN pip -u mayan $PROJECT_INSTALL_DIR/bin/pip install --no-cache-dir *.whl && \
|
||||||
rm *.whl
|
rm *.whl
|
||||||
|
|
||||||
# Setup supervisor
|
# Setup supervisor
|
||||||
COPY docker/etc/supervisor/mayan.conf /etc/supervisor/conf.d
|
COPY docker/etc/supervisor/mayan.conf /etc/supervisor/conf.d
|
||||||
|
|
||||||
# Fix ownership
|
|
||||||
RUN chown -R mayan:mayan $PROJECT_INSTALL_DIR
|
|
||||||
|
|
||||||
# Allow flanker to autogenerate its PLY files
|
# Allow flanker to autogenerate its PLY files
|
||||||
RUN chown -R mayan:mayan /usr/local/lib/python2.7/dist-packages/flanker/
|
RUN chown -R mayan:mayan $PROJECT_INSTALL_DIR/lib/python2.7/site-packages/flanker/
|
||||||
|
|
||||||
RUN mkdir /var/lib/mayan
|
RUN mkdir /var/lib/mayan
|
||||||
VOLUME ["/var/lib/mayan"]
|
VOLUME ["/var/lib/mayan"]
|
||||||
|
|||||||
@@ -3,21 +3,23 @@
|
|||||||
set -e
|
set -e
|
||||||
echo "mayan: starting entrypoint.sh"
|
echo "mayan: starting entrypoint.sh"
|
||||||
INSTALL_FLAG=/var/lib/mayan/media/system/SECRET_KEY
|
INSTALL_FLAG=/var/lib/mayan/media/system/SECRET_KEY
|
||||||
export DOCKER_ROOT=/root
|
export DOCKER_ROOT=/opt/mayan-edms
|
||||||
|
|
||||||
export MAYAN_DEFAULT_BROKER_URL=redis://127.0.0.1:6379/0
|
export MAYAN_DEFAULT_BROKER_URL=redis://127.0.0.1:6379/0
|
||||||
export MAYAN_DEFAULT_CELERY_RESULT_BACKEND=redis://127.0.0.1:6379/0
|
export MAYAN_DEFAULT_CELERY_RESULT_BACKEND=redis://127.0.0.1:6379/0
|
||||||
|
|
||||||
export MAYAN_ALLOWED_HOSTS=*
|
export MAYAN_ALLOWED_HOSTS='["*"]'
|
||||||
export MAYAN_BIN=/usr/local/lib/python2.7/dist-packages/mayan/bin/mayan-edms.py
|
export MAYAN_BIN=/opt/mayan-edms/bin/mayan-edms.py
|
||||||
export MAYAN_BROKER_URL=${MAYAN_BROKER_URL:-${MAYAN_DEFAULT_BROKER_URL}}
|
export MAYAN_BROKER_URL=${MAYAN_BROKER_URL:-${MAYAN_DEFAULT_BROKER_URL}}
|
||||||
export MAYAN_CELERY_RESULT_BACKEND=${MAYAN_CELERY_RESULT_BACKEND:-${MAYAN_DEFAULT_CELERY_RESULT_BACKEND}}
|
export MAYAN_CELERY_RESULT_BACKEND=${MAYAN_CELERY_RESULT_BACKEND:-${MAYAN_DEFAULT_CELERY_RESULT_BACKEND}}
|
||||||
export MAYAN_GUNICORN_WORKERS=${MAYAN_GUNICORN_WORKERS:-2}
|
export MAYAN_INSTALL_DIR=/opt/mayan-edms
|
||||||
export MAYAN_INSTALL_DIR=/usr/local/lib/python2.7/dist-packages/mayan
|
export MAYAN_PYTHON_BIN_DIR=/opt/mayan-edms/bin/
|
||||||
export MAYAN_PYTHON_DIR=/usr/local/bin
|
|
||||||
export MAYAN_MEDIA_ROOT=/var/lib/mayan
|
export MAYAN_MEDIA_ROOT=/var/lib/mayan
|
||||||
export MAYAN_SETTINGS_MODULE=${MAYAN_SETTINGS_MODULE:-mayan.settings.production}
|
export MAYAN_SETTINGS_MODULE=${MAYAN_SETTINGS_MODULE:-mayan.settings.production}
|
||||||
|
|
||||||
|
export MAYAN_GUNICORN_BIN=${MAYAN_PYTHON_BIN_DIR}gunicorn
|
||||||
|
export MAYAN_GUNICORN_WORKERS=${MAYAN_GUNICORN_WORKERS:-2}
|
||||||
|
|
||||||
export CELERY_ALWAYS_EAGER=False
|
export CELERY_ALWAYS_EAGER=False
|
||||||
export PYTHONPATH=$PYTHONPATH:$MAYAN_MEDIA_ROOT
|
export PYTHONPATH=$PYTHONPATH:$MAYAN_MEDIA_ROOT
|
||||||
|
|
||||||
@@ -25,14 +27,14 @@ chown mayan:mayan /var/lib/mayan -R
|
|||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
echo "mayan: initialize()"
|
echo "mayan: initialize()"
|
||||||
su mayan -c "mayan-edms.py initialsetup --force"
|
su mayan -c "${MAYAN_BIN} initialsetup --force"
|
||||||
su mayan -c "mayan-edms.py collectstatic --noinput --clear"
|
su mayan -c "${MAYAN_BIN} collectstatic --noinput --clear"
|
||||||
}
|
}
|
||||||
|
|
||||||
upgrade() {
|
upgrade() {
|
||||||
echo "mayan: upgrade()"
|
echo "mayan: upgrade()"
|
||||||
su mayan -c "mayan-edms.py performupgrade"
|
su mayan -c "${MAYAN_BIN} performupgrade"
|
||||||
su mayan -c "mayan-edms.py collectstatic --noinput --clear"
|
su mayan -c "${MAYAN_BIN} collectstatic --noinput --clear"
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[program:mayan-gunicorn]
|
[program:mayan-gunicorn]
|
||||||
autorestart = false
|
autorestart = false
|
||||||
autostart = true
|
autostart = true
|
||||||
command = /bin/bash -c "cd ${MAYAN_PYTHON_DIR}; gunicorn -w ${MAYAN_GUNICORN_WORKERS} mayan.wsgi --max-requests 500 --max-requests-jitter 50 --worker-class gevent --bind 0.0.0.0:8000 --env DJANGO_SETTINGS_MODULE=${MAYAN_SETTINGS_MODULE}" --timeout 120
|
command = /bin/bash -c "${MAYAN_GUNICORN_BIN} -w ${MAYAN_GUNICORN_WORKERS} mayan.wsgi --max-requests 500 --max-requests-jitter 50 --worker-class gevent --bind 0.0.0.0:8000 --env DJANGO_SETTINGS_MODULE=${MAYAN_SETTINGS_MODULE}" --timeout 120
|
||||||
redirect_stderr = true
|
redirect_stderr = true
|
||||||
stderr_logfile = /dev/fd/2
|
stderr_logfile = /dev/fd/2
|
||||||
stderr_logfile_maxbytes = 0
|
stderr_logfile_maxbytes = 0
|
||||||
@@ -22,7 +22,7 @@ user = root
|
|||||||
[program:mayan-worker-fast]
|
[program:mayan-worker-fast]
|
||||||
autorestart = false
|
autorestart = false
|
||||||
autostart = true
|
autostart = true
|
||||||
command = nice -n 1 /bin/bash -c "cd ${MAYAN_PYTHON_DIR}; python ${MAYAN_BIN} celery --settings=${MAYAN_SETTINGS_MODULE} worker -Ofair -l ERROR -Q converter -n mayan-worker-fast.%%h --concurrency=1"
|
command = nice -n 1 /bin/bash -c "${MAYAN_BIN} celery --settings=${MAYAN_SETTINGS_MODULE} worker -Ofair -l ERROR -Q converter -n mayan-worker-fast.%%h --concurrency=1"
|
||||||
killasgroup = true
|
killasgroup = true
|
||||||
numprocs = 1
|
numprocs = 1
|
||||||
priority = 998
|
priority = 998
|
||||||
@@ -37,7 +37,7 @@ user = mayan
|
|||||||
[program:mayan-worker-medium]
|
[program:mayan-worker-medium]
|
||||||
autorestart = false
|
autorestart = false
|
||||||
autostart = true
|
autostart = true
|
||||||
command = nice -n 18 /bin/bash -c "cd ${MAYAN_PYTHON_DIR}; python ${MAYAN_BIN} celery --settings=${MAYAN_SETTINGS_MODULE} worker -Ofair -l ERROR -Q checkouts_periodic,documents_periodic,indexing,metadata,sources,sources_periodic,uploads,documents -n mayan-worker-medium.%%h --concurrency=1"
|
command = nice -n 18 /bin/bash -c "${MAYAN_BIN} celery --settings=${MAYAN_SETTINGS_MODULE} worker -Ofair -l ERROR -Q checkouts_periodic,documents_periodic,indexing,metadata,sources,sources_periodic,uploads,documents -n mayan-worker-medium.%%h --concurrency=1"
|
||||||
killasgroup = true
|
killasgroup = true
|
||||||
numprocs = 1
|
numprocs = 1
|
||||||
priority = 998
|
priority = 998
|
||||||
@@ -52,7 +52,7 @@ user = mayan
|
|||||||
[program:mayan-worker-slow]
|
[program:mayan-worker-slow]
|
||||||
autorestart = false
|
autorestart = false
|
||||||
autostart = true
|
autostart = true
|
||||||
command = nice -n 19 /bin/bash -c "cd ${MAYAN_PYTHON_DIR}; python ${MAYAN_BIN} celery --settings=${MAYAN_SETTINGS_MODULE} worker -Ofair -l ERROR -Q mailing,tools,statistics,parsing,ocr -n mayan-worker-slow.%%h --concurrency=1"
|
command = nice -n 19 /bin/bash -c "${MAYAN_BIN} celery --settings=${MAYAN_SETTINGS_MODULE} worker -Ofair -l ERROR -Q mailing,tools,statistics,parsing,ocr -n mayan-worker-slow.%%h --concurrency=1"
|
||||||
killasgroup = true
|
killasgroup = true
|
||||||
numprocs = 1
|
numprocs = 1
|
||||||
priority = 998
|
priority = 998
|
||||||
@@ -67,7 +67,7 @@ user = mayan
|
|||||||
[program:mayan-celery-beat]
|
[program:mayan-celery-beat]
|
||||||
autorestart = false
|
autorestart = false
|
||||||
autostart = true
|
autostart = true
|
||||||
command = nice -n 1 /bin/bash -c "cd ${MAYAN_PYTHON_DIR}; python ${MAYAN_BIN} celery --settings=${MAYAN_SETTINGS_MODULE} beat --pidfile= -l ERROR"
|
command = nice -n 1 /bin/bash -c "${MAYAN_BIN} celery --settings=${MAYAN_SETTINGS_MODULE} beat --pidfile= -l ERROR"
|
||||||
killasgroup = true
|
killasgroup = true
|
||||||
numprocs = 1
|
numprocs = 1
|
||||||
priority = 998
|
priority = 998
|
||||||
|
|||||||
Reference in New Issue
Block a user