I want to auto deploy a simple docker-compose.yml file with database and api from gitlab-ci.yml. I have a ubuntu server running on a specific ip where i can pull the gitlab project and run it manualy with docker-compose up -d
, but how can I achieve this automatically through gitlab-ci.yml, without using gitlab runner?
CodePudding user response:
Gitlab CI ("Continuous Integration") inherently involves Gitlab Runners.
You can't use one without the other.
Whether you use a Gitlab Runner or not, you can achieve what you ask in a number of different ways, such as:
- Use
subprocess
to invoke system commands likescp
to copy files over andssh <host> <command>
to run remote commands. - Use paramiko to do the same thing in a more Pythonic way.
- Use a provisioning tool such as Ansible
If you're not using a Gitlab Runner, your code would invoke these directly. For someone using a Gitlab Runner, their .gitlab-ci.yml
would contain these scripts / script calls instead.