Free Ghost Blog on Heroku

Install Heroku Toolbelt

$ wget -O- https://toolbelt.heroku.com/install.sh | sh

Deploy Ghost Blog (version: 0.9.0)

wget https://github.com/TryGhost/Ghost/releases/download/0.9.0/Ghost-0.9.0.zip  
unzip Ghost-0.9.0.zip -d ghost  
cd ghost  
git init  
git add .  
git commit -m 'initial commit'

heroku login  
heroku create easypi  
#heroku git:remote -a easypi
heroku addons:create heroku-postgresql:hobby-dev  
heroku pg:promote HEROKU_POSTGRESQL_BROWN_URL  
heroku config:get DATABASE_URL  
heroku pg:credentials DATABASE

heroku config:set POSTGRES_HOST=ec2-x-x-x-x.compute-1.amazonaws.com  
heroku config:set POSTGRES_USER=xxxxxxxxxxxxxx  
heroku config:set POSTGRES_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxxxx  
heroku config:set POSTGRES_DATABASE=xxxxxxxxxxxxxx  
heroku config

patch config.example.js config.js.patch -o config.js  
echo 'web: npm start --production' > Procfile

git add .  
git commit -m 'make it better'  
git push heroku master  
#heroku logout

Upgrade Ghost Blog (version: 0.10.0)

#heroku login
heroku git:clone ghost -a easypi  
cd ghost  
shopt -s extglob  
rm -r !(config.js|Procfile)  
wget https://github.com/TryGhost/Ghost/releases/download/0.10.0/Ghost-0.10.0.zip  
unzip Ghost-0.10.0.zip  
rm Ghost-0.10.0.zip

diff -u config.example.js config.js  
vimdiff config.example.js config.js

git add .  
git commit -m 'make it even better'  
git push heroku master  

config.js.patch

--- config.example.js   2016-07-30 16:23:52.227666479 +0800
+++ config.js   2016-07-30 16:23:55.995581034 +0800
@@ -11,19 +11,23 @@
     // When running Ghost in the wild, use the production environment.
     // Configure your URL and mail settings here
     production: {
-        url: 'http://my-ghost-blog.com',
+        url: 'https://easypi.herokuapp.com',
         mail: {},
         database: {
-            client: 'sqlite3',
+            client: 'pg',
             connection: {
-                filename: path.join(__dirname, '/content/data/ghost.db')
+                host: process.env.POSTGRES_HOST,
+                port: process.env.POSTGRES_PORT,
+                database: process.env.POSTGRES_DATABASE,
+                user: process.env.POSTGRES_USER,
+                password: process.env.POSTGRES_PASSWORD
             },
             debug: false
         },

         server: {
-            host: '127.0.0.1',
-            port: '2368'
+            host: '0.0.0.0',
+            port: process.env.PORT
         }
     },

Settings ▷ Code Injection ▷ Blog Header

<style>  
  pre code, pre tt {
    white-space: pre !important;
  }
</style>  

CNAME (blog.easypi.info ▷ easypi.herokuapp.com)

$ heroku domains:add blog.easypi.info -a easypi
Adding blog.easypi.info to  easypi... ⣽!  
 ▸    Please verify your account in order to add domains (please enter a credit card) For more information, see
 ▸    https://devcenter.heroku.com/categories/billing Verify now at https://heroku.com/verify

Add Disqus Support (content/themes/casper/post.hbs)

         </footer>

+<div id="disqus_thread"></div>
+<script>
+
+/**
+ *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
+ *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables */
+/*
+var disqus_config = function () {
+    this.page.url = '{{url absolute="true"}}';  // Replace PAGE_URL with your page's canonical URL variable
+    this.page.identifier = 'ghost-{{id}}'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
+};
+*/
+(function() { // DON'T EDIT BELOW THIS LINE
+    var d = document, s = d.createElement('script');
+    s.src = '//easypi.disqus.com/embed.js';
+    s.setAttribute('data-timestamp', +new Date());
+    (d.head || d.body).appendChild(s);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+
     </article>
 </main>

Disable Google Fonts (optional)

# heroku run bash -a easypi
$ grep -rI --exclude-dir node_modules 'fonts.googleapis.com' .
$ grep -rIl --exclude-dir node_modules 'fonts.googleapis.com' | xargs sed -i '/fonts.googleapis.com/d'
$ exit
# heroku restart

IT DOES NOT WORK!
You need to git commit && git push.

Done

# /etc/nginx/sites-enabled/default

server {  
    listen 80 default;
    server_name _;
    location / {
        return 302 https://easypi.herokuapp.com/;
    }
}

Open https://easypi.herokuapp.com/ in web browser.