Answer the question
In order to leave comments, you need to log in
How to organize the structure and deployment of a project with docker?
So, I made a dockerfile, threw a django project into it, launched it, debugged it and have a server with ssh access. How can I push my project to this server? How then to make changes in the code?
The project needs a database (where without it). According to the rules of good manners in docker, one more container is needed under the database. How to implement their connection or how to do better?
Thanks
Answer the question
In order to leave comments, you need to log in
How can I push my project to this server?
Here is a good article https://habrahabr.ru/post/272811/ that will answer many of your questions
I made it a little easier (with fewer manual steps).
We have:
- c#
- Stateless applications
- a server with mongodb (it is not allowed to be taken to the docker).
- TeamCity.
What I did:
- I assembled a build agent under mono in a docker container, threw the host docker there.
- Build a basic runtime container with mono.
- I set up the build through the agent build from step 1, while the teamcity itself generates a Dockerfile (for c # they are typical).
- Raised a private docker registry.
- after that teamcity does docker tag, docker push to private repository.
- there is a watchtower on the machines of the cluster, which updates and restarts the containers when an update appears (but I do the first launch of a new service manually).
- in the projects themselves, in the git, I store compose files with links to other services\containers\env (there is still no great understanding with them - how and where to properly deploy them, where to store them - while lying around in /home/ on each machine in the cluster).
How can I push my project to this server?
Do not start, but connect the folder from the host where the code is located.
How then to make changes in the code?
In the editor.
How to implement their connection or how to do better?
Use docker-compose.
Here I posted an example of deployment using ansible for docker and rails in capistrano style, but you can tweak the playbooks for yourself https://github.com/weazar/andora
I made two different docker files for myself - one for production, one for development. Their difference is that in the production version, in addition to setting up the environment, it also downloads (git clone) and deploys the application itself. And in the development version, the external directory with the code is mounted so that the life of the code does not depend on the life of the container.
It is better to organize the database in a separate container, with linking to the container with the application (linking is very well described in the documentation).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question