This section contains the deployment instructions for the microservices.
The microservice should be working in the deployment if the src
folder contains the project, and the app.py
file isn't modified too much.
You can change those files to fit your project, but take in account the Docker files might need to be modified.
The microservices are deployed using Docker. The Dockerfile
is used to build the image (reference) and then deploy it.
This file is used to deploy the microservices. It uses the Dockerfile
to build the image and then deploys it along with a PostgreSQL database.
This should be used along the environment variables file .env
which contains the environment variables for the microservices.
- Change directory into
docker
folder. - Build the images. e.g.
docker-compose up --build --remove-orphans
- Deploy! e.g.
docker-compose up -d
.
Take in account an .dockerignore
file could exist to avoid copying unnecessary files to the image.
If you want to deploy the microservices on a server without uploading the project, you will need to save the images and upload them to the server.
- Build the images that will be deployed with
docker-compose --build
docker save
the image that is generated. e.g.docker save myprojectname:latest | gzip > myprojectname.tar.gz
-
This command only works in Linux or in WSL.
-
- Upload the
tar.gz
files to the server and thedocker-compose.yml
. docker load
the images. e.g.docker load -i myprojectname.tar.gz
- Run Docker-Compose to deploy. e.g.
docker-compose up -d