Ghost Publishing Platform and Node.js Cloud Hosting with Jelastic PaaS

25

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 Environment

1. Log into your Jelastic PaaS account and click NEW ENVIRONMENT button at the top dashboard panel.

3093-1-create-new-environment

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.

3093-1-nodejs-application-server

3. Wait about a minute for your environment to be created.

3093-1-ghost-environment-created

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.

3093-1-add-ghost-project

Here we chose the latest version 2.9.0.

3093-1-ghost-latest-version

2. Return to the Jelastic PaaS 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 Manager.

3093-1-upload-ghost-archive

3093-1-upload-myghost-archive

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

3093-1-deploying-ghost-archive

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

3093-1-deploy-ghost-archive

Wait a minute until your project is built and deployed.

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

Create MySQL Database via phpMyAdmin

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

3093-1-open-database-admin-panel-in-browser

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

3093-1-phpmyadmin-login

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

3093-1-create-ghost-database

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

3093-1-phpmyadmin-ghost-database

Configure Node.js Server

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

3093-1-myghost-configuration

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 the actual IP address of your Node.js node. Replace port 2368 with 8080.

{
"url": "<environment URL>",
	"server": {
		"host": "<internal IP of Node.js container>",
		"port": 8080
	}
}

3093-1-myghost-internal-ip-address

3093-1-ghost-configuration-file

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.

3093-1-config-development

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” – internal IP address of database node;
  • “user”: “root” – database username from email;
  • “password”: “BFBpbr29254” – database password from email;
  • “database”: “ghost” – database name that was created in Create MySQL Database section (ghost, in our case).

3093-1-development-configuration

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

3093-1-application-server-configuration-file

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” – internal IP address of database node;
  • “user”: “root” – database username from email;
  • “password”: “BFBpbr29254” – database password from email;
  • “database”: “ghost” – database name that was created in Create MySQL Database section (ghost, in our case).

3093-1-production-configuration

3. Connect to Node.js server using Web SSH.

3093-1-myghost-web-ssh

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

cd ROOT

sudo npm install -g knex-migrator

knex-migrator init

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

3093-1-web-ssh-application-server

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

3093-1-restart-myghost-application-server-node

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

3093-1-myghost-open-in-browser

3093-1-ghost-publishing-platform-hosted

Congratulations! Now you can benefit from all the functionality of the Ghost application, creating and running your online publications, powered by Jelastic PaaS. Try it yourself with a free trial at our Jelastic PaaS platform.

SOURCEJelastic, Inc.