Running the application

To run the application, we will use the Docker Compose tool, which has to be installed (you can find useful links in the Technical Requirements section of this chapter). If the utility installed successfully, you'll have the docker-compose command. Change the directory to a directory called docker-compose.test.yml and run the up subcommand:

docker-compose -f docker-compose.test.yml up

Thus, it will build all the images if necessary and start the application:

Creating network "deploy_default" with the default driver
Creating deploy_smtp_1 ... done
Creating deploy_db_1 ... done
Creating deploy_mails_1 ... done
Creating deploy_dbsync_1 ... done
Creating deploy_users_1 ... done
Creating deploy_content_1 ... done
Creating deploy_router_1 ... done
Attaching to deploy_smtp_1, deploy_db_1, deploy_mails_1, deploy_dbsync_1, deploy_content_1, deploy_users_1, deploy_router_1

When all the containers are started, you will see the logs of all the containers in the terminal, prefixed by the name of the container:

smtp_1     | Setting configuration option smtp_sasl_password_maps with value: hash:\/etc\/postfix\/sasl_passwd
mails_1 | [2018-12-24T19:08:20Z DEBUG mails_microservice] Waiting for SMTP server
smtp_1 | Setting configuration option smtp_sasl_security_options with value: noanonymous
dbsync_1 | [2018-12-24T19:08:20Z DEBUG dbsync_worker] Waiting for database...
db_1 |
db_1 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
mails_1 | [2018-12-24T19:08:20Z DEBUG mails_microservice] SMTP connected
smtp_1 | Adding SASL authentication configuration
mails_1 | Listening on http://0.0.0.0:8000
mails_1 | Ctrl-C to shutdown server
content_1 | Configured for development.
router_1 | DEBUG 2018-12-24T19:08:22Z: router_microservice: Started http server: 0.0.0.0:8000
content_1 | Rocket has launched from http://0.0.0.0:8000
users_1 | [2018-12-24T19:08:24Z DEBUG users_microservice] Starting microservice...

Now the application is started and you can connect to it with the browser using this link: http://localhost:8000.

To stop the application, use the Ctrl+C key combination. That will start the termination process and you will see it reflected in the Terminal:

Gracefully stopping... (press Ctrl+C again to force)
Stopping deploy_router_1 ... done
Stopping deploy_users_1 ... done
Stopping deploy_content_1 ... done
Stopping deploy_mails_1 ... done
Stopping deploy_db_1 ... done
Stopping deploy_smtp_1 ... do

If you restart the application, the database will be empty. Why? Because we stored the database on a temporary filesystem of the container. If you need persistence, you can attach a local folder to the container as a virtual volume. Let's explore this feature.