Commit 3b641b92 authored by HERBERT Ryan's avatar HERBERT Ryan

docker switching to docker compose

The initial docker configuration wasn't working correctly, so this was
an opportunity to switch to a docker-compose to manage individual
services.
This allowed to also better fit the docker philosophy of lightweight
containers that manage only a single services and/or process
parent 32df78dd
FROM ubuntu:16.04
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
version: '2'
services:
mysql:
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=MySRPimSRP
volumes:
- ./mysql/:/docker-entrypoint-initdb.d/
- /var/lib/mysql:/var/lib/mysql
postfix:
image: catatnight/postfix
environment:
- maildomain=mail.example.com
- smtp_user=user:pwd
ports:
- "25:25"
uwsgi:
build: ./vidjil
image: vidjil:test
command: bash /entrypoints/uwsgi-entrypoint.sh
volumes:
- /opt/vidjil/databases:/usr/share/vidjil/server/web2py/applications/vidjil/databases
- /opt/vidjil/result/results:/mnt/result/results
- /opt/vidjil/result/tmp:/mnt/result/tmp
- /opt/vidjil/upload/uploads:/mnt/upload/uploads
- /var/vidjil:/var/vidjil
- /home/ryan/vidjil:/usr/share/vidjil
depends_on:
- mysql
- postfix
- fuse
links:
- mysql:mysql
- postfix:postfix
- fuse:fuse
fuse:
image: vidjil:test
volumes:
- /home/user/vidjil:/usr/share/vidjil
nginx:
image: vidjil:test
volumes:
- /home/user/vidjil:/usr/share/vidjil
#- /home/user/ssl:/etc/nginx/ssl
depends_on:
- uwsgi
links:
- uwsgi:uwsgi
ports:
- "80:80"
- "443:443"
#command: bash /entrypoints/nginx-entrypoint.sh
command: nginx -g 'daemon off;'
workers:
image: vidjil:test
command: /usr/local/bin/gosu www-data python /usr/share/vidjil/server/web2py/web2py.py -K vidjil,vidjil,vidjil
volumes:
- /opt/vidjil/databases:/usr/share/vidjil/server/web2py/applications/vidjil/databases
- /opt/vidjil/result:/mnt/result
- /opt/vidjil/result/tmp:/mnt/result/tmp
- /opt/vidjil/upload:/mnt/upload
- /var/vidjil:/var/vidjil
- /home/ryan/vidjil:/usr/share/vidjil
depends_on:
- uwsgi
- mysql
links:
- mysql
reporter:
build: ./reporter
image: reporter:test
volumes:
- /opt/vidjil/databases:/usr/share/vidjil/server/web2py/applications/vidjil/databases
- /opt/vidjil/result/results:/mnt/result/results
- /opt/vidjil/result/tmp:/mnt/result/tmp
- /opt/vidjil/upload/uploads:/mnt/upload/uploads
- /var/vidjil:/var/vidjil
- /home/ryan/vidjil:/usr/share/vidjil
- ./reporter/code:/opt/reporter
depends_on:
- uwsgi
links:
- postfix:postfix
- uwsgi:uwsgi
CREATE USER vidjil_user;
SET PASSWORD FOR USER vidjil_user = PASSWORD('rootpass');
CREATE DATABASE vidjil;
GRANT ALL ON vidjil.* TO 'vidjil_user'@'%';
from ubuntu:16.04
label version="1.0"
label description="An Ubuntu based docker image which postfix"
# Install Postfix. Shamelessly stolen from https://github.com/noteed/docker-postfix/blob/master/Dockerfile
run echo "postfix postfix/main_mailer_type string Internet site" > preseed.txt
run echo "postfix postfix/mailname string mail.example.com" >> preseed.txt
# Use Mailbox format.
run debconf-set-selections preseed.txt
run apt-get update
run DEBIAN_FRONTEND=noninteractive apt-get install -q -y postfix
run postconf -e myhostname=mail.example.com
run postconf -e mydestination="mail.example.com, example.com, localhost.localdomain, localhost"
run postconf -e mail_spool_directory="/var/spool/mail/"
run postconf -e mailbox_command=""
from vidjil:test
run apt-get update && apt-get install -y cron python python-pip iputils-ping
run pip install crontab requests
add crontab /etc/cron.d/reporter
run chmod 0644 /etc/cron.d/reporter
run touch /var/log/cron.log
cmd cron && tail -f /var/log/cron.log
*Reporter
The reporter is designed to connect to a machine on the same network (or remotely when possible) via ssh and execute a list of scripts on the target system. The results are then posted via HTTP to a monitorserv instance.
**Configuration
***Basic
The reporter script is has a series of parameters that can be configured that range from the setting of a cron task for repeat execution to the configuration of users that should be executing the scripts.
The script takes the following parameters:
--init Set following arguments as default and start cron
--delete Unset all cron jobs created by this script
--set Set values in config file without setting a cron
--reset Reset config file to default values
--start Launch Cron with current settings
-tgt --host Host name
-c --cron Cron expression
-u --username SSH Username
-p --path Path to Vidjil installation
-py --python Path to the python installation
-m --monitor host of the monitor that will receive the report
-s --servername ID of the server entry in the monitor database
--cron-user User that will be executing the cron task on this machine
Using the set or init parameters will write the parameters to the =config= file with the following format:
<param_name> <param_value>
The config file is read at each execution of the monitoring process.
***Scripts
Upon starting the reporter process reads thre =script_map= file in order to determine what will be executed on the remote machine.
A =key= =value= pair is used to in this file where the =key= is the name of the field that will be sent to the monitorserv instance and the =value= is the path to the script (relative to the scripts folder)
The order in which scripts are added represents the order in which the fields will be placed and numbered in the form that will be sent. This can be an important detail when using the reporter in conjunction with monitorserv because it will define the order in which the fields are displayed in the webapp.
***Dependencies
On the local system: ssh, crontab and python are necessary. Bash or shell are highly recommended for script testing.
On the remote system: Bash or shell and ssh are necessary
***SSH Authentication
Given that the Reporter uses ssh tunneling to execute scripts on the remote system, it is important that the username parameter be set to a user that has the correct permissions on the remote system.
It is also necessary to have the a public key on the remote system in order to connect automatically or the deamonized execution during the crontab task will fail as the ssh connection will require a manually entered password.
For one-time execution the password prompt will be displayed in the terminal.
**Usage
For single execution, one can simply run the script with of without parameters. In the absence of a parameter the value included in the =config= file will be applied to the execution.
For repeat execution it is necessary to use the =--init= parameter which will not only set any given parameter as default in the config file but also start a crontab task with the cron expression in the =config= file (giving a cron expression as parameter will also work since it will be set in the =config= file before initialising the crontab task).
username ryan
key /home/ryan/.ssh/id_rsa
monitor http://monitor.vidjil.org/server
python /usr/bin/python
servername vidjil-ryan
cron_user www-data
cron 0 5 * * * *
host 127.0.0.1
path /home/www-data/vidjil
#!/usr/bin/python
from subprocess import Popen, PIPE, check_output
from crontab import CronTab
from collections import OrderedDict
import argparse
import os
from datetime import datetime
parser = argparse.ArgumentParser()
#-db DATABSE -u USERNAME -p PASSWORD -size 20
parser.add_argument("--init", help="Set following arguments as default and start cron", action="store_true")
parser.add_argument("--delete", help="Unset all cron jobs created by this script", action="store_true")
parser.add_argument("--set", help="Set values in config file without setting a cron", action="store_true")
parser.add_argument("--reset", help="Reset config file to default values", action="store_true")
parser.add_argument("--start", help="Launch Cron with current settings", action="store_true")
parser.add_argument("-tgt", "--host", help="Host name")
parser.add_argument("-c", "--cron", help="Cron expression")
parser.add_argument("-u", "--username", help="SSH Username")
parser.add_argument("-p", "--path", help="Path to Vidjil installation")
parser.add_argument("-py", "--python", help="Path to the python installation")
parser.add_argument("-m", "--monitor", help="host of the monitor that will receive the report")
parser.add_argument("-s", "--servername", help="ID of the server entry in the monitor database")
parser.add_argument("-k", "--key", help="Path to ssh key to use")
parser.add_argument("-l", "--local", help="Execute scripts on local machine")
parser.add_argument("--cron-user", help="user that will be executing the cron task on this machine")
parser.add_argument("--config", help="location of the config file that should be used")
CUR_DIR = os.path.dirname(os.path.realpath(__file__)) + '/'
SCRIPT_DIR = CUR_DIR + 'scripts/'
SCRIPT_MAP = CUR_DIR + 'script_map'
CONFIG_DIR = CUR_DIR + 'configs/'
CMD = os.path.realpath(__file__)
DEFAULT_CRON_USER = 'www-data'
DEFAULT_MONITOR_HOST = 'http://127.0.0.1:5000/monitor'
DEFAULT_SERVER_NAME = 'banana'
DEFAULT_HOST = '127.0.0.1'
DEFAULT_CRON = '* * * * * *'
DEFAULT_USERNAME = 'www-data'
DEFAULT_KEY = '/home/www-data/.ssh/id_rsa'
DEFAULT_PATH = '/home/www-data/vidjil'
DEFAULT_PYTHON = '/usr/bin/python'
DEFAULT_CONFIG = CONFIG_DIR + 'default.cfg'
DEFAULT_LOCAL = 'false'
def init(config, host=None, cron=None, username=None, local=None, key=None, path=None, python=None, monitor=None, servername=None, cron_user=None):
params = set_args(config, host, cron, username, local, key, path, python, monitor, servername, cron_user)
set_cron(params['python'] + ' ' + CMD + ' --config ' + config, params['cron_user'], params['cron'])
def start(config):
params = load(config)
set_cron(params['python'] + ' ' + CMD + ' --config ' + config, params['cron_user'], params['cron'])
def set_args(config, host=None, cron=None, username=None, local=None, key=None, path=None, python=None, monitor=None, servername=None, cron_user=None):
params = load(DEFAULT_CONFIG)
params['host'] = params['host'] if host is None else host
params['cron'] = params['cron'] if cron is None else cron
params['username'] = params['username'] if username is None else username
params['local'] = params['local'] if local is None else local
params['key'] = params['key'] if key is None else key
params['path'] = params['path'] if path is None else path
params['python'] = params['python'] if python is None else python
params['monitor'] = params['monitor'] if monitor is None else monitor
params['servername'] = params['servername'] if servername is None else servername
params['cron_user'] = params['cron_user'] if cron_user is None else cron_user
print "Initialising monitor for host " + params['host'] + " with cron expression " + params['cron'] + " username " + params['username'] + " path " + params['path'] + " in config file " + config
write_config(params, config)
return params
def reset(config=None):
p = {}
p['host'] = DEFAULT_HOST
p['cron'] = DEFAULT_CRON
p['username'] = DEFAULT_USERNAME
p['local'] = DEFAULT_LOCAL
p['key'] = DEFAULT_KEY
p['path'] = DEFAULT_PATH
p['python'] = DEFAULT_PYTHON
p['monitor'] = DEFAULT_MONITOR_HOST
p['servername'] = DEFAULT_SERVER_NAME
p['cron_user'] = DEFAULT_CRON_USER
write_config(p, config)
def write_config(params, cfg_file):
config_file = open(cfg_file, 'w+')
for key in params:
config_file.write(key + ' ' + params[key] + '\n')
def delete(cmd, user):
tab = CronTab(user=user)
tab.remove_all(command=cmd)
tab.write()
def load(file):
conf = open(file, 'r')
params = OrderedDict()
for line in conf.readlines():
if (line[0] != '#' and not line.isspace()):
l = line.split(' ')
params[l[0]] = ' '.join(l[1:len(l)]).rstrip()
print "Loaded params: " + str(params)
return params
def set_cron(cmd, user, cron_exp):
my_cron = CronTab(user=user)
job = my_cron.new(command=cmd)
cron_arr = cron_exp.split(' ')
job.setall(cron_arr[0], cron_arr[1], cron_arr[2], cron_arr[3], cron_arr[4], cron_arr[5])
my_cron.write()
def ping(host):
p = Popen("ping -c 1 " + host, shell=True, stdout=PIPE)
return p.stdout.read()
def tunnel(host, username, key, path, script):
cat = Popen("cat " + SCRIPT_DIR + script, shell=True, close_fds=True, stdout=PIPE)
cmd = "ssh -i " + key + " " + username + "@" + host + " \"cd " + path + " ; exec \$SHELL\""
ssh = Popen(cmd, shell=True, stdin=cat.stdout, stdout=PIPE, stderr=PIPE)
out, err = ssh.communicate()
return out + err
def execute(path, script):
cmd = "cd " + path + " ; exec " + SCRIPT_DIR + script
proc = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
out, err = proc.communicate()
return out + err
def run_scripts(params):
scripts = load(SCRIPT_MAP)
results = OrderedDict()
for key in scripts:
#remove file extensions
new_key = key.split('.')[0]
if params['local'] != 'False':
results[new_key] = tunnel(params['host'], params['username'], params['key'], params['path'], scripts[key])
else:
results[new_key] = execute(params['path'], scripts[key])
return results
def post_results(server_addr, servername, is_up, results):
import requests
session = requests.Session()
payload = {}
payload['up'] = is_up
for key in results:
payload[key] = results[key]
addr = server_addr + '/' + servername
print addr
for key in payload:
print " %-15s %s" % (key, str(payload[key]).replace('\n', '\\n')[:80])
session.post(addr, data=payload)
def main():
args = parser.parse_args()
config_file = ''
if args.config is None:
config_file = DEFAULT_CONFIG
else:
if args.config[0] != '/':
config_file += CUR_DIR
config_file += args.config
if args.init:
init(config_file, args.host, args.cron, args.username, args.key, args.path, args.python, args.monitor, args.servername, args.cron_user)
elif args.set:
set_args(config_file, args.host, args.cron, args.username, args.key, args.path, args.python, args.monitor, args.servername, args.cron_user)
elif args.delete:
params = load(config_file)
delete(params['python'] + ' ' + CMD, params['cron_user'])
elif args.reset:
reset(config_file)
elif args.start:
start(config_file)
else :
params = load(config_file)
results = ''
response = os.system("ping -c 1 " + params['host'])
up = 0
if (response == 0):
up = 1
results = run_scripts(params)
results['ping'] = ping(params['host'])
post_results(params['monitor'], params['servername'], up, results)
if __name__ == "__main__":
main()
revision git_rev.sh
patients count-patients.sh
samples count-samples.sh
uptime uptime.sh
workers workers.sh
#stats bash_stats.sh
algo vidjil-algo-version.sh
#!/bin/bash
cd server/web2py/applications/vidjil/scripts
bash stats.sh
#!/bin/sh
python server/web2py/web2py.py -S vidjil -M -R applications/vidjil/scripts/count-patients.py
#!/bin/sh
python server/web2py/web2py.py -S vidjil -M -R applications/vidjil/scripts/count-samples.py
#!/bin/bash
git rev-parse HEAD
#!/bin/sh
python server/web2py/web2py.py -S vidjil -M -R applications/vidjil/scripts/vidjil-algo-version.py | grep -E "(# version|# git)"
#!/bin/sh
python server/web2py/web2py.py -S vidjil -M -R applications/vidjil/scripts/worker-status.py
* * * * * root /usr/bin/python /opt/reporter/reporter.py >> /var/log/cron.log 2>&1
FROM ubuntu:16.04
ENV container docker
ENV LC_ALL C
ENV DEBIAN_FRONTEND noninteractive
RUN echo 'APT::Install-Recommends "0"; \n\
APT::Get::Assume-Yes "true"; \n\
APT::Get::force-yes "true"; \n\
APT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01buildconfig
RUN mkdir -p /etc/apt/sources.d/
RUN echo "deb mirror://mirrors.ubuntu.com/mirrors.txt vivid main restricted universe multiverse \n\
deb mirror://mirrors.ubuntu.com/mirrors.txt vivid-updates main restricted universe multiverse \n\
deb mirror://mirrors.ubuntu.com/mirrors.txt vivid-backports main restricted universe multiverse \n\
deb mirror://mirrors.ubuntu.com/mirrors.txt vivid-security main restricted universe multiverse" > /etc/apt/sources.d/ubuntu-mirrors.list
RUN apt-get update && apt-get install systemd
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*; \
rm -f /lib/systemd/system/plymouth*; \
rm -f /lib/systemd/system/systemd-update-utmp*;
RUN systemctl set-default multi-user.target
ENV init /lib/systemd/systemd
VOLUME [ "/sys/fs/cgroup" ]
# docker run -it --privileged=true -v /sys/fs/cgroup:/sys/fs/cgroup:ro 444c127c995b /lib/systemd/systemd systemd.unit=emergency.service
ENTRYPOINT ["/lib/systemd/systemd"]
CMD ["systemd.unit=emergency.service"]
from ubuntu_systemd
from ubuntu:16.04
label version="1.0"
label description="An Ubuntu based docker image which comes \
with a full installation of the Vidjil algoright and browser/server."
run apt-get update
run apt-get -y -q install apt-utils sudo curl nginx-full
run echo deb http://apt.vidjil.org:8080/archive sid/all/ >> /etc/apt/sources.list
run echo deb http://apt.vidjil.org:8080/archive sid/amd64/ >> /etc/apt/sources.list
run echo deb http://apt.vidjil.org:8080/archive wheezy/all/ >> /etc/apt/sources.list
run echo deb http://apt.vidjil.org:8080/archive wheezy/amd64/ >> /etc/apt/sources.list
# Install Postfix. Shamelessly stolen from https://github.com/noteed/docker-postfix/blob/master/Dockerfile
run echo "postfix postfix/main_mailer_type string Internet site" > preseed.txt
run echo "postfix postfix/mailname string mail.example.com" >> preseed.txt
# Use Mailbox format.
run debconf-set-selections preseed.txt
run DEBIAN_FRONTEND=noninteractive apt-get install -q -y postfix
run postconf -e myhostname=mail.example.com
run postconf -e mydestination="mail.example.com, example.com, localhost.localdomain, localhost"
run postconf -e mail_spool_directory="/var/spool/mail/"
run postconf -e mailbox_command=""
env GOSU_VERSION 1.7
run set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& apt-get purge -y --auto-remove ca-certificates wget
run echo deb http://rby.vidjil.org:8080/archive sid/all/ >> /etc/apt/sources.list
run echo deb http://rby.vidjil.org:8080/archive sid/amd64/ >> /etc/apt/sources.list
run echo deb http://rby.vidjil.org:8080/archive wheezy/all/ >> /etc/apt/sources.list
run echo deb http://rby.vidjil.org:8080/archive wheezy/amd64/ >> /etc/apt/sources.list
run echo "vidjil-server vidjil/reconfigure-webserver string nginx" > preseed.txt
run echo "vidjil-server vidjil/restart-webserver boolean true" >> preseed.txt
run echo "vidjil-server vidjil/configure-startup string systemd" >> preseed.txt
run echo "vidjil-server vidjil/restart-webserver boolean false" >> preseed.txt
run echo "vidjil-server vidjil/configure-startup string none" >> preseed.txt
run echo "vidjil-server vidjil/start-services boolean false" >> preseed.txt
run echo "vidjil-server vidjil/web2py-password string VidjilAdm1n" >> preseed.txt
run echo "vidjil-server vidjil/ssl-country string AU" >> preseed.txt
......@@ -38,21 +35,26 @@ run echo "vidjil-server vidjil/ssl-name string VidjilTeam" >> preseed.txt
run echo "vidjil-server vidjil/ssl-email string team@vidjil.org" >> preseed.txt
run debconf-set-selections preseed.txt
run echo 91.121.76.104 apt.vidjil.org >> /etc/hosts ;\
gpg --recv-key --keyserver apt.vidjil.org 9187987418E1A625 ;\
apt-get update ;\
DEBIAN_FRONTEND=noninteractive apt-get -y -q --allow-unauthenticated install vidjil-archive-keyring ;\
apt-get update ;\
DEBIAN_FRONTEND=noninteractive apt-get install -y -q --allow-unauthenticated vidjil-server
run gpg --recv-keys --keyserver rby.vidjil.org 9187987418E1A625
run apt-get update ; apt-get install --no-install-recommends --no-install-suggests -y -q sudo curl apt-utils uwsgi-plugin-python nginx-full
run apt-get update ; DEBIAN_FRONTEND=noninteractive apt-get -y -q --allow-unauthenticated install vidjil-archive-keyring
run apt-get update ; DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --no-install-suggests -y -q --allow-unauthenticated vidjil-server
run cd /usr/share/vidjil/germline && make
run cd /usr/share/web2py && chown -R www-data:www-data .
run systemctl enable web2py.scheduler.service fuse.server.service
cmd ["/bin/systemctl", "start", "nginx.service"]
cmd ["/bin/systemctl", "start", "uwsgi.service"]
expose 80
expose 443
cmd ["/usr/sbin/init"]
run ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
copy ./conf/gzip_static.conf /etc/nginx/conf.d/web2py/gzip_static.conf
copy ./conf/gzip.conf /etc/nginx/conf.d/web2py/gzip.conf
copy ./sites/nginx_conf /etc/nginx/sites-enabled/web2py
copy ./sites/nginx_conf /etc/nginx/sites-available/web2py
copy ./conf/uwsgi.ini /etc/uwsgi/apps-enabled/web2py.ini
copy ./conf/defs.py /etc/vidjil/defs.py
copy ./conf/conf.js /etc/vidjil/conf.js
copy ./scripts/nginx-entrypoint.sh /entrypoints/nginx-entrypoint.sh
copy ./scripts/uwsgi-entrypoint.sh /entrypoints/uwsgi-entrypoint.sh
run mkdir /usr/share/vidjil/server/web2py/applications/vidjil/databases && touch /usr/share/vidjil/server/web2py/applications/vidjil/databases/sql.log
run adduser vidjil && usermod -aG sudo vidjil
/*
* Vidjil browser, main configuration file
* This file must be named 'js/conf.js' to be taken into account
* */
var config = {
/* Used for the 'align' script
* If this is not defined, the 'align' button is not available
*/
"cgi_address" : "http://localhost/cgi/", // Public test server
// "cgi_address" : "http://127.0.1.1/cgi-bin/",
/* The following options control how the user may have access to .vidjil files.
* Any combination of 1), 2) and 3) should work
*/
/* 1) Patient database */
"use_database" : true,
"db_address" : "https://localhost/vidjil/", // Public test server
"login" : "",
"password" : "",
/* 2) and 3) Static files
/* - relative paths if Vidjil browser is online on the same server
* - absolute paths to a CORS active server only if browser is offline or on another server
*/
/* 2) Menu with a list of static files */
"file_menu" : {
"path" : "/browser/data/",
"file" : [
"Stanford-S22.vidjil",
"L2-LIL-2.vidjil"
]
},
/* 3) Static file autoload, possibly with an .analysis file */
"autoload" : "data/Stanford-S22.vidjil",
// "autoload_analysis" : "data/Stanford-S22.analysis"
// Proxy config for IMGT querying
"proxy": "http://localhost/proxy"
}
###
### Vidjil server, main configuration file
### This file must be named 'modules/defs.py' to be taken into account
###
### Email notifications for server errors
SMTP_SERVER = 'localhost'
# SMTP_SERVER = 'logging' # no mail
FROM_EMAIL = 'rbx@vidjil.org'
ADMIN_EMAILS = ['notifications@vidjil.org']
### address for the sql database
###
DB_ADDRESS = 'sqlite://storage.sqlite'
DB_ADDRESS = 'mysql://vidjil:rootpass@mysql/vidjil'
### Backup file
DB_BACKUP_FILE = 'backup.csv'
### Upload directory for .fasta/.fastq.
### Old sequences files could be thrown away.
### No regular backup.
DIR_SEQUENCES = '/mnt/upload/uploads/'
### Upload directory for .vidjil/.fused/.analysis
### Regularly backuped
DIR_RESULTS = '/mnt/result/results/'
### Temporary directory to store vidjil results, and basename of files in this directory
### Formatted with 'data_id' in models/task.py
DIR_OUT_VIDJIL_ID = '/mnt/result/tmp/out-%06d/'
DIR_PRE_VIDJIL_ID = '/mnt/result/tmp/pre/out-%06d/'
BASENAME_OUT_VIDJIL_ID = '%06d'
### Directory for program used in task.py
### relative path start from server/web2py
DIR_VIDJIL = '/usr/bin/'
DIR_FUSE = '../../tools'
DIR_MIXCR = '/usr/bin'
DIR_GERMLINE = '/usr/share/vidjil/germline'
### Port on which to run the fuse server
### Used in models/task.py and in /server/fuse_server.py
PORT_FUSE_SERVER = 12789
### Log files
DIR_LOG = '/var/vidjil/'
LOG_INFO = DIR_LOG + 'vidjil.log'
LOG_DEBUG = DIR_LOG + 'vidjil-debug.log'
### Timeouts
# Delay in seconds before a task is considered in timeout
TASK_TIMEOUT = 2 * 60 * 60
### Reverse IP file
REVERSE_IP = '/home/vidjil/ips.txt'
### Locus (should be parsed from germlines.data)
LOCUS = ['TRA', 'TRA+D', 'TRB', 'TRG', 'TRD', 'TRD+',
'IGH', 'IGH+', 'IGK', 'IGK+', 'IGL']
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_static on;
gzip_http_version 1.1;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
[uwsgi]
socket = 0.0.0.0:8000
pythonpath = /usr/share/vidjil/server/web2py/
mount = /=wsgihandler:application
processes = 4
master = true
harakiri = 1200
reload-mercy = 8
cpu-affinity = 1
stats = /tmp/stats.socket
max-requests = 2000
limit-as = 512
reload-on-as = 256
reload-on-rss = 192
touch-reload = /usr/share/vidjil/server/web2py/applications/vidjil/modules/defs.py
uid = www-data
gid = www-data
cron = 0 0 -1 -1 -1 python /usr/share/vidjil/server/web2py/web2py.py -Q -S welcome -M -R scripts/sessions2trash.py -A -o
no-orphans = true
ignore-sigpipe = true
enable-threads = true
plugin = python
#!/bin/bash
# sed cannot redirect output to the input file so rename the file and sed into the final desired name
mv /etc/vidjil/conf.js /etc/vidjil/tmp
sed s/#{my_url}/$UWSGI_PORT_433_TCP_ADDR/g /etc/vidjil/tmp > /etc/vidjil/conf.js
rm /etc/vidjil/tmp
ln -sf /etc/vidjil/conf.js /usr/share/vidjil/browser/js/conf.js
nginx -g "daemon off;"
#!/bin/bash
chown -R www-data:www-data /mnt/results
chown -R www-data:www-data /mnt/uploads
/usr/local/bin/gosu www-data /usr/bin/uwsgi --ini /etc/uwsgi/apps-enabled/web2py.ini
upstream uwsgi {
server uwsgi:8000;
}
server {
listen 443 default_server ssl;
server_name $hostname;
ssl_certificate /etc/nginx/ssl/web2py.crt;
ssl_certificate_key /etc/nginx/ssl/web2py.key;