Going Static

I'm moving most of my sites to a static workflow.

For years I used shared hosting for my sites. But I hit a point where I wanted to do a lot of things that were difficult to do in shared hosting. (Running my own code on different platforms, Let’s Encrypt, etc.) At the same time I realized that there were a ton of new, low cost options out there that would let me run my own “box” and do all those things while saving money at the same time.

I ended up going with Digital Ocean and I’ve been happy with them so far. I feel like they have very good service and I get good value for what I pay. My cost dropped to half. But I did run into an issue.

Essentially I just moved all my main sites over which were all running on Wordpress. This went fine for a long time but then I started to have issues. My mariadb server was getting shut down because of memory constraints. I’m not an expert on this stuff, just a hobbyist but looking through my logs it look like the biggest change was machines in China constantly trying to log into my sites and do other things at a high volume and I was essiantly getting DOS’ed. I took a few steps to deal with it and they were mostly successful but as I looked over what I had, I realized that a lot of my sites were not super active. I post infrequently, commenting/discussion was never a big part of any of them and there was really no need for them to be dynamic.

Combine with this with the stretch where my sites were being compromised on a somewhat regular basis, and it seemed like a god move to go static. Eliminate the resource issues, mitigate most of the security issues, etc.

So I started researching, trying out different software to generate sites and ended up with Hugo as my choice. That’s how I built and am using this blog. The only issue left is that I have a lot of content sitting in those wordpress sites and I wanted to keep it. There are plugins for exporting Wordpress to Hugo but to be honest, I wasn’t crazy about what I was seeing in terms of the work it would take. And as I am learning more about Hugo I realize that for some of those sites, Wordpress gives me some really convenient tools for authoring posts that I’m going to miss. Then I ran across a thread on HN that really opened my eyes.

The thread was a question about recommendations for static site generators and it was this answer - ‘use wordpress’ was a revelation. I don’t know why I didn’t think of it on my own - but for the sites where I’d really miss how Wordpress handles things, I could just use a plugin that would generate static files from the site.

I’m working on the first site I will switch right now. It’s an old blog of mine for posting book reviews. It’s a very simple site and the posts follow a simple format. It is actually one that wouldn’t be too hard to convert over to Hugo - but it’s also a really good test case for this approach to generating sites.

My plan right now is to run the site in a way that only I can access it on the server. This should take care of the issues of load being generated by people who are not me. Then I’ll put the static files into the publicly served location. That flow is still a little foggy in my brain. I may make the WP site local, do all that work on my machine and then have rsync push changes up to the server.

We’ll see how it goes.

I do have at least one sight that I update more often, I embed lots of video and pictures, use widgets for the sidebar, etc. and that will just stay straight Wordpress. I’m using some different security plugins and cacheing to manage that and keep resource demands low.

May respond to comment lower that says there is no reason to do static.