Easy Setup of Ghost Publishing Platform with Node.js Hosting from Jelastic Cloud

By | December 20, 2018

Ghost is a simple but powerful Node.js-based publishing platform, allowing people to share their stories with the whole world. It’s absolutely free and an open source project for blogs, available for use to anyone. Ghost provides a set of special tools, aimed to make blogging easy and even fun. In addition, this application has a great design and can be customized according to your preferences and requirements.

Now let’s check out several simple steps, describing smooth deployment of your Ghost project within Jelastic PaaS.

Create an Environment

1. Log into your Jelastic account and click New Environment button at the top dashboard panel.mysql

2. In the appeared dialog box select the Node.js tab, wherein NodeJS application server will be already chosen by default. Add MySQL database and specify the desired resource limits for the environment with the help of sliders, type your environment name (e.g. ghost), and click the Create button.node.js

3. Wait about a minute for your environment to be created.Configure node.js server

Add Project

1. As an open-source project, Ghost can be easily taken from its repository at GitHub: you just have to choose an appropriate release. Click on the link in the red rectangle and make your choice downloading correspondent zip archive.php myadmin

Here we chose the latest version 2.9.0.containers

2. Return to the Jelastic dashboard and deploy archive via Deployment manager to your application (e.g. myghost). To do this upload Ghost-2.9.0.zip file to Deployment ManagerCloud hosting

Platform as a Service

3. Once Ghost archive has been added to the Deployment Manager, press Deploy to button.ghost archive

4. Choose your environment in the appeared form and press Deploy.php

Wait a minute until your project is built and deployed.

Additionally, you can set up deployment hooks (follow corresponding link for the instructions).

Create MySQL Database via phpMyAdmin

1. In order to access admin panel, simply press the Open in Browser button located near your SQL Database Node.Node.js application

2. Input your Username and Password, which are sent to you by email while creating MySQL node, and press Go button.Deploy Ghost project

3. In phpMyAdmin dashboard click Databases tab, specify the database name (e.g. ghost), and create database by pressing Create button.ghost database

The created ghost database will be displayed in the list of available databases.Phpmyadmin

Configure Your Node.js Server

Change Node.js configuration files via Configuration File Manager by pressing Config button next to the application server layer within Jelastic dashboard:Ghost publishing platform

1. In the /home/jelastic/ROOT/core/server/config/defaults.json file change url and server sections by substituting <environment URL> with the actual link to your environment and <internal IP of Node.js container> with actual IP address of your Node.js node. Replace port 2368 with 8080.

{

“url”: “<environment URL>“,

   “server”: {

       “host”: “<internal IP of NodeJS container>“,

       “port”: 8080

   }

}Mysql hosting

ghost platform

  2. There are two files responsible for the ghost’s work mode we have to change:

The first file is /home/jelastic/ROOT/core/server/config/env/config.development.json

platform as a service paas

Substitute:

“url”: “http://localhost:2368”,
   “database”: {
       “client”: “sqlite3”,
       “connection”: {
           “filename”: “content/data/ghost-dev.db”
       },
       “debug”: false
   },

with

  “url”: “http://myghost.jelastic.cloud”,
   “database”: {
       “client”: “mysql”,
       “connection”: {
           “host” : “172.25.2.20”,
           “user” : “root”,
           “password” : “BFBpbr29254”,
           “database” : “ghost”
       }
   },

Where,

“url”: “http://myghost.jelastic.cloud” – environment url

“client”: “mysql” – used database type

“host”     : “172.25.2.20” – platform internal IP address of database node

“user”     : “root” DB username from email

“password”: BFBpbr29254” – DB password from email

“database”: “ghost” – the actual database name that was created in Create MySQL database section (ghost, in our case)php mysql

The second file is  /home/jelastic/ROOT/core/server/config/env/config.production.jsonapplication server

Substitute:

  “database”: {
       “client”: “mysql”,
       “connection”: {
           “host” : “127.0.0.1”,
           “user” : “root”,
           “password” : “”,
           “database” : “ghost”
       }
   },

with

   “database”: {
       “client”: “mysql”,
       “connection”: {
           “host” : “172.25.2.20”,
           “user” : “root”,
           “password” : “BFBpbr29254”,
           “database” : “ghost”
       }
   },

Where,

“client”: “mysql” – used database type

“host”     : “172.25.2.20” – platform internal IP address of database node

“user”     : “root” DB username from email

“password”: BFBpbr29254” – DB password from email

“database”: “ghost” – the actual database name that was created in Create MySQL database section (ghost, in our case)app configuration

3. Connect to Node.js server using Web SSH:Mysql database

And execute the following commands one by one to install database migration tool for knex which is a query builder for MySQL:

Go to ROOT directory:

cd ROOT
sudo npm install -g knex-migrator

Initialize your database based on your init scripts:

knex-migrator init

4. When the previous steps are successfully performed, all the necessary tables will be created and displayed in the following way:paas

5. Finally, restart the Node.js server using Restart Nodes button to apply the changes.Node.js hosting

Thus your Ghost application has been successfully hosted within the Jelastic platform. To get started, you just need to launch it by pressing Open in Browser button.Connect mysql database

Congratulations! Now you can benefit from all the functionality of Ghost application, creating and running your online publications, powered up by Jelastic PaaS. Try it out, just choose the Jelastic provider among the globally-available service partners.

ghost platform

 

 

Subscribe to get the latest updates