Skip to content

Instantly share code, notes, and snippets.

@kpfefferle
Last active October 30, 2017 18:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kpfefferle/8515b3044cf0cff7bcfc to your computer and use it in GitHub Desktop.
Save kpfefferle/8515b3044cf0cff7bcfc to your computer and use it in GitHub Desktop.
Deployment Options for Ember with Rails

Deploying Ember with Rails

The following options allow us to deploy Ember with Rails while still retaining the use of ember-cli for Ember development.

1. ember-cli-deploy

This method relies on Redis (or some other key/value store) as the integration point between Ember and Rails. When the Ember application is deployed, app assets (JS, CSS, images, etc) are uploaded straight to an asset host like S3/CloudFront. The bootstrapping markup for the Ember app is inserted into the key/value store and then is retrieved from there to be served up by Rails.

Advantages of ember-cli-deploy

  • Allows the front-end Ember app to be developed and deployed independently from the Rails app
  • Since multiple versions of the Ember app can be stored in the key/value store, it is possible to test a particular version before enabling for all users
  • Allows for Ember apps to be inserted anywhere within the Rails app while still being developed with ember-cli
  • Ember and Rails apps can exist in separate git repositories

Disadvantages of ember-cli-deploy

  • Has the most moving parts and setup of the three options presented here
  • Ember apps must be launched separately in development

2. Static hosting

Ember apps can be deployed entirely on their own as a distinct separate entity from the Rails app. This approach requires both static asset and site hosting (for the bootstrap markup). The Ember app would be referenced by a different subdomain than the Rails app and use the Rails app purely as an API.

Advantages of static hosting

  • Allows the front-end Ember app to be developed and deployed independently from the Rails app
  • Simplest approach to deploying a self-contained Ember application with fewest moving parts
  • Ember and Rails apps can exist in separate git repositories

Disadvantages of static hosting

  • Multiple subdomains for multiple apps
  • Limited integration within Rails contexts (assumes Rails is being used purely as a backing API)
  • Ember apps must be launched separately in development

3. ember-cli-rails

GitHub

The ember-cli-rails approach keeps the ember-cli app development within the context of the Rails repository. The Ember app uses ember-cli within a root-level directory of the Rails repository and integrates into the Rails asset pipeline.

Advantages of ember-cli-rails

  • Combined Rails and Ember repositories and development workflow
  • Allows for multiple Ember apps to exist within the Rails repository
  • End-to-end integration testing with tools like Cucumber "just works"

Disadvantages of ember-cli-rails

  • Assumes every developer needs both the Rails and Ember apps at all times
  • Conflates the Rails and Ember apps into one project and repository
  • Rails and Ember projects are versioned and deployed together
  • Build and deploy times with the asset pipeline are much longer than using ember-cli alone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment