Am I really writing this post in english ??? Be aware that it is all new from me, I usually write in French only in my previous blogs.

Finding which host I needed

For some time I was looking to host my own Ghost.org blog but not on their official Pro package that cost too much for me. I tried to host it first on Digital Ocean and I was blawn away with de Ghost maturity. The installation and the product seemed perfect. But I wasn't ready to launch my blog. So I waited.

As I live in Europe, I wanted to host my new blog on a French (or at least European) provider. So I looked at OVH and Scaleway and got some Ghost blog up and running. But after a few days playing with my toys, I felt a problem with my setup. I am no engineer, neither am I a developer. And I was reading some documentation explaining how to "secure" your droplet, how to "update" your system, ... and so on. A lot of technical issues were coming at the surface. And I was not able to manage.

Then, I switch my focus to find a "managed" host which would keep control of the #boring tasks of maintaining a server alive and updated. And in the meantime, I would install the all new Ghost 3.0 ! Yeapeee.

I emailed two former hosts I used years ago. The first one, FastComet, was advertising a Ghost Hosting plan. I was confident in their capacity but doubtful about their reaction time to update Ghost to from 2.27 to 3.0. For record, Ghost 3.0 went public on 10/22/2019, and I am finishing this article on 11/05/2019.

The second host I contacted was Gandi.net. Gandi was my very first host and my registrar since my beginning in the World Wide Web. I was not confident at all because their "managed" hosting called Simple Hosting is advertised for developers (in my point of vue, remember I am no developer).

As of today, FastComet never replied to my inquiry. In the other hand, Gandi (#Valère) replied 30 minutes after with a draft tutorial and is kindly helping me with my new issues. You already understood which host I was beginning my journey with.

Installing Ghost on Gandi.net

This post translate my own experience but every technical details came from Valere from the Gandi.net team.

Prerequisites:

  • You should master SSH Keys.
  • You should understand what Git is.
  • You should have a terminal ready.

Unlike every tutorial about Ghost I found, this tutorial helps you create a Ghost Blog with version management (Git). It is very different from official tutorials from Ghost.org or DigitalOcean which install Ghost on a server with root access.


1. Create the right type of Simple Hosting instance

You can get an instance (and a free trial) on the Gandi Website. As Ghost works with Node.js and MySQL, choose this combination.

Next, you have to chose a size that suit your need. It depends of your project but I would suggest to pick at least a M plan (€8/month).

Gandi has two datacenters, one in Paris and one in Luxembourg: Pick one, no error possible.

Once your Simple Hosting instance has been created, you need to link a domain or sub-domain to it. This will correspond to the address of your Ghost Blog.

Gandi Documentation about linking a domain or sub-domain to your instance.

3. Download Ghost locally, and prepare the git repository

On your local computer, download the latest version of the Ghost source-code, then extract its contents into a project folder.

$ mkdir ghost && cd ghost/
$ wget https://github.com/TryGhost/Ghost/releases/download/3.0.2/Ghost-3.0.2.zip
$ unzip Ghost-3.0.2.zip
$ rm Ghost-3.0.2.zip

Alternatively, you can download the latest release yourself with you current browser, create a ghost folder "by hand" and unzip the release in this folder (as I did myself).

Next (only with the Terminal), initialize a git repository, and add a remote object pointing to the Simple Hosting instance. You can find the appropriate [instance_login] and [datacenter] parameters  to use under the "Deploy" tab of your instance within your Gandi account.

$ git init
$ git remote add gandi git+ssh://[instance_login]@git.[datacenter].gpaas.net/default.git

4. Create a database

First, activate and connect to the instance's SSH console. Some help.

Then use the "mysql" client tool to create an empty database, along with a database user/password with permissions to that database. You should save the credentials (database name is ghost below, database user is ghost below, database user password is YourMySQLPassword below) for later use.

$ mysql -u root -p
mysql> CREATE DATABASE ghost;
Query OK, 1 row affected (0.01 sec)
mysql> CREATE USER ghost;
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON ghost.* to 'ghost'@'localhost' identified by 'YourMySQLPassword';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
hosting-user@Ghost:/srv/data$ exit

Alternatively, you can perform the above steps using the "phpMyAdmin" GUI tool if you prefer, which is accessible via your instance's Control Panel. I used this alternative method.

5. Configure production settings

Back on your local computer, edit the "core/server/config/env/config.production.json" file. Be sure to change the url, mail-from address, host, user and password from your email provider, and database password to your specific settings.

Edit: from ghost 3.8 versions, the config.production.json file is located there: core/shared/config/env/config.production.json

Below is an example of what the file should look like:

{
"url": "http://example.com",
"mail": {
"from": "'example' example@example.com",
"transport": "SMTP",
"options": {
"host": "mail.gandi.net",
"port": 465,
"secureConnection": true,
"auth": {
"user": "example@example.com",
"pass": "YourPassword"
}
}
},
"server": {
"port": 8080
},
"database": {
"client": "mysql",
"connection": {
"socketPath": "/srv/run/mysqld/mysqld.sock",
"user": "ghost",
"password": "YourMySQLPassword",
"database": "ghost"
}
},
"paths": {
"contentPath": "content/"
},
"logging": {
"level": "info",
"rotation": {
"enabled": true
},
"transports": ["file", "stdout"]
}
}

You can find every detail you need for configuring your config.production.json file here:

Configuration - Adapt your publication to suit your needs
Find out how to configure your Ghost publication or override Ghost’s default behaviour with robust config options, including mail, storage, scheduling and more!

If you wish to use a GandiMail account for sending emails through your Ghost Blog, you can find all the information there.

6. Commit, push, and deploy

Now you're ready to commit the code to your local repository, push the changes to the remote repository, and then deploy the code. These lines of code will be useful to update Ghost with the future releases or tweak your config.production.json file if you are facing errors.

$ git add .
$ git commit -am 'first deploy of Ghost blog'
$ git push gandi master
$ ssh [instance_login]@git.[datacenter].gpaas.net deploy default.git

Wait a few minutes for the deployment to complete, and then you can navigate to the domain or sub-domain you configured earlier to access your Ghost blog. Just add /ghost and the end of the domain you configured to access the setup page (admin).

7. Install SSL

Gandi offer free SSL from Let's Encrypt. You can add one certificate on your domain with the information from there.

Next, you will need to edit your config.production.json file from step 5. Simply edit the url from "http://example.com" to "https://example.com".

You need to create a new commit and push your changes to Gandi master. To do this, reproduce the n°6 above.


Conclusion

This new Undisclosed Blog is running fine for a week and I am very satisfied with the support provided by the Gandi team. I was not accustomed to work with Git and had some difficulties setting-up the emails.