For a lot of my work, I host and run code on Google Comptue Engine. This gives me an easy and very cheap way of running specific scripts for as little as $5 per month.
Recently though, I’ve been thinking about how I could execute some code that’s stored remotely on Github without setting up version control on my remote machine.
The idea would be to create a public or private repo on github and store my
shell scripts there and then
call them directly on the remote sever. That way I would remove the need to depoly code to a remote location
and the script would always be up to date.
I’m new to the ideas of CI/CD, so I’m sure there might be a better way to accomplish this, but short of setting up version control on the remote server, this would be the most simple way to accomplish this.
Here’s the set up:
- In your repo, you would create a shell script that would be used to execute you all of your commands.
You could use the file
- On your remote server, you would set up your shell script that would call the remote script and execute it.
You would use the file
command.shand excutes its code.
The repo is here if you want to clone it and try it yourself.
The tools in this example are: