E
E
Evgeny Svirsky2016-09-29 12:19:57
System administration
Evgeny Svirsky, 2016-09-29 12:19:57

How to set up Docker for deployment?

Hello.
Tell me how to set up Docker for deployment.
There is a server on Linux - RedHat, a repository on github with a PHP project on Symfony.
I want to set up a deployment using docker. Containers - nginx, phpfpm, mysql, redis.
Explain plz briefly in 2 words architecture. What will be where to throw. Do you need jenkins, or can you do without it.
Links with similar cases are welcome.
UPD:
Where to store deployment scripts? In the project folder? Or is it better to put it in a separate turnip ...
How does it all work? Describe the process in words.
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Grachev, 2016-10-06
@e_svirsky

I have the following diagram.
In the repository, the project at the root is a Dockerfile, which can build both the prod and the dev version of the container.
For each service, there are separate repositories in the git. For example, nginx has a Dockerfile turnip, in which, in fact, one command is to copy the config.
Redis works for me with default configs, so there is no turnip for it.
Also, each turnip contains a config for Drone , which, when commits are sent, starts the assembly, testing and subsequent deployment to the production server.
Deploying containers on the server is now being handled by Rancher . But in the near future I plan to switch to Docker Swarm.
Assembly configs are in the git, except for the parameters.
I pass the parameters for Symfony through the environment when starting the containers.
The parameters for the build are encrypted in the .drone.sec file. But in version 0.5 they will be immediately on the server.
I don’t use Docker-compose for sales, the environment is raised through it exclusively for the dev version.
It is not recommended to transfer folders from the host machine, therefore, for persistent data, you need to create a volume and transfer them.
With this scheme, I do not go to the server at all. I made a push, the code was tested and deployed.
Examples of my configs: Dockerfile , drone.yml

E
Evgeny Vlasenko, 2016-10-06
@mahnunchik

In addition to the above, you can go to GitLab and run deployment scripts as GitLab CI tasks. You can also use the GitLab Container Registry, but that's out of scope for your question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question