It was funny – the day after I finally put up a blog post I got an email from Webfaction that my account was closed. That was funny. I mean I knew they were migrating sites and I had a couple of old Django playgrounds on there, plus my person blog generated from Pelican. I got the emails over the past couple of months that my Django sites (and their pgsql db's) weren't migrating and I was fine with that – they were ideas that didn't go anywhere. But I was surprised that my account was closed. I check my blog – nope, down. It seems that they didn't move anything of mine. I then said some non-professional phrases, and continued back to my day job, thinking of a plan of action in the back of my mind.

Important to note that I hadn't lost any of my content – my files were still there, I just needed another place to put them. I played around with Netlify once, just to see what all the fuss was about and I did like it. I figured I could move my content over there pretty quickly. I was already using GitLab to store it (and my personal projects) so I figured it wouldn't be too hard to just move it over. I started working on it when I had some free time and went down quite a rabbit hole.

I didn't like having to move the DNS over to Netlify's control, but I understand what they are doing and Netlify controlling the DNS makes this possible, so that wasn't too bad. I made a requirements.txt of my simple Pelican area (under a venv ) and that was good to go. I checked that into my private gitlab repo, which I had already setup Netlify to monitor and it saw it and built it. Well, not really. It failed miserably. This was where things started to get even further off the rails.

First off, Netlify's default Python is 2.x. Yes, still Python 2, even though it's been sunsetted for almost a year now. They do have Python 3 – to use it you need a file called runtime.txt with simple 3.7 (or whatever version of Python 3 you need). Note – not python3.7, just the version number.

So once I got that going, I saw that the deployment was successful! I went to the URL… and it was blank. I looked at the Netlify log and I had a bunch of Emacs errors. You see, previous setup was to write my content in Emacs with OrgMode. I used a Pelican plugin called org-reader to convert the files to HTML on deployment. Locally, I just used a Fabric task to generate the static files and sftp them to Webfaction. I did everything locally, and just copied the HTML to Webfaction. Well now I'm relying on Netlify to do the build and copying. What was weird is that Pelican wasn't existing with an error when Emacs bombed out on each org file.

I was able to determine that Netlify was using Emacs 25 and I was on 27.1 locally. That is kinda old but there was no way to change what Netlify had – I wasn't allowed to run apt install there (permission denied). After beating my head against the wall a bit, I decided to look for another Pelican plugin. What I found was org-pandoc-reader, which really could work well. It obviously uses Pandoc, which I have used before and it works really well. I first used the plugin locally to make sure it could handle my existing org files and it did with no problem. So, just assuming that Pandoc was there in Netlify, I committed and pushed. And in a few seconds all my content was there. A good side effect is the Pandoc renderer is faster. I think it takes multiple org files in on one command and my Emacs also loaded my full initialization when running org-reader (which I could have fixed.. but still wouldn't have worked on Netlify). Locally this made rendering the pages when testing a lot faster.

Take-aways:

  1. While it was painful my host went away and closed my account, I still had my content in pure text. So I could put it anyway… there are more places I can put it besides Netlify. If this didn't' work I could have made another choice, like GH Pages, AWS S3, etc.
  2. Netlify is pretty open about what they provide… You can even see the Dockerfile that they use to build and deploy content on. This was invaluable to me
  3. Not mentioned above, but I found it handy to put the build commands in a script (which I wittily called netlify) and put my Pelican build command there. This allowed me to easily add other commands to it (like emacs --version) to help troubleshoot what was going on.