From fe02065022e28ff626349cc195d37da7d798b09c Mon Sep 17 00:00:00 2001 From: kmadej Date: Fri, 4 Mar 2016 18:17:34 +0100 Subject: [PATCH 1/3] MOTECH-2121: Creates a MOTECH docker image built using the DEB All needed information about this PR you can find in the 'README' file. Moreover I corrected misspelling in 'README' file in motech-centos. --- motech-centos/README | 11 ++++++----- motech-deb/Dockerfile | 31 +++++++++++++++++++++++++++++++ motech-deb/README | 16 ++++++++++++++++ motech-deb/run.sh | 21 +++++++++++++++++++++ 4 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 motech-deb/Dockerfile create mode 100644 motech-deb/README create mode 100644 motech-deb/run.sh diff --git a/motech-centos/README b/motech-centos/README index 0f4d7ab..062d2ab 100644 --- a/motech-centos/README +++ b/motech-centos/README @@ -4,13 +4,14 @@ 2. Copy to destination folder with Dockerfile and run.sh script: * /motech/packaging/rpm/target/rpm/motech-base/RPMS/noarch/*.rpm (rename on motech-base.rpm) * /motech/target/rpm/motech/RPMS/noarch/*.rpm (rename on motech.rpm) -3. sudo docker build -t motech/motech:centos ./detination_folder +3. sudo docker build -t motech/motech:centos ./destination_folder #Starting motech from motech-centos image 4. Run image (sudo docker run -d motech/motech:centos) -5. If rpm's were correct you should have bootstrap motech on (IP from point 6) ip:8080 -6. Use suggestions for inputs -7. SQL Username: mysql SQL Password: password -8. Verify and start motech +5. Check container's IP (ifconfig) +6. If rpm's were correct you should have bootstrap motech on (IP from point 5) ip:8080 +7. Use suggestions for inputs +8. SQL Username: mysql SQL Password: password +9. Verify and start motech diff --git a/motech-deb/Dockerfile b/motech-deb/Dockerfile new file mode 100644 index 0000000..6fe00f2 --- /dev/null +++ b/motech-deb/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:latest + +RUN apt-get update + +#Install Java 8 +RUN apt-get install software-properties-common -y +RUN add-apt-repository ppa:webupd8team/java +RUN apt-get update +# Set some vars so the oracle installer doesn't ask us to accept the license +RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections +RUN echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections +RUN apt-get install -y oracle-java8-installer + +#Install tomcat, activemq, mysql, curl +RUN apt-get install tomcat7 -y +RUN apt-get install -y activemq mysql-server curl + +#Install motech DEB +ADD /motech-base.deb /motech-base.deb +RUN dpkg -i motech-base.deb +ADD /motech.deb /motech.deb +RUN dpkg -i motech.deb + +EXPOSE 61616 8161 +EXPOSE 8080 + +ADD run.sh /run.sh +RUN chmod a+x /run.sh + +CMD ["/run.sh"] + diff --git a/motech-deb/README b/motech-deb/README new file mode 100644 index 0000000..f0f9ec3 --- /dev/null +++ b/motech-deb/README @@ -0,0 +1,16 @@ +#Building motech-deb image based on deb. + +1. Install docker-machine : https://docs.docker.com/engine/installation/linux/ubuntulinux/ +2. Copy to destination folder with Dockerfile and run.sh script: +* /motech/packaging/deb/target/motech-base_xxx.deb (rename on motech-base.deb) +* /motech/packaging/deb/target/motech_xxx.deb (rename on motech.deb) +3. sudo docker build -t motech/motech:deb ./destination_folder + +#Starting motech from motech-deb image + +4. Run image (sudo docker run -d motech/motech:deb) +5. Check container's IP (ifconfig) +6. If container is running properly, motech instance will be available on ip:8080 (IP from point 5) +7. SQL Username: root, SQL Password: password +8. Verify and start motech + diff --git a/motech-deb/run.sh b/motech-deb/run.sh new file mode 100644 index 0000000..3356677 --- /dev/null +++ b/motech-deb/run.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Run activemq +sudo ln -s /etc/activemq/instances-available/main /etc/activemq/instances-enabled/main +sed -e 's/ Date: Wed, 16 Mar 2016 11:18:13 +0100 Subject: [PATCH 2/3] MOTECH-2121: Removed exposing ActiveMQ port --- motech-deb/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/motech-deb/Dockerfile b/motech-deb/Dockerfile index 6fe00f2..0cb9558 100644 --- a/motech-deb/Dockerfile +++ b/motech-deb/Dockerfile @@ -21,7 +21,6 @@ RUN dpkg -i motech-base.deb ADD /motech.deb /motech.deb RUN dpkg -i motech.deb -EXPOSE 61616 8161 EXPOSE 8080 ADD run.sh /run.sh From f75838e0ed8eab002087fdd77e5794db97a7eaae Mon Sep 17 00:00:00 2001 From: kmadej Date: Tue, 26 Apr 2016 13:13:00 +0200 Subject: [PATCH 3/3] MOTECH-2121: The package installs dependencies I used ubuntu 15.04 version and now java8 can be easily installed as a package dependency. The gdebi installs package dependencies (ActiveMQ, tomcat, etc.). --- motech-deb/Dockerfile | 25 ++++++++++--------------- motech-deb/run.sh | 5 +---- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/motech-deb/Dockerfile b/motech-deb/Dockerfile index 0cb9558..3f429c0 100644 --- a/motech-deb/Dockerfile +++ b/motech-deb/Dockerfile @@ -1,25 +1,20 @@ -FROM ubuntu:latest +FROM ubuntu:15.04 RUN apt-get update -#Install Java 8 -RUN apt-get install software-properties-common -y -RUN add-apt-repository ppa:webupd8team/java -RUN apt-get update -# Set some vars so the oracle installer doesn't ask us to accept the license -RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections -RUN echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections -RUN apt-get install -y oracle-java8-installer +#Install simple tool for installing deb files +RUN apt-get install gdebi-core -y -#Install tomcat, activemq, mysql, curl -RUN apt-get install tomcat7 -y -RUN apt-get install -y activemq mysql-server curl +#Install mysql-server and set password to 'password' +RUN echo "mysql-server mysql-server/root_password password password" | debconf-set-selections +RUN echo "mysql-server mysql-server/root_password_again password password" | debconf-set-selections +RUN apt-get install -y mysql-server -#Install motech DEB +#Install motech DEB with dependencies ADD /motech-base.deb /motech-base.deb -RUN dpkg -i motech-base.deb +RUN gdebi --non-interactive motech-base.deb ADD /motech.deb /motech.deb -RUN dpkg -i motech.deb +RUN gdebi --non-interactive motech.deb EXPOSE 8080 diff --git a/motech-deb/run.sh b/motech-deb/run.sh index 3356677..ed7f0f1 100644 --- a/motech-deb/run.sh +++ b/motech-deb/run.sh @@ -1,15 +1,12 @@ #!/bin/bash # Run activemq -sudo ln -s /etc/activemq/instances-available/main /etc/activemq/instances-enabled/main +ln -s /etc/activemq/instances-available/main /etc/activemq/instances-enabled/main sed -e 's/