I'm currently running a backend in production and want to change our current setup to use Docker for deployment and a CI tool for testing.
Right now I have a BitBucket repository with the two main branches "develop" and "master", and two separate servers for development and production that pull the code from the respective branches via a shell script that I trigger locally. This way I test changes manually in a completely isolated environment with a dev server and dev database before merging to master and deploying to production.
git Repository dev-server prod-server | +----------+ +----------+ |-- develop | | | | |-- master | pulls | | pulls | | develop | | master | | | | | +----------+ +----------+
I want to change this by writing tests and use Docker and a CI tool like Drone (it's a Go backend) or Jenkins but I have no idea how this all plays together. I already read quite a lot about Docker and most tutorials assume you develop locally and then deploy the container directly to a production server. Also I guess the CI tool should be located on the development server?
Can anyone explain to me how the possible flows would look like in my scenario?
Example: I make a change locally and then push on "develop". The development server has a git hook that recognizes the push and somehow triggers the CI server that runs the tests. If the tests pass it COULD merge develop to master (is this CD now?), which again triggers a hook on the production server that builds the new image and runs the container. Is that right? Also which server is hosting the docker repo now?