Setup Ghost blog hosting in 7 minutes
In this post you will learn:
- How to setup a Ghost blog with Openshift in less than 7 minutes.
- How to upgrade to the latest version for Ghost blog
- How to add comments for Ghost blog.
In this post, we will differ a bit from our usual topic and discuss about the technicality of building this website. I decided to use the "Ghost" blog platform since it is built on a newer technology than Wordpress. It's not that I expect this blog to need to scale like a huge applications, but I want to build more interesting features, having a NodeJs codebase allows me to make interesting features.
Step 1:
Signup for Openshift.
Step 2:
Add an application on Openshift. Currently the latest application for Ghost is 0.7.5 (as of Dec 2016). You can keep everything set to default.
Step 3:
Git clone the code. On the right side of page you will find "Source Code" and "Pass this URL to 'git clone' to copy the repository locally.". Run the following command with the values you have:
git clone ssh://myapp.rhcloud.com/~/git/myapp.git/
CD into your new myapp
folder.
Step 4:
Modify the file package.json:
},
"dependencies": {
"ghost": "^0.11.3"
}
Step 5:
Signup for Disqus
Step 6:
-
In Disqus, go to the admin panel
-
Click on "installing Disqus"
-
Pick the Ghost blog installation:
-
From Disqus get the universal installation code and copy into your file
content/themes/casper/post.hbs
Add the code after the
`
[...new Universal installation code...]
- Add the comment count to the file
content/themes/casper/default.hbs
<script id="dsq-count-scr" src="//befreeandwealthy-1.disqus.com/count.js" async></script>
Step 8: Update URL to your domain
Now by default, your Openshift instance will points all links to http://mydomain.rhcloud.com/
. You want to point instead to your domain www.mydomain.com
. Here are the instructions for this:
- Update the file
config.js
- Find the following code:
if (process.env.OPENSHIFT_MYSQL_DB_HOST != undefined) { config = { // ### Production // When running Ghost in the wild, use the production environment // Configure your URL and mail settings here production: { url: 'http://'+process.env.OPENSHIFT_APP_DNS,
Replace the line
url: 'http://'+process.env.OPENSHIFT_APP_DNS,`` with your domain: url: 'http://mydomain.com',
Step 9: Git commit
Commit all your changes back.
git add . git commit -e 'Adding comments and fix URL' git push origin