Commit cd5aa26b authored by HERBERT Ryan's avatar HERBERT Ryan Committed by Mathieu Giraud

Adding dockerfiles and docker documentation

parent fdf10a81
......@@ -469,3 +469,63 @@ make functional
You're done! You can now install the debian package with:
$ sudo dpkg -i path/to/package
* Docker
** Building the necessary images
The vidjil docker image is built on an Ubuntu image equipped with systemd.
This is a custom image for which the Dockerfile can be found in
docker/ubuntu_systemd.
In order to build the vidjil_ubuntu image, simply run
$ docker build -t ubuntu_systemd .
from the ubuntu_systemd directory. And then
$ docker build -t vidjil_ubuntu .
** Starting a Vidjil docker environment
Traditionnally the Vidjil Team uses a MySQL database to store user data,
so in this guide we will cover setting up a MySQL Docker alongside the Vidjil Docker.
Start the mysql container. If the tagged version is not available locally it will be pulled automatically:
$ docker run --name <mysql-name> -e MYSQL_ROOT_PASSWORD=<my-secret-pw> -d mysql/mysql-server:<tag>
Get the container's ip address:
$ docker inspect <mysql-name> | grep -i ip
Setup the vidjil databse:
$ mysql -h <container-ip> -u root -p
$ create database <vidjil-database>;
$ create user <vidjil-user>;
$ grant all on <vidjil-database>.* to '<vidjil-user>'@'%';
$ set password for '<vidjil-user>'@'%' = PASSWORD('<vidjil-user-password>');
Exit the MySQL interface and edit your local defs.py file to match the newly created database:
$ DB_ADDRESS = 'mysql://<vidjil-user>:<vidjil-user-password>@<mysql-conainer-ip>/<vidjil-database>'
Start the vidjil Docker:
$ docker run --name <vidjil-container-name>\
--link <mysql-name>:mysql\
--privileged\
-d\
-v /sys/fs/cgroup:/sys/fs/cgroup:ro\
-v <path-to-defs>:/etc/vidjil/defs.py\
-p 80:80\
-p 443:443\
vidjil_ubuntu
Make sure it works:
$ curl http://localhost/browser
$ curl https://localhost/vidjil
** Configuring the Vidjil container
Should you wish to further customise your vidjil environment, most configuration files are located in /etc/vidjil/.
Here is a list of thos files:
apache_web2py configuration required when running vidjil with apache2
conf.js contains various variables for the vidjil browser
defs.py contains various variables for the vidjil server
nginx_gzip.conf configuration for gzip in nginx
nginx_gzip_static.conf same as the previous but for static ressources
nginx_web2py configuration required when running vidjil with nginx
systemd_fuse_server.service systemd service that starts the vidjil fuse server
systemd_web2py_scheduler.service systemd service that starts the vidjil scheduler workers
uwsgi.ini configuration required to run vidjil with uwsgi
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
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=""
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/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
run echo "vidjil-server vidjil/ssl-state string Some-State" >> preseed.txt
run echo "vidjil-server vidjil/ssl-locality string Some-Locality" >> preseed.txt
run echo "vidjil-server vidjil/ssl-organisation string Internet Widgits Pty Ltd" >> preseed.txt
run echo "vidjil-server vidjil/ssl-section string Some-Section" >> preseed.txt
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 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"]
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