Has anyone deployed an ember-cli + rails app in Heroku like this one? https://github.com/bostonember/website If yes, how did/do you deploy?
I know that ember-cli produces all the necessary code in the dist/ dir, which should be placed (copied) under rails' public/ directory but I am not sure how and when to do that given that Heroku does not allow any write access in its filesystem. So if anyone has already done that, let me know :)
The reason that I chose ember-cli instead of the ember-rails gem is that I don't want to be dependent on any rails' gem developer. I think ember-cli is a good option as long as I can deploy efficiently in heroku :D
Dockyard worked through an example of this during a Boston Ember meetup. Here's the video.
They posted the code online, the important part being the deploy task of the rakefile:
task :deploy do
sh 'git checkout production'
sh 'git merge rails-served-html -m "Merging master for deployment"'
sh 'rm -rf backend/public/assets'
sh 'cd frontend && BROCCOLI_ENV=production broccoli build ../backend/public/assets && cd ..'
unless `git status` =~ /nothing to commit, working directory clean/
sh 'git add -A'
sh 'git commit -m "Asset compilation for deployment"'
end
sh 'git subtree push -P backend heroku master'
sh 'git checkout -'
end
Essentially, you copy the dist
from ember-cli
directly into Rails public folder, then deploy the rails subfolder as a rails app to Heroku using subtree. I've done this myself, and it works well.
Note that the approach in the "Lightening fast deployments" blog post @eXa linked to is ultimately better, since you can change your Ember app without touching or redploying your Rails app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With