Giter VIP home page Giter VIP logo

now-v2-ghost's Introduction

Ghost

This repo demonstrates deployment of the Ghost blogging software to Now, using Ghost as an npm module.

Additionally, it sets up a google cloud storage adapter (easy to swap out for another adapter), and a remote MySQL database (again, easy to swap out).

Setting up

There are a few pre-steps to deploying this to now, due to technical constraints:

  1. Change the content path in config.development.json to be the directory where you checked this project out, plus /content, for example /home/beyonk/Projects/ghost-example/content. This path must be absolute due to a bug in ghost v2.
  2. Add your google cloud storage key to the root directory as gcloud-storage-account.json.
  3. Run the application locally, just once, to migrate the DB (it can be slow the first time and break deployment).
  4. Follow deployment instructions below.

How to deploy

First, download now.

Then, clone this repository and run now:

$ git clone git://github.com/beyonk-adventures/now-ghost-v2
$ cd ghost
$ npm install
# Run the app first before the initial deployment, as the migrations can exceed now's timeout and cause a deployment error.
$ 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.

A note on Ghost database engines with Now

sqlite3

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.

mysql and postgres

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.

now-v2-ghost's People

Contributors

antony avatar

Stargazers

Kevin Ridgway avatar Fawwaz Muhammad avatar Lei avatar Flávio Carvalho avatar Jonathan Lovera avatar Will Felker avatar Mo avatar

Watchers

Aaron Moodie avatar  avatar James Cloos avatar Lei avatar  avatar

Forkers

rubel-hossain

now-v2-ghost's Issues

Content path does not exist

Hi there 👋,
I was testing this repo in now v2 and for some reason I am getting the following error:

Error: Your content path does not exist! Please double check `paths.contentPath` in your custom config file e.g. config.production.json.
    at module.exports.exports.Provider.doesContentPathExist (/var/task/user/server.js:266638:15)
    at Object.loadNconf (/var/task/user/server.js:52500:11)
    at Object.<anonymous> (/var/task/user/server.js:52517:27)
    at __webpack_require__ (/var/task/user/server.js:22:30)
    at Object.module.exports.module.exports (/var/task/user/server.js:290916:16)
    at __webpack_require__ (/var/task/user/server.js:22:30)
    at Object.module.exports.Object.defineProperty.value (/var/task/user/server.js:570803:16)
    at __webpack_require__ (/var/task/user/server.js:22:30)
    at Object.<anonymous> (/var/task/user/server.js:612676:17)
    at __webpack_require__ (/var/task/user/server.js:22:30)
    at startup (/var/task/user/server.js:38:19)
    at module.exports.EMAIL_RE (/var/task/user/server.js:44:18)
    at Object.<anonymous> (/var/task/user/server.js:47:10)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)

Here's my config.production.js

"use strict";

module.exports = {
  url: "https://ghost-example.jonlov.now.sh",
  auth: {
    type: "password"
  },
  paths: {
    contentPath: undefined
  },
  logging: {
    transports: ["stdout"]
  }
};

The only thing that I didn't setup is my Google Storage. Is a requirement to have a storage solution? What do you think it could be? Did you run into a similar bug when deploying?

Some help will be appreciated. Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.