I have no experience with Linux. That’s zilch, nada, zero. However, in all my infinite wisdom and glory I decided that as an exercise towards learning it and to set up my blog I’d just go ahead and give it a try. Recording my experience here seemed liked a good idea for posterity sake.
How did I come to this conclusion and desire? It is probably prudent for me to give a little background how I arrived here. I’ve been mentoring a couple of young and aspiring developers and was looking to find some resources to help them. During my search I came across a blog post by John Sonmez that spoke directly to their predicament and I passed them along. I also stumbled across another of his posts talking about starting a blog to launch your career.
Now here’s the thing: I have been developing professionally for 14+ years and I’ve done a few laps around the block so-to-speak. I have never had trouble finding a job nor staying employed. In fact, I’ve tended to stay at my jobs for quite a long time compared to our industry average. So why would I need to “launch my career”? Simply put: I want options. What I mean here is that I will force myself to learn new things by having an active blog and that extends my repertoire and opens doors.
Back to the task at hand. I registered my domain through NameCheap. Then I hopped over to DigitalOcean (DO). Employing my Google-Fu I came to the conclusion that I would try the Ghost platform. My search also turned up some detailed instructions about how to set it up on DO.
Cracking my knuckles I set to work.
Setting up a droplet on DigitalOcean
Logging into DigitalOcean for the first time I created a new project and then clicked to create a new droplet. I’m presented immediately with an option about what image to use:
I chose “Ghost on 18.04” per the instructions at the time. Next you need to pick a size. Since this is my first go at a blog and I really have no idea how busy it’ll be (plus you can resize your options later) I opted for the cheapest one.
Now you get a bunch of optional options. Do you want to back it up? Do you want to add “Block Storage” which is basically a virtual disk you can move around and/or link to multiple droplets. Now I have to choose a region.
Well… I’m near the West coast so I’ll go with San Francisco. You want your servers closest to your target audience so there are less hops between internet nodes. I’m my target audience.
Now it asks me if I want to link an SSH key. I happen to know that I do want one; this will make it so I can log in remotely without having to use their console through the website. I already have a key that I used for GitHub and BitBucket so… sure, let’s just use that one.
Next up how many droplets do I want to create using these settings and what do I want to call it/them? Click that magic button and wait patiently as it spawns up my droplet ninja-quick.
Now here is where their tutorial doesn’t quite get order-of-operations correct. Or maybe they do but you actually have to know why they are telling you to do it. They tell you “We recommend setting up an A record from the domain…”. Well yeah, of course but I just figured I’d swing back around and do that later. Turns out that’s a dumb idea with the one-click solution.
SSH in and it starts running me through the final setup prompts. Here’s where it goes awry. When I’m prompted about SSL I’m thinking “well yeah, of course I want that” but it fails on me. Google-Fu again and oh, yeah, so apparently LetsEncrypt requires the A record so it can link the domain appropriately. I set the domain records up the rest of the way and manually rerun the
ghost setup method but SSL was already half-way done so it doesn’t rerun it. Great.
Have I mentioned I’m a Linux beginner? I decide to just delete the droplet and try again. I remap my DNS to the new droplet before I SSH in. This time the whole setup process completes successfully.
Now I’m faced with a problem where the site only works with the base domain but not the
www subdomain. Google. Again. I learn that there are couple ways I can approach this with the nginx conf files. The basic gist of it is that I need to find the config files which required me to login as the
ghost-mgr user and then run
nginx -t (which I later learned runs a test on the files but also tells you where they are). Talk about drinking from the waterhose. I don’t even know how to save my changes in VI yet… Google?
Bouncing around back and forth I can see that I can just add a server block in one of my conf files something like so:
return 301 $scheme://www.yourdomain.com$request_uri;
Ok. I’m still not even quite sure where or how the redirection is occurring to force it from http to https. I know that happened automatically as part of the one-click configuration process or rather as part of the
ghost-cli process but I’m missing it. I decide that while I know that the above is the correct way to do it, I’m going to do the hackish way I found on this blog post. Why hackish? Because I’m fairly certain I don’t need a bunch of different conf files like that and could/should be able to do it all in one. In fact, I’m confident that’s the case based on other posts and tutorials I came across but I just wanted it to work and figure I can come back to adjust it later.
What did I learn?
My first exposure to Linux threw me into the fray with a bunch of things I just wasn’t used to. In order to do anything related to Ghost I had to switch to the
ghost-mgr user but then switch back to the root user in order to reboot nginx and things like that. I had to dust off my ancient command line skills learned from my DOS days and even then needed to use Google to learn some of the basic Linux commands. We could easily say that I learned just how much I don’t know.
So what am I going to do about it? I ended up buying a book off Amazon to hopefully give me a better introduction into the Linux world. We’ll see how that goes. I’m also planning on picking up a book and/or video on nginx as well since I imagine that is how I’ll host (reverse proxy) ASP.NET Core applications on Linux when I finally get around to it. Probably worth learning it first, right?
Overall I’d say that I have grown too reliant on GUI based configurations. Maybe that’s a good thing, maybe that’s a bad thing, but either way I recognize my weakness in that area and have some room to improve.
You might have noticed by now that the blogging platform I’m using is not Ghost. So… I realized that there was just too much missing from the platform but first and foremost was the lack of comments. Maybe I think too highly of myself in thinking that people might actually read my blog and comment on it but that seems like a pretty basic feature. I deleted the Ghost droplet and used the one-click for WordPress which was a much smoother process. I followed it exactly and was up and running.