This repo demonstrates deployment of the Ghost blogging software to Now, using Ghost as an npm module.
First, download now
. Then, clone this
repository and run now
:
$ git clone git://github.com/now-examples/ghost
$ cd ghost
$ npm install
$ NODE_ENV=development npm start
# make changes to your Ghost database locally before deploying
$ now
Example: https://now-examples-ghost.now.sh/
You can tweak the config.*
JSON files and content
directory to your liking,
and then re-deploy by running now
again.
The file system on Now deployments is immutable. So knowing this, if you're
going to stick with the default sqlite3
backend (which is file system
based) then you should follow the typical Now-deployment paradigm. That is:
- Start Ghost up locally in development mode:
NODE_ENV=development npm start
- Write a blog post and publish it so that the local sqlite database is updated
- Create a new Now deployment and re-alias your URL
This paradigm requires a new deployment for any new blog posts or changes, and when upgrading Ghost.
If you want to use a mysql
or postgres
database service, then you'll have
to update the config JSON files to point to an externally hosted database.
If you go this route then your Now deployment is more "live" such that you can
edit and publish posts without creating a new Now deployment, so the workflow
looks more like:
- Edit the config JSON files to point to your database server
- Create a Now deployment and re-alias your URL
- At this point you can go to the admin panel on your Now deploment URL and make desired changes
This paradigm requires a new deployment only when upgrading Ghost, or tweaking database settings. However, you end up losing some of the inherent features of unique Now deployments, like being able to easily roll back a change or preview changes before aliasing.