tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

Can I deploy a Rails 5.0.0.1 API app with `ember-cli-rails`?? #513

Open petrosp opened 7 years ago

petrosp commented 7 years ago

Which operating system and version is the project developed on? macOS El Capitan - 10.11.6

Which version of ruby is the project developed on? 2.3.3

Which version of npm is the project developed on? 3.10.10

Which version of ember-cli is the project developed on? 2.10

What is the rails version? 5.0.0.1 (API version)

What is the ember-cli-rails version (from Gemfile)? 0.8.3

What is the ember-cli-rails-addon version (from package.json)? 0.8.0

Is your application server multi-threaded (such as puma and unicorn) or is it multi-process (such as thin and webrick)? puma

What are the contents of config/initializers/ember.rb?

EmberCli.configure do |c|
  c.app :frontend, path: '../../frontend'
end

What are the contents of the Rails' view that renders the Ember application? Have no views

How are the EmberCLI-related routes defined? mount_ember_app :frontend, to: '/'

How is the application deployed? I am using mina to deploy the Rails app

So my issue is this:

I generated the app using the --api switch, thus there are no sprockets. The deployment of the rails app is fine but the ember app - which compiles during the asset pipeline compilation - fails as expected, since the Rails assets do not exist as this is an API app.

Is there an alternative way to compile ember's assets for this rails app, without haveing asset pipeline involved during the deployment process?

I did compiled them on the server independently, i.e. logged in and run ember:compile which do create the ember assets under the #{Rails.root}/tmp/ember-cli/apps/frontend but I am not quite sure where to put those, is it under #{Rails.root}/public`?

enzolry commented 7 years ago

Same problem here, every tutorials advice to create a rails --api app but there's nothing about it in the description of this gem.

mcfiredrill commented 7 years ago

The idea behind the --api switch is too create a rails app that only serves an API (presumably JSON) and not render any HTML. http://edgeguides.rubyonrails.org/api_app.html

It doesn't really make sense to use this Gem if you are using rails api, in that case you would deploy and serve your ember application HTML separately.

tibomogul commented 7 years ago

The answer to your question is Yes, and can be easily done on Heroku. I am not familiar with Mina though.

Main advantages for me of having the API and the Ember front-end together:

  1. One repo
  2. Can do integrated testing of ember and rails through the UI e.g. rspec and spinach
mcfiredrill commented 7 years ago

Main advantages for me of having the API and the Ember front-end together:

One repo Can do integrated testing of ember and rails through the UI e.g. rspec and spinach

That's all fine, but why use the --api switch then?

tibomogul commented 7 years ago

because, aside from the Ember app, you have other consumers of your API.