July 5, 2019

Hello World

How to setup Ghost blog on a Raspberry Pi A+ running Raspbian Buster with Docker, Ghost and NGINX

Hello World

Well, today I setup a Ghost blog on a Raspberry Pi A+ running Raspbian Buster with Docker, Ghost and NGINX

This is my very first post, so bare with me... it's going to be a work in progress over the next few days.

Here is the outline of what I'm going to cover:

Todo:

I'm going to gather all of the commands and try to organize things so that they happen in the proper order.

Once I figure out how to accept comments, and I finish the post, then I'll turn comments on and would love any feedback.

See you soon...

Hardware Requirements

The great thing is, there really isn't much hardware required for this project:

  1. $25.00 - Raspberry Pi A+
  2. $16.00 - 2x Sandisk Ultra 32GB Micro SDHC $8.00 Cards - Update: *Random R/W
    $21.00 - 2x SanDisk Extreme 32GB $10.50 Cards
  3. $14.00 - Pwr+ 5.1v 3A Smart Switching Power Supply
  4. $7.00 - IOGEAR MicroSD Card Reader
  5. Priceless - The joy from building your own web server for your Ghost blog

Grand Total: $67.00 + Priceless Joy

Less is more?

Obviously, you can get away without the extra SD card and Card reader, but this makes it very easy to make a full hardware backup. So if you do something wrong, or worse, if you zap your flash drive in your pi - you have a full backup ready to just move from the card reader into the SDHC slot on the pi and keep moving.

With that said, I've personally only ever lost one Pi installation due to disconnecting the power (non-graceful shutdown). I was able to just re-flash the card and move on with life. However, at work, the folks in our NOC that use Raspberry Pis for their dashboards have their very own collection of completely borked flashed drives. One curious day I did whatever I could to recover the drives with no success - they were completely toast.

A full backup with rpi-clone takes less than five minutes with no content on the site.

If you have a better way of doing backups, please share in the comments section - I'd love to hear about it.

Micro SDHC Card Selection

This is the ONE place where I suggest not skimping on quality. It is the single easiest way to noticeably boost the performance of your pi - from booting up to doing a sudo apt upgrade. If you have any special zsh configuration with auto-complete, etc. you'll notice a difference there too.

Buy a trusted name brand whenever you can. Get them as fast as is needed for the project - I never go less than class 10. Also, I've googled around for benchmarks - the good people who do professional photography truly understand the importance of read/write speeds and post blog articles all the time about memory card benchmarks - I've done my own comparative analysis and the benchmarks are always 100% accurate. Found that link by literally googling "micro sdhc sandisk ultra benchmarks"

Update: Random Read/Write Speed Is Important

While researching and writing an article about running Docker on a Raspberry Pi I discovered an article that I remember reading a long time ago that talks about the importance of benchmarking Micro SDHC Cards for random read/writes and not just massive file read writes. Since then Jeff Geerling as written two more articles on the topic - one in 2018 and another one recently here on July 10th, 2019 with the release of the Raspberry Pi 4.

Consider both size and random read/write speeds for a Micro SDHC card for your Pi. It does you no good to have 2TB on a MicroSDHC that reads less than 10mb/sec. It's like the difference between using a spinning HHD vs a SSD on your Raspberry Pi. Which by the way is soon possible when they release a firmware upgrade, you will be able to boot to USB 3.0 on the Raspberry Pi 4 (from an actual SSD) - when that happens, it's going to be huge :)

A word on card readers...

Find one you trust, and use it forever... So, I've had spotty success with various card readers - this is the number one way I've lost flash drives. If the card reader has connectivity issues while you're say... flashing Raspbian to your flash drive - than you could get a dead flash card on your hands. This might be a thing of the past, but I'm still paranoid about it.

I'm always a bit leery of a new card reader until I've used it for a while. That being said - I have several IOGEAR MicroSD Card Reader hanging around my house, backpack, office. I've never had an issue with it - and I have several which are very battle-worn.

I got tired of not being able to find one - so I just bought a bunch of these and I keep them around. I often give them as gifts to people when I'm helping them get started on a pi project - along with my recommendation to use rpi-clone :)

Power Supply

So, in truth - I'm using this power supply right now. But I have my eye on this Pwr+ power supply since it has such great reviews, and more "smart switching" than the one I have. One reviewer, Timothy Brown, also provided a great analysis with this detailed image in his Amazon review.

Technical Image on Amazon by Timothy Brown

Now, I'm no electrical engineer, but as far as I know - the important thing to be sure of is that you never run into an under voltage scenerio. 5.1v at 3A is pretty much the max you're going to need in a Raspberry Pi 3 model A+ or B+. The Raspberry Pi 4 is an entirely different beast.

UPS? - What if the power goes out?

In the future, I'll add an Adafruit PowerBoost 1000c with a Lithium Ion Polymer, 3.7V, 2500mAh Rechargable Battery which would act as a small UPS for my server. You always want to be able to shut your Raspberry Pi down gracefully to avoid any issues with the Micro SDHC sizzeling out on you.

Which reminds me - if you have no power in your house and your wifi router goes off, you're going to need a way to tell your Pi to shut down gracefully. Here you have options.

  • Adafruit PiUART - You can use the USB Console.
  • Pimoroni OnOff SHIM - Just push the button.
  • Or you can configure your pi to make it's own wifi when it's not connected to your home wifi network. You can join that network, ssh in and shut'er down.
  • I also have heard there is a way to connect the GPIO pins to your Adafruit PowerBoost 1000c and tell your raspberry pi to shut down after the "low battery" light has been on for a significant amount of time. I've never tested this, but I think it's a great idea.

Anything else on the wish list?

... heck, maybe a case? one day ;)