Skip to content

Commit 302a37c

Browse files
committed
dockerization
1 parent fe6c250 commit 302a37c

10 files changed

+188
-0
lines changed

dockerization/Dockerfile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#FROM us.gcr.io/broad-dsp-gcr-public/terra-jupyter-python:0.1.2
2+
FROM ubuntu:18.04
3+
4+
USER root
5+
RUN apt-get update && apt-get upgrade -y
6+
RUN apt-get install -y python3.6 vim tmux fish curl wget strace git gcc
7+
8+
RUN git clone https://github.com/shapirolab/clineage.git
9+
10+
RUN wget -P /tmp https://repo.anaconda.com/archive/Anaconda3-2021.04-Linux-x86_64.sh
11+
RUN bash /tmp/Anaconda3-2021.04-Linux-x86_64.sh -b
12+
ENV PATH /root/anaconda3/bin/:$PATH
13+
14+
WORKDIR clineage
15+
RUN mkdir hg19 \
16+
&& mv get_hg19.bash hg19/ \
17+
&& cd hg19 \
18+
&& bash get_hg19.bash
19+
20+
RUN conda init bash \
21+
&& . ~/.bashrc \
22+
&& conda create --name py36 python=3.6 \
23+
&& conda activate py36 \
24+
&& conda install -c bioconda -c dranew --file conda_requirements.txt
25+
26+
RUN echo "click==7.1.2" >> requirements-extra.txt # click version 8 breaks us
27+
RUN echo "setuptools==57.5" >> requirements-extra.txt # setuptools version 58 breaks us
28+
RUN . ~/.bashrc && conda activate py36 && pip install -r requirements-extra.txt
29+
RUN . ~/.bashrc && conda activate py36 && pip install -r requirements.txt
30+
RUN . ~/.bashrc && conda activate py36 && pip install -r requirements-unpackaged.txt
31+
RUN tail -n +2 requirements-dev.txt > /tmp/a && mv /tmp/a requirements-dev.txt # Remove redundent line
32+
RUN . ~/.bashrc && conda activate py36 && pip install -r requirements-dev.txt
33+
34+
CMD /entrypoint.sh
35+
#CMD sleep infinity

dockerization/build.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
DOCKER_BUILDKIT=1 docker build -t clineage .

dockerization/docker-compose.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
version: "3"
2+
3+
services:
4+
db:
5+
image: mariadb
6+
volumes:
7+
- db_data:/var/lib/mysql
8+
restart: always
9+
environment:
10+
MYSQL_ROOT_PASSWORD: root_password
11+
MYSQL_DATABASE: clineage_prod
12+
MYSQL_USER: dcsoft
13+
MYSQL_PASSWORD: 164d8ae81bd7e38a163ea2e144114b25
14+
15+
clineage-web:
16+
depends_on:
17+
- db
18+
image: clineage
19+
restart: always
20+
volumes:
21+
- ./resources/local_settings.py:/clineage/clineage/local_settings.py
22+
- ./resources/init_once_clineage_web.sh:/init_once.sh
23+
- ./resources/entrypoint_clineage_web.sh:/entrypoint.sh
24+
- data_store:/data_store
25+
ports:
26+
- 8000:8000
27+
environment:
28+
MYSQL_HOST: db
29+
MYSQL_PORT: 3306
30+
MYSQL_DATABASE: clineage_prod
31+
MYSQL_USER: dcsoft
32+
MYSQL_PASSWORD: 164d8ae81bd7e38a163ea2e144114b25
33+
34+
task-scheduler:
35+
image: clineage
36+
volumes:
37+
- ./resources/entrypoint_task_scheduler.sh:/entrypoint.sh
38+
ports:
39+
- 8787:8787
40+
restart: always
41+
42+
clineage-worker:
43+
depends_on:
44+
- clineage-web
45+
- task-scheduler
46+
image: clineage
47+
restart: always
48+
volumes:
49+
- ./resources/local_settings.py:/clineage/clineage/local_settings.py
50+
- data_store:/data_store
51+
# - ./resources/entrypoint_clineage_worker.sh:/entrypoint.sh
52+
- ./resources/entrypoint_debug.sh:/entrypoint.sh
53+
environment:
54+
MYSQL_HOST: db
55+
MYSQL_PORT: 3306
56+
MYSQL_DATABASE: clineage_prod
57+
MYSQL_USER: dcsoft
58+
MYSQL_PASSWORD: 164d8ae81bd7e38a163ea2e144114b25
59+
60+
volumes:
61+
db_data: {}
62+
data_store: {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -e
3+
4+
bash /init_once.sh
5+
6+
. $(which activate) py36
7+
8+
cd /clineage
9+
./manage.py runserver 0.0.0.0:8000
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -e
3+
4+
. $(which activate) py36
5+
PYTHONPATH='/clineage' DJANGO_SETTINGS_MODULE='clineage.settings' dask-worker --nthreads 1 --memory-limit 300000000000 --preload /clineage/worker-setup.py task-scheduler:8786
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -e
3+
4+
sleep infinity
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -e
3+
4+
. $(which activate) py36
5+
dask-scheduler
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ -f /init_done ]; then
5+
exit
6+
fi
7+
8+
. $(which activate) py36
9+
10+
cd /clineage
11+
yes "yes" | ./manage.py migrate
12+
cat <<EOF | python manage.py shell
13+
from django.contrib.auth import get_user_model
14+
15+
User = get_user_model() # get the currently active user model,
16+
17+
User.objects.filter(username='root').exists() or \
18+
User.objects.create_superuser('root', 'root@example.com', 'root')
19+
EOF
20+
21+
touch /init_done
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import os.path
2+
import os
3+
4+
#CHROMOSOMES_PATH = '/net/mraid11/export/dcstor/Ofir/GenomesData/'
5+
CHROMOSOMES_PATH = '/clineage/hg19/'
6+
DEBUG=True
7+
# S_MAIN = '/net/mraid11/export/dcstor/LINEAGE/Hiseq/NSR2/fastq_human/Output'
8+
S_MAIN = '/data_store'
9+
# DATABASES = {
10+
# 'default': {
11+
# 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
12+
# 'NAME': 'clineage_prod', # Or path to database file if using sqlite3.
13+
# 'USER': 'dcsoft', # Not used with sqlite3.
14+
# 'PASSWORD': '164d8ae81bd7e38a163ea2e144114b25', # Not used with sqlite3.
15+
# 'HOST': 'db', # Set to empty string for localhost. Not used with sqlite3.
16+
# 'PORT': '3306', # Set to empty string for default. Not used with sqlite3.
17+
# }
18+
# }
19+
DATABASES = {
20+
'default': {
21+
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
22+
'HOST': os.environ['MYSQL_HOST'], # Set to empty string for localhost. Not used with sqlite3.
23+
'PORT': os.environ['MYSQL_PORT'], # Set to empty string for default. Not used with sqlite3.
24+
'NAME': os.environ['MYSQL_DATABASE'], # Or path to database file if using sqlite3.
25+
'USER': os.environ['MYSQL_USER'], # Not used with sqlite3.
26+
'PASSWORD': os.environ['MYSQL_PASSWORD'], # Not used with sqlite3.
27+
}
28+
}
29+
30+
ALLOWED_HOSTS = [
31+
'*',
32+
]
33+
34+
SECRET_KEY = 'gcd6^pq#l78%_jg3@2jf)csum=_d%5-pa5!3hma4g&e*lxx+m$'
35+
36+
DATA_STORE = '/data_store'
37+
# NOA_MATLAB = r'/home/dcsoft/s/Ofir/noa_matlab/Code/'
38+
NOA_MATLAB = r''
39+
# IGORS_CODE = r'/home/dcsoft/s/Ofir/igor_tree_reconstruction_20170808/'

dockerization/run.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
docker run --rm -u root --entrypoint /usr/bin/fish -it clineage

0 commit comments

Comments
 (0)