Production¶
We use different tools and setup for production. We do not fully provide this part with the template. Why?
It requires a lot of server configuration
It heavily depends on your needs: performance, price, technology, etc
It is possible to show some vulnerable parts to possible attackers
So, you will need to deploy your application by yourself. Here, we would like to cover some basic things that are not changed from deployment strategy.
The easiest deployment strategy for small apps is docker-compose
and
systemd
inside a host operating system.
Production configuration¶
You will need to specify extra configuration
to run docker-compose
in production.
Since production build also uses caddy
,
which is not required into the development build.
docker compose -f docker-compose.yml -f docker/docker-compose.prod.yml up
Pulling pre-built images¶
You will need to pull pre-built images from Gitlab
to run them.
How to do that?
The first step is to create a personal access token for this service. Then, login into your registry with:
docker login registry.gitlab.your.domain
And now you are ready to pull your images:
docker pull your-image:latest
See official Gitlab docs.
Updating already running service¶
If you need to update an already running service,
them you will have to use docker service update
or docker stack deploy
.
Updating existing service. Updating existing stack.
Zero-Time Updates¶
Zero-Time Updates can be tricky. You need to create containers with the new code, update existing services, wait for the working sessions to be completed, and to shut down old containers.
Further reading¶
Production with docker compose