How to install Ghost blog for free on Heroku

Ghost is a fully open source, hackable platform for building and running a modern online publication. It is a very good alternative to WordPress and blogger and Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud. Heroku offers a free plan for experiencing the cloud. You can install Ghost on Heroku for free. Following is the step by step guide for installing Ghost Blog on Heroku.

  1. Download Ghost blog from here: https://ghost.org/developers/
  2. Unzip it into required folder.
    Unzipped folder name is “ghost-0.11.3”. You can keep the name same or change it to any other name. I have renamed folder to “mytravels” as this is my blog name.
  3. Initial NPM and Install required NPM modules
F:mytravels>npm init  

Please follow the instructions as it appears on the screen.

F:mytravels>npm install  

This will take some time as it will install all dependencies.
4 . Initiate git repository

F:mytravels>git init  
Initialized empty Git repository in F:/mytravels/.git/  
  1. Login to Heroku by entering your Heroku credentials
F:mytravels>heroku login  
Email: youremail@gmail.com  
Password (typing will be hidden):Logged in as youremail@gmail.com  
  1. Create Heroku application
F:mytravels>heroku create  
Creating app... done, desolate-journey-89792 https://desolate-journey-89792.herokuapp.com/ | https://git.heroku.com/desolate-journey-89792.git  

cross check git configuration using following comments

F:mytravels>git remote -v  
heroku  https://git.heroku.com/desolate-journey-89792.git (fetch)  
heroku  https://git.heroku.com/desolate-journey-89792.git (push)  
  1. Add PostgreSQL database
F:mytravels>heroku addons:add heroku-postgresql:hobby-dev  
Creating heroku-postgresql:hobby-dev on desolate-journey-89792... free  
Database has been created and is available  
 ! This database is empty. If upgrading, you can transfer
 ! data from another database with pg:copy
Created postgresql-slippery-42334 as DATABASE_URL  
Use heroku addons:docs heroku-postgresql to view documentation  
  1. Get database configuration as below:
F:mytravels>heroku config  
=== desolate-journey-89792 Config Vars
DATABASE_URL: postgres://lnfyqtfomdenyr:HwyaPziUdy0bQ1_lE40OKgbZl6@ec2-54-247-95-102.eu-west-1.compute.amazonaws.com:5432/d3t3m6qujeadp4  

These details appear in following order:

postgres://{POSTGRES_USER}:{POSTGRES_PASS}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DB}  
  1. Rename config.example.js to config.js and add following code
        production: {
        url: 'http://www.example.com',
        mail: {},
        database: {
            client: 'postgres',
            connection: {
                host: 'POSTGRES_HOST',
                user: 'POSTGRES_USER',
                password: 'POSTGRES_PASS',
                database: 'POSTGRES_DB',
                port: '5432'
            },
            debug: false
        },
        server: {
            host: '0.0.0.0',
            port: process.env.PORT
        }
    },
  1. Add your domain name using following command
{gfm-js-extract-pre-1}  
  1. Deploy these local changes to Heroku.
git add .  
git commit -am "first commit"  
git push heroku master  

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.