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

How to deploy? #505

Closed phortx closed 7 years ago

phortx commented 7 years ago

I'm currently trying to deploy my Rails app with ember-cli-rails. I've got a frontend/ directory containing the ember app.

My deploy process before ember was:

That worked like a charm.

As far as I understood should rails assets:precompile precompile the ember assets too via ember build. But the compiled app will be put into the /tmp directory. Is that correct?

I've tried to move the files from tmp/ember-cli/apps/ to public/ but still getting the error EmberCLI failed to generate an index.html file on the server at the first request.

Can you help me?

Which operating system and version is the project developed on? OSX 0.12.1

Which version of ruby is the project developed on? 2.3.1p112

Which version of npm is the project developed on? 3.10.9

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

What is the rails version? 5.0.0.1

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)? yes (phusion passenger)

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

EmberCli.configure do |c|
  c.app :frontend
end

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

<script type="application/javascript">
  window.I18n = {
    locale: '<%= I18n.locale %>',
    defaultLocale: 'de'
  };
</script>

<%= render_ember_app params[:ember_app] do |head| %>
    <% head.append do %>
        <%= csrf_meta_tags %>
    <% end %>
<% end %>

How are the EmberCLI-related routes defined?

mount_ember_app :frontend, to: '/'

How is the application deployed? Nginx + Phusion Passenger

seanpdoyle commented 7 years ago

Thanks for opening this issue.

Could you please follow the guidelines for Reporting an Issue specified in the CONTRIBUTING.md?

Could you re-write your issue using our Issue Template in order to provide the projects' maintainers with the most information available, so that we can help understand and resolve your issues?

phortx commented 7 years ago

Thanks for the fast response! I've updated the issue description.

phortx commented 7 years ago

Do you have any hint how to fix that issue?

seanpdoyle commented 7 years ago

The deployment process that ember-cli-rails works best with out of the box depends on the asset compilation happening on the server itself.

For instance, when deploying to Heroku, ember-cli-rails hooks into the rake assets:precompile task to generate its assets, so that they can be included in the slug that is deployed to the dynos.

The same is true for Capistrano, where the servers run rake assets:precompile locally.

If the EmberCLI asset compilation occurs locally on your development machine, you should consider other EmberCLI deployment strategies.

The EmberCLI Deploy project is a collection of such strategies.

The only deployment strategy that ember-cli-rails integrates at this time is the Redis-backed "Lightning" strategy. If you're interested in using this deployment strategy, check out the ember-cli-rails-deploy-redis gem.

If you decide to use another deployment strategy that isn't yet supported by ember-cli-rails, please open an issue, and we can decide how to proceed.

Alternatively, is it possible to move the asset compilation onto the servers themselves?

phortx commented 7 years ago

Thank you very much for you comprehensive answer! We had some troubles with compiling the assets on the server, however I'll try to get that running and tell you if it worked :)

seanpdoyle commented 7 years ago

I'll close this issue for now.

Have you had any success with incorporating the feedback in https://github.com/thoughtbot/ember-cli-rails/issues/505#issuecomment-267629756?

If not, please share some of your issues and I'll reopen this.

phortx commented 7 years ago

Sorry for the late response ... I was too busy lately to focus on our deployments.

I've tried to move the asset compilation to the server, that works.

Thank you very much, for your time and help! <3

phortx commented 7 years ago

However: Locally precompiling have to be possible soon, to reduce downtime while deploying and to enable the usage of a CDN and so on.