Search posts, tags, users, and pages
How does this sound? I have never used gitlab ci before, but I would assume there's some sort of a job that you can define post deployment in your yml?
Perhaps, you could check if there's a way to attach this to your job.
script:
- docker login -u gitlab-ci-token
- docker pull imageName
- //Run the new image
- //Stop and purge the old container
Git lab CI will generate my image and put the image in registry. I need to run this imagem in another server ... a droplet on Digital Ocean . The flow is, an droplet that compile, test, build and generate an docker image and another droplet to run this image .
I can't run my image on the same container that build and test my app.
Riderman de Sousa Barbosa, I see, I suppose docker pushes doesn't have webhooks.
Is there a way using which you can ssh on-to the the droplet you want to run the new container from wherever the gitlab ci runs? If yes, you can programatically ssh onto those machines and run whatever commands you need to run.
The other way is to trigger a custom webhook from gitlab ci that a script on your droplet can listen to. Just an idea.
Yes .. but this not scale very well.
I was thinking to use docker machine for that , what do you think?
Seems like the docker ecosystem has improved a lot since I used it :) I have no idea about docker machine. Let's see if the suggestions that come in can help you. CC: Sébastien Portebois
Ok Siddarthan Sarumathi Pandian .. thanks.
I ask because I think that this should be commum..
And this should be scale.. I don't like to create scripts on server because if I create a new Droplet, I need to install this script again and this not scale.
Hey there, thanks Siddarthan Sarumathi Pandian for inviting me (unforntunately I was away, came back a few days ago with a ton to catch-up)
To sum-up the issue, if I read it correctly,
To be honest, I only used Docker-machine for local dev work, not for anything prod-related.
The question is: how is you DO droplet Docker container managed? (ie how does it start, how is it configured, ...)
Since I know little about DO I'll try to avoid saying bullshit, and will rather describe the usual way I do this in other contexts. Hopefully you'll be able to fill the gaps to find the equivalent solution in your stack:
abctag to a newer one with a def tag, you'll create a new task definition, with this new tag (if only the tag changes, it's really the same json, except the docker image tag). Then you'll update the service to run the new task definition (likewise, a rollback is setting the task to run the previous task definition). ECS will do the update for you (even the rolling update, via min healthy percent and max percent to know how much less/more of the desired number of tasks he could have during the update)apply a template change on the deployment. That template will instanciate a new replicaSet (ie the declaration using the new container), then Kubernetes will orchestrate the update to transition in a rolling-update fashion from the previous replicaSet to the new one (ie, it will decrease the desired count of the previous RS from n to 0, while increasing the desired count of the new replicaset from 0 to 1, so that the sum stay in the rolling update setting you defined for this deployment. The rate of this will be controlled by the minReadyThreshold, the liveness and readyness checks, if you define them). This might sounds complicated if you're new to Kubernetes' Lingo, but it's well thought and really well done (and even easier if you use a template/package manager like Helm). You can have a very quick overview of the deployment mechanisms in KubernetesByExample: kubernetesbyexample.com/deploymentsTo come back to the docker machine scope, I never thought of using it for such things, so it might be possible or not... I'm not sure (maybe a case of RTFM... or maybe not ^^) . Then, either you use a tool that manage it for you, or you might have to script it if you don't want to add yet another new tool in your stack.