A Heroku Buildpack for Ember Applications
HTML Shell Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
config
LICENSE
README.md

README.md

Heroku Buildpack for Ember Applications

This buildpack will work out-of-the-box with Ember applications. It installs nginx and is capable of hosting an Ember application using the browser's history API (location: 'history').

This buildpack is derived from Tony Coconate's heroku-buildpack-ember-cli.

Usage

To declare the buildpack while creating a new Heroku application:

$ heroku create --buildpack https://github.com/railsdiff/heroku-buildpack-ember-static.git

To update an existing application's buildpack:

$ heroku buildpack:set https://github.com/railsdiff/heroku-buildpack-ember-static.git

Configuration

Variables

You can set a few different environment variables to turn on features in this buildpack.

Nginx Workers

Set the number of workers for Nginx (Default: 4):

$heroku config:set NGINX_WORKERS=4

API Proxy

Set an API proxy URL:

$ heroku config:set API_URL=http://api.example.com/

Set your API's prefix path (Default: /api/):

$ heroku config:set API_PREFIX_PATH=/api/

Note that the trailing slashes are important. For more information about API proxies and avoiding CORS, read this.

Authentication

Have a staging server? Want to protect it with authentication? When BASIC_AUTH_USER and BASIC_AUTH_PASSWORD are set basic authentication will be activated:

$ heroku config:set BASIC_AUTH_USER=EXAMPLE_USER
$ heroku config:set BASIC_AUTH_PASSWORD=EXAMPLE_PASSWORD

Be sure to use https when you set this up for added security.

Force HTTPS/SSL

For most Ember applications that make any kind of authenticated requests (sending an auth token with a request for example), HTTPS should be used. Enable this feature in nginx by setting FORCE_HTTPS.

$ heroku config:set FORCE_HTTPS=true

Before and After Hooks

You can run your own scripts by creating after_hook.sh or before_hook.sh files (or both) in your app's hooks directory:

$ mkdir hooks
$ cd hooks
$ touch after_hook.sh
$ touch before_hook.sh

See the section on Compass for an example.

Prerender.io

Prerender.io allows your application to be crawled by search engines.

Set the service's host and token:

$ heroku config:set PRERENDER_HOST=service.prerender.io
$ heroku config:set PRERENDER_TOKEN=<your-prerender-token>

Sign up for the hosted Prerender.io service or host it yourself. See the project's repo for more information.

Custom Nginx

Need to make a custom nginx configuration change? No problem. In your Ember CLI application, add a config/nginx.conf.erb file. You can copy the existing configuration file in this repo and make your changes to it.