Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Using ember-cli-rails without the Rack middleware #427
This isn't so much an issue per se, but I'd like to introduce how I got ember-cli-rails working for us, as it might help someone else in a similar deployment situation.
Our deployment flow is the following:
Out of the box, ember-cli-rails doesn't work with this deployment strategy because it relies on the CDN fetching assets from your Rails application (to go through the Rack middleware).
I've managed to hack together the following to get it to work by compiling the ember app into my assets directory:
# config/intializers/ember.rb EmberCli.instance_variable_set(:@root, Rails.root.join("public/assets/ember-cli").tap(&:mkpath)) EmberCli.configure do |c| c.app :frontend, exclude_ember_deps: "jquery" end
And then bypassing ember-cli-rails middleware:
# in the template prepend = asset_url("/assets/ember-cli/apps/frontend/") include_ember_script_tags(:ember, prepend: prepend)
If this deployment strategy is something that ember-cli-rails would like to support, I'd be happy to make a PR that supports it in a cleaner fashion.
@pwim thanks for your interested in modifying
Please do submit a pull request, as we'd love to see what code changes are necessary to support your particular use case.
Some things to note before starting:
Please ping me on your PR -- I'm looking forward to seeing what we can change to support your use case.
I have an issue where the root cause is related to this, but I don't think a third-party deployment gem as suggested by @seanpdoyle would work for it. So let me chime in here. The issue is:
Out of the box, ember-cli-rails breaks rolling deployments on the Engine Yard platform.
The issue happens as follows:
So the issue is two-fold:
To solve these issues, I was researching how to configure the folder ember-cli-rails builds to, which happens to be exactly what the hack proposed by @pwim does.
Now while providing a clean and supported way to set the ember assets build folder would help a lot, I am wondering: would it make sense to change the default
Thank you SO MUCH for this @pwim
I highly urge for the embler-cli-rails team to adopt this strategy as some sort of plugin and mention it on the wiki, because for those of us who don't use the exact same deploy strategy that the gem supports, it is a complete nightmare to get things to work -- only this solution got things properly working, which to me was a huge regression considering the previous versions that used the asset pipeline made it so much easier for custom deployment strategies to work.
referenced this issue
Apr 7, 2016
Every new addition to the codebase takes time to both implement and maintain. The deployment strategy described above is unlike the deployment processes that have influenced how this gem has been implemented.
Since my and other maintainers don't use that strategy, we won't be able to efficiently maintain it.
If deploying to Heroku (via the configuration described in the README) doesn't suit your needs, we recommend you consider deploying via
The more recent changes to
The biggest theme to those changes was shifting responsibility away from Rails and toward EmberCLI, relying on that community's tools and best practices instead trying to keep pace from a Rails-centic perspective.
Whether or not Heroku or the Lightning Strategy is right for you, I strongly encourage that you consider adopting an
If you decide on an
Hi! The issues is closed, but nevertheless...
We have quite big Rails application with big EmberApp (still non-cli) which is but only a small part of frontend. Now we are on the move to Ember-Cli step by step and looking for minimal effort to do it and we have a problem with our setup like described above.
Reading the discussion I think the only ask is to add an option to configure the path where generated assets have to be stored in. I don't think you have to maintain or care about other deploy strategies. But as you can configure in Rails the most of stuff, so you can support an option to set the assets path.
The impossibility to change the tmp directory is just too inflexible, IMHO having said that tmp is not the best place to store anything.
The lines like