Setting up Ghost on Clever Cloud

Julien Tanguy, . Tagged

This is my latest attempt at resurrecting my old dev blog. This time, I chose to use a blogging platform instead of wiring a static site generator, just because I’m too lazy to design a mediocre-looking site. This time I chose to use Ghost, a blogging platform with a simple default theme.

For hosting I chose Clever Cloud, a Europe-based PaaS company. If you don’t know them already, I encourage you to check them out.

Setting up Ghost on Clever Cloud


There is an existing blog post on Clever Cloud’s blog on how to setup Ghost on their platform, but it’s quite old and both Ghost and Clever Cloud changed quite a lot since then. Here is an updated tutorial on how to deploy a Ghost instance, backed up by PostgreSQL and Cellar (an S3-compatible service). It uses Mailgun for emailing.


If you do not already have an account on Clever Cloud, just sign up here. You will also need a Mailgun account.

Clone the clevercloud-ghost project

The code is available on github.

Create the necessary applications

For this to run, you need:

  • A NodeJS application (any size)
  • A PostgreSQL addon
  • A Cellar addon

Add the necessary environment variables

You need to define the following variables:

  • BLOG_URL - The url of your blog
  • NODE_ENV - Set it to production
  • CELLAR_BUCKET - The name of the cellar bucket to store your assets
  • MAILGUN_SMTP_LOGIN - The SMTP login of your mailgun account
  • MAILGUN_SMTP_PASSWORD - The SMTP password of your mailgun account


You can start to use your Ghost instance as soon as it’s deployed, have fun!

Party hard

Bonus: adding syntax highlighting

If you plan to add syntax highlighting, you can use the Code Injection feature of Ghost to add a javascript syntax highlighter such as Highlight.js or Prism.js. Here is my setup.

In the Blog Header section:

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/solarized-light.min.css">
<style type="text/css">
    .hljs {
        background-color: transparent;
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/haskell.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/elm.min.js"></script>

In the blog footer section:


Disabling the mailer

If you do not want to use any mailer, just replace mail configuration in config.js:

-        mail: {
-            transport: 'SMTP',
-            options: {
-                service: 'Mailgun',
-                auth: {
-                    user: {
-                        $aliases: ['MAILGUN_SMTP_LOGIN']
-                    },
-                    pass: {
-                        $aliases: ['MAILGUN_SMTP_PASSWORD']
-                    }
-                }
-            }
-        },
+        mail: {},

If you want to use another mailer, you can change the mailer config. Here is the link to the official documentation on the available mailers http://support.ghost.org/mail, but please try to mimic my setup by putting your credentials in env vars instead of committing them to config.js.