Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOTECH-2121: Creates a MOTECH docker image built using the DEB #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions motech-centos/README
Original file line number Diff line number Diff line change
Expand Up @@ -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

31 changes: 31 additions & 0 deletions motech-deb/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't installing motech install java as dependency, just wondering if we need these steps?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Motech (from version 0.28) needs Java 8. In deb packaging there is hardcoded path to java-8-oracle. So we need exactly this java. To install java-8-oracle on ubuntu we need all these steps. I checked it one more time to be sure.

Currently there is a problem with deb packaging on the latest master. I will create a ticket for it. However this docker container should work correctly with other motech versions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked into this - we should update the JDK list in the daemon script. We cannot use Java 7 after version 0.28.X


#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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason for exposing the ActiveMQ port?

EXPOSE 8080

ADD run.sh /run.sh
RUN chmod a+x /run.sh

CMD ["/run.sh"]

16 changes: 16 additions & 0 deletions motech-deb/README
Original file line number Diff line number Diff line change
@@ -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

21 changes: 21 additions & 0 deletions motech-deb/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Run activemq
sudo ln -s /etc/activemq/instances-available/main /etc/activemq/instances-enabled/main
sed -e 's/<broker /<broker schedulerSupport="true" /' -i /etc/activemq/instances-enabled/main/activemq.xml
service activemq start

# Run mysql
service mysql start
# Set password = 'password' for root
mysql -uroot -e "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'"
mysql -uroot -e "FLUSH PRIVILEGES"

# Start motech service
service motech start

# The container will run as long as the script is running, that's why
# we need something long-lived here
exec tail -f /usr/share/motech/logs/catalina.out