The content of this website is on GitHub here. A nifty feature about GitHub are its Webhooks.

I wanted to be able to add content here without having to SSH into my server, cd-ing into the www directory, git pulling, and makeing, as those steps are tedious. So, I set up a GitHub webhook to POST to a PHP page on the server. The basic form of this PHP page is just:

<?php
    passthru("MYSCRIPT.sh");
?>

Where MYSCRIPT.sh is just a script that pulls and makes the site.
Now, GitHub also allows you to set a secret, which allows you to secure the page against malicious actors. For this application, I find that a bit overkill (I figure the worst they can do is DOS me). Instead, I opted for rate limiting, as it is simpler to implement.

Now, whenever I push to my repo, my server will automatically pull and recompile the site, which is pretty neat.

Tags: Projects PHP Web
Part of a series on Automation.

Leave a comment below! For issues with this website itself, please describe the problem to issues at johnwesthoff dot com.
For urgent questions or comments, shoot me an email (address provided on my GitHub profile).