Commit fe936c29 authored by carlosribas's avatar carlosribas
Browse files

Install and configure Supervisor

parent a4a6de32
......@@ -10,19 +10,17 @@ RUN apt-get update && apt-get install -y \
g++ \
build-essential \
curl \
wget \
tar \
git \
python2.7 \
libpython2.7-dev \
python-pip \
redis-server \
memcached
supervisor
ARG RNACENTRAL_HOME=/srv/rnacentral
ENV RNACENTRAL_HOME=$RNACENTRAL_HOME
ENV RNACENTRAL_LOCAL=$RNACENTRAL_HOME/local
ENV SUPERVISOR_CONF_DIR=${SUPERVISOR_CONF_DIR:-"/etc/supervisor"}
# Create folders. Install Infernal and node.js
RUN \
......@@ -55,5 +53,4 @@ ENTRYPOINT [ "/entrypoint.sh" ]
# Expose a container port where the website is served
EXPOSE 8000
# Start up the app
CMD python $RNACENTRAL_HOME/rnacentral-webcode/rnacentral/manage.py runserver 0.0.0.0:8000
CMD [ "/bin/sh", "-c", "/usr/bin/supervisord -c ${SUPERVISOR_CONF_DIR}/supervisord.conf" ]
......@@ -14,6 +14,9 @@ DB_PASSWORD=${DB_PASSWORD:-'NWDMCE5xdipIjRrp'}
# RNAcentral specific settings
SECRET_KEY=${SECRET_KEY:-'your_secret_key'}
# Supervisor
SUPERVISOR_CONF_DIR=${SUPERVISOR_CONF_DIR:-"/etc/supervisor"}
# Entrypoint variable
RNACENTRAL_PROJECT_PATH="${RNACENTRAL_HOME}/rnacentral-webcode/rnacentral"
......@@ -32,7 +35,7 @@ else
COMPRESS_ENABLED = False
RQ_QUEUES = {
"default": {
"HOST": "localhost",
"HOST": "192.168.1.3",
"PORT": 8051,
"DB": 0,
"DEFAULT_TIMEOUT": 360,
......@@ -53,4 +56,35 @@ else
chown -R nobody "${RNACENTRAL_PROJECT_PATH}"/rnacentral/local_settings.py
fi
# Supervisor setup
echo "INFO: Creating Supervisord configuration file"
mkdir -p "$SUPERVISOR_CONF_DIR"
cat <<-EOF > "${SUPERVISOR_CONF_DIR}"/supervisord.conf
[supervisord]
logfile=/var/log/supervisord.log
logfile_maxbytes=50MB
logfile_backups=2
loglevel=info
nodaemon=true
[program:rqworkers]
command=python $RNACENTRAL_HOME/rnacentral-webcode/rnacentral/manage.py rqworker
directory=$RNACENTRAL_HOME/rnacentral-webcode/rnacentral
numprocs=2
process_name=%(program_name)s_%(process_num)s
autorestart=true
autostart=true
stderr_logfile=/var/log/rqworkers.err.log
stdout_logfile=/var/log/rqworkers.out.log
[program:rnacentral]
command=python $RNACENTRAL_HOME/rnacentral-webcode/rnacentral/manage.py runserver 0.0.0.0:8000
user=nobody
autostart=true
autorestart=true
stderr_logfile=/var/log/rnacentral.err.log
stdout_logfile=/var/log/rnacentral.out.log
environment=HOME="$RNACENTRAL_HOME"
EOF
exec "$@"
\ No newline at end of file
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