blog post

This commit is contained in:
Santiago Forero 2021-10-14 20:18:05 +00:00
parent 206c39e9e2
commit 7d25a6b7e5
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
---
title: Setting up continuous deployment for my site
author: Santiago Forero
date: 2021-10-14T19:03:02Z
---
Hello, in today's post I will show you how I managed to set up [continuous deployment](https://en.wikipedia.org/wiki/Continuous_deployment) to my site.
Before I explain anything, I want to tell you how was my workflow when I changed anything in my site:
1. Make local changes
2. Commit and push to the remote git repo
3. SSH into my server
4. Pull from the remote repo
5. Execute the build command
Doing this manually doesn't really take much time, however, it's fancier to do this automatically.
In the beginning, I was thinking about setting up a [GitHub Action](https://github.com/features/actions) that basically accessed my server via SSH and executed the build commands, this isn't a really safe approach because I'm giving direct access to my machine even with an unprivileged user, I spent some time researching and asking in the **##github** IRC channel in Libera, someone suggested me to use webhooks, which mean that GitHub would make a post request to a specified endpoint, I decided that this was my best option so I started [searching](https://github.com/search?q=github+webhook+receiver) for services I could host in my machine, I found several options and I couldn't decide which one, so I made my own! A really simple node script that created an [express](http://expressjs.com/) web server that listened for post requests in some (very) secret endpoints and executed a small deploy script automatically when reached. This worked amazingly well in the first attempt. Now if I want to make changes to my computer I don't even need my computer! I can use GitHub's web editor to do anything and the changes are live almost instantly.
Thank you for reading my post, let me know what you think and if you have ever done something like this.