Building and Deploying This Website

For a static website being hosted on a single server instance, your build and deploy pipeline don’t have to be particularly complex. I find the standard Hugo build tools and rsync to be more than enough for a personal site like this one.

First, I make sure that I have an updated build of my site in my workspace. With Hugo, this isn’t too hard, I just go into the root of my project repository and use hugo --gc. The --gc flag stands for “garbage collection”, it helps remove the outdated files that occasionally get left behind by Hugo, and should always be used for a small site.

Any time I come across some kind of bash incantation that I know I won’t remember, I stick it into my bashrc as an alias so I can call upon it later. To deploy this site, I use this alias:

 alias sync_website='rsync -avzze ssh --progress --delete ~/workspaces/devinadooley/public/'

If you happen to still be more human than machine, this won’t be very intuitive. You could get this all from running man rsync, but I’ll break it down anyway:

Running some version of that command should get your local files onto the server location where you need them. Apologies if you were expecting a more complex deploy system, but in my opinion, any extra tooling for a site like this would be a waste of time – rsync is a perfectly capable tool for a site with a single developer and deploy target. It can be fun to create and configure deployment systems, but it can also be an easy way to waste your time if your objective is to serve static content on the web.