Netlify as a hosting option
I wrote about hosting this site on Heroku last week. While I was at it, I set up a monitor to see what sort of uptime the various options had. I have no idea what happened, but over the weekend Heroku had problems serving my site:
That's a 4 day stretch of 96% uptime, which isn't great. I did unset JEKYLL_ENV
:
heroku config:unset JEKYLL_ENV -a jlericson
But since I'm setting the variable correctly in the Procfile and it had several days with no downtime, I don't think that's the problem. Maybe I'm still doing something wrong. But maybe Heroku isn't the most reliable option.
As it happens, I recently learned about Netlify, which claims:
Deploy a site in 30 seconds.
Now that is a bit over stated, but it did take me about 10 minutes to
get my site set up. The process
involved pointing Netlify at my GitHub repository and changing the
random name it assigned to the name I want to use. I didn't even need
to set JEKYLL_ENV
.
Hosting Unicorn Meta Zoo on Netlify took a few extra steps. GitHub rather helpfully serves the README.md file as a site index out of the box. All I needed to do was enable GitHub Pages in the repository's settings. I also had picked the Leap day theme to make the page look a little better.
In order to host it locally or on some other service, I needed to set up the repository with:
$ bundle exec jekyll new . --force
The --force
option is because I'd already set up some of the
necessary files, which needed to be overwritten. After checking in
the
changes,
the site worked on Heroku
again. But the build failed on
Netlify. As
far as I can tell, the problem is the repository is part of an
organization rather than under my name. So I added a line in
_config.yml
:
repository: unicorn-meta-zoo/unicorn-meta-zoo.github.io
This can also be fixed by setting the PAGES_REPO_NWO
environment
variable to the repository.
Finally, I wanted to make README.md my site's index. That was easily accomplished with the Jekyll Readme Index plugin.
We'll see how Netlify's uptime looks in a few weeks, but I feel better about having a backup hosting option if I ever decide to move off of GitHub Pages.
If you want to talk with me about community management schedule a meeting!