Moving to Firebase Hosting + Hexo

For the past 6 months my blog has been hosted on Digital Ocean and used Ghost as the writing platform. I’ve now moved to Firebase Hosting and Hexo.

Firebase Hosting

Digital Ocean has always been great hosting provider and with their tutorials it was easy to get Ghost running on an Ubuntu “droplet” for $5/month. But after seeing a tweet about (free*) Firebase hosting I decided to check it out.

Firebase gives you a simple CLI for creating and deploying projects and they even setup an SSL cert for your domain. Overall it will require less maintenance than my previous setup on DO with Ubuntu, NGINX, Ghost, and Let’s Encrypt.

I did run into an issue verifying ownership of my custom domain through the Firebase console. The docs state that you add a TXT Record with a google site verification token. I added the TXT Record through my domain registrar console, but Firebase still failed to verify the domain. I found an old medium post that detailed a deprecated method for domain verification which included a step to add a CNAME Record that points to your Firebase url (<project_id>.firebaseapp.com). After adding the CNAME Record Firebase verified my domain and I was able to remove the record.

Hexo

I wanted a blog framework that:

  • Let me write in markdown
  • Supported themes
  • Generated static files quickly and easily

Ghost has these features but I didn’t like the web interface for writing content, it doesn’t have a CLI comparable to Hexo, and has more features and complexity than I need. If you’re looking for a static site generator with Markdown support I highly recommend looking at Hexo.

Launch

The Hexo and Firebase CLIs make it super easy to generate and deploy a new site:

  1. cd my-site
  2. hexo init
  3. npm install
  4. hexo generate --deploy
  5. firebase init (you will need to sign in on first use)
  6. Move to Hosting, select with SPACE and confirm with ENTER
  7. Create a new project or associate it with an already created one
  8. Press ENTER to use public as your public directory
  9. Enter N to not configure your site as a single-page app
  10. Enter N to NOT overwrite the public directory created by Hexo

Finally run firebase serve to view your site locally or firebase deploy to deploy your site :)

Be sure to go through the helpful Firebase Hosting and Hexo documentation!