Running Ghost on Joyent SmartOS

January 28, 2014 - by Ben Wen

Ghost is a new open-source blogging platform built with ease-of-publishing in mind. It's beautifully designed for modern clients like tablets and phones and built for writers who just want to get their ideas out (psst, a split-pane Markdown editor!) It also happens to be written on Node.js (among lots of other great open-source code).

This is how you can get a development Ghost implementation running on a Joyent hosted SmartOS machine. Assuming you've gotten a Joyent account and have your ssh keys set up...

The basic steps are:

  1. Create a SmartOS instance with the Node.js package (sdc:sdc:nodejs:13.3.1 as of this writing). The hacker special 256MB of RAM works fine (g3-standard-0.25-smartos) and it's about six bucks a month, billed in hourly increments.
  2. Note the external IP address (it will start with something other than 10.x or 192.x) when it's done provisioning by clicking on the new server's entry in the list. You may need to wait about 3-5 minutes and refresh the browser.
  3. Then ssh root@IP-ADDRESS from your laptop's Terminal or shell. The next few commands will assume you're ssh'd into your new instance. (*Windows users will need an ssh program like PuTTY)
  4. Install three needed packages with this command: pkgin install gmake unzip nano
  5. Download the image with curl -L -o /tmp/
  6. Next: mkdir ghost; cd ghost; unzip /tmp/; npm install --production. That last command may take a few minutes to run as it may build a few dependencies.
  7. Then copy over the example configuration file: cp config.example.js config.js
  8. Edit the config: nano config.js. Edit the first host: place you see with the IP-ADDRESS of the server. Change the port: section from "2368" to "80". Ctrl-O to save and Ctrl-X to exit.
  9. Fire up the Ghost server with npm start
  10. Point your browser at the IP-ADDRESS. You should see the Ghost welcome post. If you visit IP-ADDRESS/ghost you can create a login on the Ghost blog and create a new post.

Copy/Paste Commands:

ssh root@IP-ADDRESS ## Use your server 'IP-ADDRESS'
pkgin install gmake unzip nano
curl -L -o /tmp/
mkdir ghost; cd ghost; unzip /tmp/; npm install --production
cp config.example.js config.js
nano config.js ## Edit host: to 'IP-ADDRESS'; Edit port: to '80'
npm start

Some details

Ok, a couple of more detailed notes to help you along. If you're on the Joyent web interface, here's the node.js package

and the instance type

Command-line provisioning

If you're going cowboy and using the command line tools, here's the invocation:

sdc-createmachine -n Ghost -dataset "sdc:sdc:nodejs:13.3.1" -package "g3-standard-0.25-smartos"

To check on the provisioning status (it should take about 2-3 minutes) run this sdc-listmachines

or if you have json tools installed: sdc-listmachines | json -a -C "'Ghost'"

*To get the sdc tools and json tool: visit here

Config.js snapshot

Your config.js should have a stanza in the development: section that looks something like this (with a proper IP-ADDRESS where it says host:):

        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.
            port: '80'

What a happy server looks like

And when you start your server with npm start you should see something like this

Ghost is running in development...
Listening on
Url configured as:
Ctrl+C to shut down

(Note: ignore the URL, that's a dummy placeholder.)

Have fun!

This set up is for toying around with Ghost. It doesn't have any production features like SSL protection of logins or anything. I'll be following up with a post on enabling using nginx as a front-end with a domain and enabling SSL. Enjoy!