057 Ghost

31 Jan 2014

Ghost is a NodeJS based blogging platform. In this episode, we will explore how to run Ghost on ghost.org and our local machine, create the simplest theme possible to understand the structure of the blog, and finally host it ourself on AWS EC2.

Download video: mp4

Sample code: Github

Version: 0.4.1

Similar episodes: 005 Markdown, 006 Wordpress, 020 Nanoc, 033 AWS, 037 Jekyll, 044 Node

Background on Ghost

  1. Main website and features
  2. 30 day free trial

Things to learn with Ghost

1. Make a blog on ghost.org

  1. Try the 30 day trial plan
  2. Sign up
  3. Edit the first default post
  4. Features:
    • Markdown and help
    • Edit tags
    • Change the permalink
    • Install a free theme from Marketplace - E.g. Journey
    • Publish Now - click the red button

2. Install ghost locally

  1. Installation guide
  2. Ensure Node is installed locally

    node -v
    
  3. Download Ghost on Mac

  4. Unzip and view the structure of the folder

  5. Install it

    $ npm install --production
    
  6. look through the dependencies - express, sql, handlebars

  7. Start the server

    $ npm start
    
  8. Visit 127.0.0.1:2368/ to view and 127.0.0.1:2368/ghost for admin access

  9. Usage docs

  10. Open database at /content/data/ghost-dev.db with MesaSQLite and view the posts

  11. Create static pages that also create json formatted data. Visit the local url /ghost/api/v0.1/posts/?status=all&staticPages=all

3. create ghost themes

  1. documentation on creating Ghost themes
  2. create a new folder inside /content/themes/name-of-new-theme with the following files and folder structure

    .
    ├── assets
    ├── default.hbs
    ├── index.hbs
    └── post.hbs
    
  3. the simplest content for default.hbs

    <!DOCTYPE html>
    <html>
    <head>
      <title></title>
    
    </head>
    
    <body>
      }
    </body>
    
  4. the simplest content for index.hbs

      <h2><a href="">}</a></h2>
      <p></p>
      <span datetime=""></span>
    
  5. the simplest content for post.hbs

      <h1>}</h1>
      <section></section>
    

4. Install Ghost on AWS

  1. Go to AWS EC2 > Launch Instance > AWS Marketplace (sidebar) > Search "Ghost" > Ghost powered
  2. View the public DNS after the instance is running
  3. Download the key pair and change permissions

    chmod 600 ghost-ec2.pem
    
  4. ssh into the EC2 instance

    ssh -i /path/to/ghost-ec2.pem ec2-user@[public-dns]
    
  5. go to the installed Ghost folder at /var/www/ghost and amend the files accordingly

  6. terminate the running EC2 instance (if required)

More Resources on Ghost

  1. Ghost blog on Amazon EC2
  2. Ghost roadmap

Build Link of this episode

Frontend screencasts by Joe Maddalone