snippetdockerMinor
How to structure DevOps related code and configs in a code repository?
Viewed 0 times
relatedandconfigsstructurerepositoryhowcodedevops
Problem
We've been growing as a company, our products are expanding and our DevOps related activities and efforts are growing as well - we've switched from Bamboo to a more flexible and configurable Jenkins, using deployment pipelines and other plugins; switched to Ansible and starting to use Docker here and there internally.
All of these things require some level of coding or configuration - Ansible scripts and configs, Jenkins groovy scripts, Dockerfiles and YAML configs.
For now, we've created a separate "ops" repository with high-level directories for
Our approach does not feel right and might not scale, but what are the best practices and recommendations to keep DevOps-related code in a code repository or repositories?
All of these things require some level of coding or configuration - Ansible scripts and configs, Jenkins groovy scripts, Dockerfiles and YAML configs.
For now, we've created a separate "ops" repository with high-level directories for
jenkins, ansible, docker and other (which is a terrible name, but for now all "other" DevOps automation things are there).Our approach does not feel right and might not scale, but what are the best practices and recommendations to keep DevOps-related code in a code repository or repositories?
Solution
I can answer bout docker, one of the best practice to use docker is to keep the docker file and the compose files in the same repository of the project, so wherever you clone the project you can build the docker image, and it is good to keep multiple versions of docker compose files for example (prod, staging, dev) so you can build the image and run the container with specific option for each env for example for dev machine you can use specific network and run more dependencies container or whatever.
Context
StackExchange DevOps Q#1840, answer score: 6
Revisions (0)
No revisions yet.