diff --git a/Docker/.bashrc b/Docker/.bashrc new file mode 100755 index 0000000000000000000000000000000000000000..ca09714092de77eb651b75c854b52b4f215e26a8 --- /dev/null +++ b/Docker/.bashrc @@ -0,0 +1,16 @@ +alias l='ls -al --color' +if test -z "$DISPLAY" -a "$TERM" = "xterm" -a -x /usr/bin/who ; then + WHOAMI="`/usr/bin/who am i`" + _DISPLAY="`expr "$WHOAMI" : '.*(\([^\.][^\.]*\).*)'`:0.0" + if [ "${_DISPLAY}" != ":0:0.0" -a "${_DISPLAY}" != " :0.0" \ + -a "${_DISPLAY}" != ":0.0" ]; then + export DISPLAY="${_DISPLAY}"; + fi + unset WHOAMI _DISPLAY +fi +export PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] " +cd ~ + + +supervisord -c /etc/supervisor/conf.d/supervisord.conf + diff --git a/Docker/Dockerfile b/Docker/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4cfae15c6f7834c910b4ff29f530c7431777cca8 --- /dev/null +++ b/Docker/Dockerfile @@ -0,0 +1,63 @@ +#Docker description file for minerva framework. +FROM debian:jessie + +MAINTAINER Piotr Gawron <piotr.gawron@uni.lu> + +#setup non interactive install in apt-get +ENV DEBIAN_FRONTEND noninteractive + +#installation of needed packages + +#Some basic tools (optionally) +RUN apt-get update +RUN apt-get install -y apt-utils w3m +RUN apt-get install -y telnet +RUN apt-get install -y vim +RUN apt-get install -y procps +RUN apt-get install -y wget + +#Minerva repo is via ssl +RUN apt-get install -y apt-transport-https + +RUN apt-get install -y supervisor +RUN mkdir -p /var/log/supervisor + +#Java 8 repository +RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list +RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 +RUN apt-get update + +#Make sure that installer won't ask for accepting license +RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections + +#Minerva uni.lu repository +RUN echo "deb http://repo-r3lab.uni.lu/debian/ stable main" | tee /etc/apt/sources.list.d/r3lab-uni.list +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xcb185f4e31872412 +RUN apt-get update + +#install dependencies separatelly (usefull when we change something - then we don't have to do everything from scratch) +RUN apt-get install -y tomcat7 && /etc/init.d/tomcat7 stop +RUN apt-get install -y postgresql +RUN apt-get install -y oracle-java8-set-default + +ADD policy-rc.d /tmp/policy-rc.d + +RUN apt-get update + + +#when we install minerva allow to start services, so everything can be installed properly +#but we need to disable tomcat7 because tomcat7 requires SYS_PTRACE and we cannot start it: +#take a look here: +#http://stackoverflow.com/questions/29683231/tomcat7-fail-to-start-inside-ubuntu-docker-container + +RUN mv /usr/sbin/policy-rc.d /usr/sbin/policy-rc.d.backup && \ + mv /tmp/policy-rc.d /usr/sbin/policy-rc.d && \ + apt-get install -y minerva && \ + mv /usr/sbin/policy-rc.d.backup /usr/sbin/policy-rc.d + +EXPOSE 8080 + +ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf +ADD .bashrc /root/ + diff --git a/Docker/build.sh b/Docker/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..241f5029836d96d02f0eff42597d71d9e9e009bb --- /dev/null +++ b/Docker/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +#docker build --no-cache -t minerva . +docker build -t minerva . +docker run -p 8080:8080 -t -i minerva bash diff --git a/Docker/policy-rc.d b/Docker/policy-rc.d new file mode 100755 index 0000000000000000000000000000000000000000..319de32fd8336e398fe58d8eed8c3e88857cd698 --- /dev/null +++ b/Docker/policy-rc.d @@ -0,0 +1,15 @@ +#!/bin/sh + +# For most Docker users, "apt-get install" only happens during "docker build", +# where starting services doesn't work and often fails in humorous ways. This +# prevents those failures by stopping the services from attempting to start. + +echo "policy-rc.d for " $1 + +if [ "$1" = "tomcat7" ] || [ "$1" = "tomcat8" ]; +then + exit 101 +fi + +exit 0; + diff --git a/Docker/supervisord.conf b/Docker/supervisord.conf new file mode 100644 index 0000000000000000000000000000000000000000..ccde6477fc87fe055b5784659ac68e90be607973 --- /dev/null +++ b/Docker/supervisord.conf @@ -0,0 +1,15 @@ +[supervisord] +nodaemon=false +logfile=/var/log/supervisor/supervisor.log + +[program:postgresql] +command=/etc/init.d/postgresql start +stdout_logfile=/var/log/supervisor/%(program_name)s.log +stderr_logfile=/var/log/supervisor/%(program_name)s.log + +[program:tomcat] +command=/etc/init.d/tomcat7 start +stdout_logfile=/var/log/supervisor/%(program_name)s.log +stderr_logfile=/var/log/supervisor/%(program_name)s.log +autorestart=false +startretries=0