Commit eb5167c7 authored by carlosribas's avatar carlosribas
Browse files

Change docker to deploy using kubernetes

parent 4fe92d40
......@@ -121,3 +121,6 @@ dump.rdb
# default location of search export results
rnacentral/export/results
.gitsecret/keys/random_seed
# environment variables
.env
#------------------------------------------------------------------------------
#
# This Dockerfile is meant for containerized deployment with Kubernetes.
#
#-------------------------------------------------------------------------------
FROM debian:latest
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
ARG RNACENTRAL_HOME=/srv/rnacentral
ENV RNACENTRAL_HOME=$RNACENTRAL_HOME
ENV RNACENTRAL_LOCAL=$RNACENTRAL_HOME/local
RUN mkdir -p $RNACENTRAL_HOME/local
RUN mkdir $RNACENTRAL_HOME/static
# Install Infernal
RUN \
cd $RNACENTRAL_LOCAL && \
curl -OL http://eddylab.org/infernal/infernal-1.1.1.tar.gz && \
tar -xvzf infernal-1.1.1.tar.gz && \
cd infernal-1.1.1 && \
./configure --prefix=$RNACENTRAL_LOCAL/infernal-1.1.1 && \
make && \
make install && \
cd easel && \
make install && \
cd $RNACENTRAL_LOCAL && \
rm infernal-1.1.1.tar.gz
# Download RNAcentral
RUN \
cd $RNACENTRAL_HOME && \
git clone https://github.com/RNAcentral/rnacentral-webcode.git
# Install Django requirements
RUN pip install -r $RNACENTRAL_HOME/rnacentral-webcode/rnacentral/requirements.txt
# Install node.js
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs
# Install node.js dependencies
RUN cd $RNACENTRAL_HOME/rnacentral-webcode/rnacentral/portal/static && npm install --only=production
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
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
......@@ -5,8 +5,20 @@ services:
web:
build:
context: .
dockerfile: Dockerfile-development
dockerfile: Dockerfile-kubernetes
volumes:
- ${RNACENTRAL_HOME}:/rnacentral/rnacentral-webcode
- "rnacentral_data:/rnacentral"
environment:
- DB_HOST=${DB_HOST}
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_PORT=${DB_PORT}
- SECRET_KEY=${SECRET_KEY}
stdin_open: true
tty: true
ports:
- "9000:8000"
volumes:
rnacentral_data:
\ No newline at end of file
#!/bin/sh
set -e
# SYSTEM OPTIONS (set on Docker build)
RNACENTRAL_HOME=$RNACENTRAL_HOME
# External database settings
DB_HOST=${DB_HOST:-'hh-pgsql-public.ebi.ac.uk'}
DB_NAME=${DB_NAME:-'pfmegrnargs'}
DB_USER=${DB_USER:-'reader'}
DB_PORT=${DB_PORT:-'5432'}
DB_PASSWORD=${DB_PASSWORD:-'NWDMCE5xdipIjRrp'}
# RNAcentral specific settings
SECRET_KEY=${SECRET_KEY:-'your_secret_key'}
# Entrypoint variable
RNACENTRAL_PROJECT_PATH="${RNACENTRAL_HOME}/rnacentral-webcode/rnacentral"
# Add local_settings file
if [ -f "${RNACENTRAL_PROJECT_PATH}"/rnacentral/local_settings.py ]
then
echo "INFO: RNAcentral local_settings.py file already provisioned"
else
echo "INFO: Creating RNAcentral local_settings.py file"
cat <<-EOF > "${RNACENTRAL_PROJECT_PATH}"/rnacentral/local_settings.py
from utils import get_environment
SECRET_KEY = "$SECRET_KEY"
DEBUG = True
ENVIRONMENT = get_environment()
INTERNAL_IPS = ('127.0.0.1', '192.168.99.1')
COMPRESS_ENABLED = False
RQ_QUEUES = {
"default": {
"HOST": "localhost",
"PORT": 8051,
"DB": 0,
"DEFAULT_TIMEOUT": 360,
"REMOTE_SERVER": None,
}
}
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "$DB_NAME",
"USER": "$DB_USER",
"PASSWORD": "$DB_PASSWORD",
"HOST": "$DB_HOST",
"PORT": "$DB_PORT",
}
}
EOF
chown -R nobody "${RNACENTRAL_PROJECT_PATH}"/rnacentral/local_settings.py
fi
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