January 2019
Intermediate to advanced
520 pages
14h 32m
English
Our application needs a database instance. Both user and content microservices use the PostgreSQL database, and the dbsync worker applies all migrations if necessary. Look at these settings:
db: image: postgres:latest restart: always environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=password ports: - 5432:5432
We use the official PostgreSQL image. If the database fails, it will have to be restarted. We set the restart policy to always, which means the container will be restarted if it fails. We also set the user and password with environment variables.
Since we created a compose file for testing purposes, we forward a port of the container outside to connect to the database using the local client.
Read now
Unlock full access