The users microservice is built from the Dockerfile we created before. This microservice depends on two other containers—dbsync and mails. First, we need to have a table of users in the database to keep user records in; secondly, we need to have the ability to send email notifications to a user. We also set the address of the socket in the USERS_ADDRESS variable and the link for the connection in the USERS_DATABASE variable:
users:
build: ./microservices/users
environment:
- RUST_LOG=users_microservice=debug
- RUST_BACKTRACE=1
- USERS_ADDRESS=0.0.0.0:8000
- USERS_DATABASE=postgresql://postgres:password@db:5432
depends_on:
- dbsync
- mails
ports:
- 8001:8000
Also, there is a setting to forward port 8000 of the container to the local port, 8001, which you can use to access the microservice for testing.