Clone wiki

MobileCoach documentation / Setting-up-the-server-with-docker

Setting up the server with Docker


  • Install docker on the server. A free Community Edition (CE) is sufficient.
  • A standalone SSL certificate to be used with tomcat and deepstream.
  • Open ports for the tomcat and deepstream to listen. Preferably 80 and 443 open for tomcat where connections to 80 can be forwarded to 443. Alternatively, any single port can also be configured for tomcat. Another port (preferably 6020) open for deepstream.
  • For Linux machines, make sure that Docker runs as a service. You might need sudo access to connect to the Docker daemon.

Docker-compose configuration

Version 1.0

  • Get the docker-compose.yml, server.xml, config.yml and files for the required version from this link.
  • There are three services/containers each running Mongo database, Tomcat, and Deepstream servers.
  • Create a directory mobilecoach, where all the mobilecoach data is stored and configuration files can be put. Put the docker-compose.yml file in this folder.
  • We can choose a directory of our choice and mount it into a Docker container. In line number 9 of the docker-compose.yml file as shown below the directory ./mc_global/mongo_data is mounted into the container where the mongo database (/data/db) is stored. In the mobilecoach folder, create directory mc_global and another directory mongo_data inside mc_global. Alternatively, you can use any other folder to store the mongo data, but make sure to mount it by putting the corresponding path in the docker compose file by replacing ./mc_global/mongo_data.
8     volumes:
9       - ./mc_global/mongo_data:/data/db
10    restart: always
  • In the mobilecoach/mc_global folder, create a directory mc_data to store the mobilecoach data. Put the file into it. Alternatively, you can use any other folder to store the mobilecoach data, but make sure to add file and then mount it by putting the corresponding path in the docker compose file by replacing ./mc_global/mc_data (line 21 as shown below).
20  volumes:
21    - ./mc_global/mc_data:/mc_data
22    - ./certs/keystore_demo:/keystore_dem
23    - ./tomcat/conf/server.xml:/usr/local/tomcat/conf/server.xml
  • As shown in line 23, add server.xml in a folder ./tomcat/conf/ or into a folder of your choice and mount it to /usr/local/tomcat/conf/server.xml in the Docker container. In line 22 as shown above, keystore_demo is the keystore file which helps to connect to the server with SSL. Configure server.xml to use the opened ports and to use the keystore file mapped into the container. In the server.xml file provided, /keystore_demo is inside the container where the keystore file is located and we use standard 443 port to listen for the incoming connections.

  • In line 33 of docker-compose.yml as shown below, mount config.yml into the deepstream container by putting it into a folder mobilecoach/deepstream.

32   volumes:
33      - ./deepstream/config.yml:/etc/deepstream/config.yml
34      - ./letsencrypt/config/live/
35      - ./letsencrypt/config/live/
36      - ./letsencrypt/config/live/
  • In the config.yml configure SSL by providing the proper paths /etc/deepstream/certs/ inside the container. Lines 34-36 in the docker-compose.yml file shows how these files are mounted from the host into the container. In authentication portion of the config.yml, please change the hostname inside endpointUrl from to your server. It helps deepstream connect with the tomcat server.

  • On the left-hand side of the ":", line numbers 15, 16 and 29 of the docker-compose.yml, the ports can be set. By default, the tomcat listens to 80 and 443 and deepstream to 6020.

15   - "80:80"
16   - "443:443"
29   - "6020:6020"

MobileCoach webApp configuration

  • File is used to configure tomcat connections and the MobileCoach webApp.
  • Make sure that databaseHost and databasePort is set correctly to mongodbservice and 27017. mongodbservice is the hostname of the Mongo container which listens on port 27017. Note that mongodbservice is also the name of the service described in the docker-compose.yml file.
  • In the option deepstreamHost change the hostname from to the hostname of your server. Do change the port if deepstream is not listening at 6020.
  • The default admin username and password are admin and admin respectively for the webApp.

Starting the server

  • In the folder mobilecoach, run sudo docker-compose up -d. When run for the first time, it might take some time based on your internet connection for the docker images to get downloaded and the containers to start.
  • You can stop the containers using sudo docker-compose stop and start the stopped containers with sudo docker-compose start. To restart the containers use sudo docker-compose restart.
  • You can stop and delete the Docker containers using sudo docker-compose down. Use it only for testing. The command will remove everything except the mongo database. When sudo docker-compose up -d is run again the server can start and load the database but the previous logs from each container would be lost.
  • You can open the webApp at https:<ip_add/hostname>/MC/admin. The username and password are from the file.