Moving from Github pages to self hosted Jekyll
Last year I migrated this site to Jekyll. One of the reasons was I really didn't want to worry about my own server, and the option was there to use Github pages for free.
I have a custom build process for my site, using Grunt. This meant I couldn't take full advantage of the automated build process of Github pages. I built the site on my local machine and used grunt-build-control to deploy this to a separate github repo. Not pretty but it works.
Recently, I've been feeling the need to own my server again. It's a pain having to build on my own machine, meaning I'm tied to it for creating content.
As I want to move towards publishing more content on this site I need to make it more flexible. I thought about introducing support for notes and micropub and realised that having an automated build process was a blocker.
I also want to start pulling in all my data from other services I use and maybe doing something cool (eg. gyrosco.pe) . To do that, I'm going to need a persistent server somewhere storing and serving data.
This was my process:
- Install Nginx and setup a folder that serves HTML from test.lewisnyman.co.uk (for now)
- Install build dependencies (RVM, NPM, Bundler, Sinatra, etc)
- Create a build script that runs a Sinatra server, nginx forwards all requests to api.lewisnyman.co.uk to there.
- Setup the Github webhook to hit the api endpoint on push
- Debug the sinatra script for an hour
I'm happy to put the build script on github once it's tested and I know it's secure. It's very similar to the one in the tutorial Automagic Multisite Server with Jekyll and Nginx on a DigitalOcean Droplet but with less abstraction to keep it simple.
I used these tutorials and documentation to help me set up the Digital Ocean droplet and the build process. I want to write this up in more detail as simple tutorial for newbies.
Special thanks to the lovely Joe Baker for giving me some pointers.