Skip to content

ubdsgroup/outsteprepo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Setting up docker containers for the OUTSTEP web application

Setting up mysql docker container with persistent storage

First change to the mysql directory:

cd mysql/

To allow for the databases to persist in the image, we use the following Dockerfile:

FROM mysql:latest
RUN cp -r /var/lib/mysql /var/lib/mysql-no-volume
CMD ["--datadir", "/var/lib/mysql-no-volume"]

Next, build and run,

docker build . -t o-mysql
docker run -p 3306:3306 \
       --name <db-container-name> \
       -e MYSQL_ROOT_PASSWORD=<root_password> \
       -e MYSQL_USER=<username> \
       -e MYSQL_PASSWORD=<password> \
       -ti o-mysql

Note that in some systems you might have to use sudo docker instead of docker.

You can given any tag to the image instead of o-mysql.

Setting up database

Use the create and populate scripts.

docker exec -it <db-container-name> mysql -uroot -p -e "$(cat createdb.sql)"

Populating data

docker exec -it <db-container-name> mysql -u<username> -p -e "$(cat popualtedb.sql)"

Running the node.js server

From the repository root, change to the nodejs directory:

cd nodejs/

Build and run the docker image,

docker build -t o-nodejs .
docker run -p 8080:8080 -d o-nodejs

Again, you can give any name to the image that is built here.

Building the rocket.chat app

From the repository root, change to the rocketchat directory:

cd rocketchat/

We will be using the docket-compose.yml file (you can modify some of the option, if needed). In particular, you need to replace the ROOT_URL field with the appropriate URL.

Also, we are going to use the /data and /uploads directory on the host to store the data. Make sure that those directories exist and have the correct permissions.

docker-compose up -d mongo
docker-compose up -d mongo-init-replica
docker-compose up -d rocketchat

After setting up the application by visiting the URL on a browser, you can create a bot to talk to. Edit the file docker-compose.yml again to change the variables ROCKETCHAT_USER and ROCKETCHAT_PASSWORD in the hubot section and then start up hubot:

docker-compose up -d hubot

More details are available here.