What I learned from self-hosting a Ghost site
Tags: devjournal, webdev
Published: 2019-08-31 00:05:54

# The initial problem 

The one problem I always had with having a website was cost. Especially since very few people care to look at it (and that's okay), spending 10 bucks a month just became a hassle and i'd ultimately just give up. 

# The start of the solution

Recently, my job was throwing out/giving away a handful of the mini HP Elitedesks, so I took one home with the idea that i'd use it for developing Linux specific items. Then I realized I could probably self-host my site instead. 

# Lets get rid of wordpress

I can say the hardest part was finding a wordpress alternative. Don't believe me? Google "Wordpress alternative". They are true alternatives, but they aren't great for self hosting. I know that wordpress DOES work for self hosting, but I dislike the overall limiting factor of wordpress. Granted, what I ended up using (Ghost) is probably more limited, but tomato-tomato. 

# Woe's of Self-Hosting (and bad IT management)

Once I had ubuntu up and running, then it was time to finally learn how to set up nginx with Cloudflare (my DNS provider). I can safely say I bombed this one for a solid 3 hours. I know because my fios router login page was accessible to the public for 3 hours (my fault (on all fronts) because I have it set up to access from anywhere if i know the IP). Asked a small discord (7 people who used to play minecraft together) if they saw the login page, and the "20 failed login attempts since last successful login" message told me that yes, yes they can. 

# There's a reason i'm not in graphic design...

Once I had that squared away, it was time to pick the theme. This is where I always hit a rut. Themeing isn't for me. I start with something good looking, change a couple colors and BAM, it looks like a 3 year old designed it, or that sweet modern theme i found now looks like it was made in the 90s. Interesting enough, this time around I nailed themeing.

# Hardcode the simple stuff, because you can. (and you can't not) 

The thing that's interesting about themeing with Ghost, or editing existing infrastructure with Ghost, is that it's a bit tough trying to find all the source code.  A lot of times it's easier just to change the html around to break what's in the Ghost code. For instance, my friend suggested that my titles be "TITLE - BLOG TITLE", the problem is that Ghost, by default, sets the title for tags to "TAG - BLOG TITLE", so having "TITLE - BLOG TITLE" leaves you with "TAG - BLOG TITLE - BLOG TITLE". Luckily, handlebars has ifs and has statements (and I think i settled on "is" being the safest). 

# ZIP all the files! 

Then, the last handful of days has been tweaking CSS, zipping up the folder, reuploading to Ghost, refreshing, and seeing if anything broke, and if it did what I wanted. Through this, I realized that the 3000+ lines of CSS code had no real structure, and that's probably my next project, for my own sake. I would have used a lot of inspect element editing, but anytime i needed to refresh, it was gone. 

This is where Wordpress would have excelled, they have the ability to edit the files in the admin panel. The problem is that good themes are expensive, and every theme i've ever found didn't have exactly what I wanted, or had exactly what I didn't want. 

Ghost has it so you can download the theme (as is) as a zip, and then you edit, zip back up and reupload. Granted, I may be safer having a dev setup for Ghost, and that's probably next, but before today I hadn't shared the site publically. 

# Okay man, what did you learn? 

What did I learn? A lot. But mainly, learning new things isn't bad. As a developer with ADHD, whenever I look at a new language, or new structure, or new framework, I get kind of...mush. it looks impossible, I don't know where to start, etc. But I've realized lately that the more I stick with it, the more I learn what I don't understand, the more I understand (who knew). And the more I understand, the less it looks like mush. And soon, I'm able to create whole themes (not now, but soon. Right now my theme on my site is just a heavy edit of the Editorial theme by Ghost. I didn't like the SUPER bright colors). 

# Recommend? 

Would I recommend Ghost? if you don't mind hardcoding easy changes, yes. For example, changing the theme colors shouldn't require me to edit CSS. But, it does allow me more control. And it makes it easier on theme devs (they don't have to make it based on a set standard). Really, in theory, anyone could take ghost and use it for something ENTIRELY different if they wanted to spend enough time changing things around. 

# So did I save money? 

Now, instead of paying 10-12 a month, without ssl, and not including the domain name, i'm now paying $8 a year, including ssl and domain (that's it really) plus $6 a month for gsuite (for my email). 

If you're interested, [you can check it out here](https://theunquenchedservant.com/) but keep in mind that it is a Christian site. Mainly just look for themeing purposes, unless it interests you.