Giter VIP home page Giter VIP logo

fission-ghost's Introduction

Ghost is a free, open, simple blogging platform. Visit the project's website at http://ghost.org, or read the docs on http://support.ghost.org.

Deploy

Ghost v2.x

This has been forked from the Ghost 1.x on Heroky by cobyism. The Deploy button should "just work" -- you'll need to add S3 credentials after the fact if you want file uploads to work.

  • Edited the package.json to include the newest 2.x Ghost release and the newest Casper and S3 adapter modules
  • Removed package-lock.json so that newest packages are used automatically

Things you should know

After deployment,

  • First, visit Ghost at https://YOURAPPNAME.herokuapp.com/ghost to set up your admin account
  • The app may take a few minutes to come to life
  • Your blog will be publicly accessible at https://YOURAPPNAME.herokuapp.com
  • If you subsequently set up a custom domain for your blog, you’ll need to update your Ghost blog’s PUBLIC_URL environment variable accordingly, heroku config:set PUBLIC_URL=https://www.example.com

🚫🔻 Do not scale-up beyond a single dyno

Ghost does not support multiple processes.

If your Ghost app needs to support substantial traffic, then use a CDN add-on:

Using with file uploads disabled

Heroku app filesystems aren’t meant for permanent storage, so file uploads are disabled by default when using this repository to deploy a Ghost blog to Heroku. If you’re using Ghost on Heroku with S3 file uploads disabled, you should leave all environment variables beginning with S3_… blank.

Configuring S3 file uploads

To configure S3 file storage, create an S3 bucket on Amazon AWS, and then specify the following details as environment variables on the Heroku deployment page (or add these environment variables to your app after deployment via the Heroku dashboard):

  • S3_ACCESS_KEY_ID and S3_ACCESS_SECRET_KEY: Required if using S3 uploads. These fields are the AWS key/secret pair needed to authenticate with Amazon S3. You must have granted this keypair sufficient permissions on the S3 bucket in question in order for S3 uploads to work.

  • S3_BUCKET_NAME: Required if using S3 uploads. This is the name you gave to your S3 bucket.

  • S3_BUCKET_REGION: Required if using S3 uploads. Specify the region the bucket has been created in, using slug format (e.g. us-east-1, eu-west-1). A full list of S3 regions is available here.

  • S3_ASSET_HOST_URL: Optional, even if using S3 uploads. Use this variable to specify the S3 bucket URL in virtual host style, path style or using a custom domain. You should also include a trailing slash (example https://my.custom.domain/). See this page for details.

Once your app is up and running with these variables in place, you should be able to upload images via the Ghost interface and they’ll be stored in Amazon S3. ✨

Provisioning an S3 bucket using an add-on

If you’d prefer not to configure S3 manually, you can provision the Bucketeer add-on to get an S3 bucket (Bucketeer starts at $5/mo).

To configure S3 via Bucketeer, leave all the S3 deployment fields blank and deploy your Ghost blog. Once your blog is deployed, run the following commands from your terminal:

# Provision an Amazon S3 bucket
heroku addons:create bucketeer --app YOURAPPNAME

# Additionally, the bucket's region must be set to formulate correct URLs
# (Find the "Region" in your Bucketeer Add-on's web dashboard.)
heroku config:set S3_BUCKET_REGION=us-east-1 --app YOURAPPNAME

How this works

This repository is a Node.js web application that specifies Ghost as a dependency, and makes a deploy button available.

  • Ghost and Casper theme versions are declared in the Node app's package.json
  • Scales across processor cores in larger dynos via Node cluster API

Updating source code

Optionally after deployment, to push Ghost upgrades or work with source code, clone this repo (or a fork) and connect it with the Heroku app:

git clone https://github.com/bmann/fission-ghost
cd fission-ghost

heroku git:remote -a YOURAPPNAME
heroku info

Then you can push commits to the Heroku app, triggering new deployments:

git add .
git commit -m "Important changes"
git push heroku master

Watch the app's server-side behavior to see errors and request traffic:

heroku logs -t

See more about deploying to Heroku with git.

Upgrading Ghost

On each deployment, the Heroku Node/npm build process will auto-upgrade Ghost to the newest 2.x version. To prevent this behavior, use npm 5+ (or yarn) to create a lockfile.

npm install
git add package-lock.json
git commit -m 'Lock dependencies'
git push heroku master

Now, future deployments will always use the same set of dependencies.

To update to newer versions:

npm update
git add package-lock.json
git commit -m 'Update dependencies'
git push heroku master

Database migrations

Requires MySQL database, available through either of two add-ons:

Newer versions of Ghost frequently require changes to the database. These changes are automated with a process called database migrations.

After upgrading Ghost, you may see errors logged like:

DatabaseIsNotOkError: Migrations are missing. Please run knex-migrator migrate.

To resolve this error, run the pending migrations and restart to get the app back on-line:

heroku run knex-migrator migrate --mgpath node_modules/ghost
heroku restart

This can be automated by adding the following line to Procfile:

release: knex-migrator migrate --mgpath node_modules/ghost

Problems?

If you have problems using your instance of Ghost, you should check the official documentation or open an issue on the official issue tracker. If you discover an issue with the deployment process provided by this repository, then open an issue here.

License

Released under the MIT license, just like the Ghost project itself.

fission-ghost's People

Contributors

aorcsik avatar awendt avatar bastilian avatar blaze33 avatar bmann avatar browniefed avatar cobyism avatar csquared avatar elementalvoid avatar erictherobot avatar holic avatar janraasch avatar jiashuw avatar kevin-stripe avatar mars avatar octave avatar pross avatar rstrangh avatar saulshanabrook avatar surfacedamage avatar vinvasir avatar waterloo avatar zhenkyle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fission-ghost's Issues

When updating PUBLIC_URL, change doesn’t take affect until Heroku redeploy

On first install, a PUBLIC_URL of YOURAPPNAME.herokuapp.com is initially used. When you add a custom domain name in Heroku, and then update the PUBLIC_URL in Heroku environment variables, Ghost won’t pick up this change until a redeploy happens.

Redeploys mean that you need access to git on the command line (or have your Heroku app linked to a Github repo), which is not ideal.

You can commit an empty commit: https://stackoverflow.com/questions/41345744/redeploy-heroku-app-without-code-changes

And there is a relatively new Heroku plugin, Releases Retry https://www.npmjs.com/package/heroku-releases-retry, that doesn’t require a git commit but does need heroku command line tools.

Solutions:

  • fully document connecting git to your heroku app and doing an empty git commit

Infinite redirects with Cloudflare, S3, and Heroku SSL interactions

If you are using Cloudflare for your custom domains, and you’re using S3 with a Cloudflare hosted subdomain, and Heroku has a custom domain set with SSL turned on, your blog won’t load because of infinite redirects.

For https support for S3 buckets (e.g. s3subdomain.example.com pointing to s3subdomain.example.com.s3.amazon.com), Cloudflare SSL setting must be “Flexible”: Cloudflare makes http requests to s3subdomain.example.com and then serves up over https.

Because Flexible is set, Cloudflare makes http requests to ghostblog.example.com which is set on Heroku and Heroku by default sets up an SSL certificate and will redirect http requests to https, which causes infinite redirects.

Solution:

  • turn off Cloudflare proxying for your custom domain ghostblog.example.com
  • turn off SSL on Heroku

Neither of these are ideal, and is ONLY the case because you need to keep Flexible turned on to get https serving of S3 bucket subdomain (which you’re doing with Cloudflare because Amazon’s Cloudfront takes 53 steps to setup).

More reading on Cloudflare plus Heroku and Full SSL / Full SSL (Strict) is here https://www.viget.com/articles/heroku-cloudflare-the-right-way/

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.