I'm in trouble with deployment of my ruby-on-rails app on heroku.
Deploy failed with following logs.
Starting process with command bundle exec thin start -R config.ru -e staging -p 6882
bash: bundle: command not found
And I noticed when deploy, bundler(1.3.2) is removed and bundler(1.5.2) is used even if I specify bundler version as '1.3.2'.
When deploy, Using bundler(1.5.2) is shown but there is no bundler in heroku run 'gem list'.
This is happen after I pushed the commit that includes some gem's updates.
After that deploy, all deploys are failed even if I deloy the commit that worked well before.
Do you have a ruby definition in your gemfile like so?
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.15'
.....
if you do, heroku will try to load bundler 1.5.2
try to update bundler like so
gem update bundler
then commit & push to heroku
I hope that helps
Thank you, everyone.
I fixed up this problem.
I tried all solutions in this post but couldn't get fixed, so I asked the heroku's support with detail information.
It is because I'm using the custom buildpack that not support Bundler 1.5.2.
So, I configure an app to use the Official Ruby Buildpack
heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-ruby
Related
When I'm using git push heroku master, I'm facing the issue as shown in the below figure:
Please help me in resolving the issue.
With your log error, your ruby is not supported by Heroku. Check Heroku document then upgrade your Ruby version here
As mentioned in the heroku error logs, your ruby version is not upto date.
In your Gemfile, add this line to the top.
ruby '2.5.3'
run bundle install, commit and push again to heroku.
Its always good practice to specify your ruby version for all your project. This is good when you are moving your project from one environment or different server.
Add ruby '2.5.3' in your Gemfile as top most line and bundle
I had an app deployed on Heroku and I am currently trying to create the same app on AWS.
I've copied my folder, created a complete separated repo on Github and installed ebcli, the setup looks fine.
When I try to run eb deploy, I have this error:
[Instance: i-03051e2a022886184] Command failed on instance. Return code: 1 Output: (TRUNCATED)...:in find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
from /opt/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems.rb:308:inactivate_bin_path'
from /opt/rubies/ruby-2.5.3/bin/bundle:23:in `'.
I've looked online and it says it comes from incompatibility between your gemlock file bundler version and actual bundler version.
I've tried to change my bundler version to this one, but I gave up and came back to 2.0.1 because I had to install too many dependencies otherwise.
I removed the gemlock, bundle again, but I still got the same error when trying to deploy.
With my heroku version, it always worked.
Any idea how to solve that?
Thanks a lot
We moved from Heroku to AWS a few months back as well and it will likely take some some custom scripting to get things to work.
It would help to know more about your EB environment, but I am assuming you are using Ruby 2.5 with Puma on Amazon Linux 2.9.0 (?)
Not sure what bundle version comes with that, But I don’t think it’s 2.x. so you have to add an .ebextensions file too install your preferred bundled version.
# .ebextensions/01_install_bundler.config
container_commands:
install_bundler:
command: “gem install bundler —-version 2.0.0”
More info on AWS Linux customizations
End of the day, we are much happier with our AWS environment (lower cost, better performance), but requires more work to get it set up
Actually the problem exists because the bundler version in the eb env is older than the one being used in the project source.
So the solution is to use a bundler version less or equal the eb env installed version.
First uninstalled the current bundler:
gem uninstall bundle
and then install the desired one:
gem install bundler -v 1.16.6
See more details
I have an application running remotely, and I just upgraded rails to version 4.2.8, which upgraded other gems as well. I ran service unicorn restart afterwards, but the log for unicorn gives me this error:
You have already activated unicorn 5.2.0, but your Gemfile requires unicorn 5.3.0. Prepending bundle exec to your command may solve this. (Gem::LoadError)
I have tried gem uninstall unicorn -v 5.2.0, which returned successfully, and then gem install -v 5.3.0, which also returned successfully. Afterwards, I ran service unicorn restart, but the error persists.
I noticed the bundle exec suggestion, but I'm not sure what I should prepend this command to.
Try deleting your gemfile.lock file, and then running bundle install again, which will repopulate it from scratch, that normally sorts out my gem conflicts.
That means that the version of unicorn running on your machine is different than the version specified in your application. service unicorn is probably pointing to unicorn installed on the server/computer not pointing to your apps version of unicorn, right? Then when that starts your application, your app is trying to load a different version of the gem.
You could also run unicorn within the context of your app, like bundle exec unicorn - How to start rails server in production mode using unicorn and config file?.
If you have found a solution, good. If not, next time, create a new rails app using a unique gemset like 2.3.1#myapp.
This way, when you deploy to a remote server you will avoid this type of gems conflicts.
This could be caused by you having two different sources for gems on your machine.
If you use something like RVM with gemsets, make sure you are using the correct gemset. Especially, be sure that your gem install and gem uninstall act upon the application-sepcific gemset and not on the system-wide gems. You can find details at https://rvm.io/gemsets.
Bundler also generates a separate gemset per application. So if you use bundler, you have to run all your commands by prepending them with bundle exec (e.g. bundle exec rspec spec). If you want to remove gems from the bundle, remove it from your Gemfile and run bundle update gem_in_question afterwards (this will also update your Gemfile.lock). You can find more at http://bundler.io/v1.14/guides/using_bundler_in_application.html#executing-commands---bundle-exec.
I hope that this helps to solve your problem.
I am not sure if I am missing anything here! How do I execute bundle show GEM_NAME for my heroku app?
I wanted to see what version of gem is installed on the running heroku application. I have messed up with my local bundle and now one of the gem is upgraded and its not backword compatible!
Any help?
Assuming you're using Heroku Cedar, you can run:
$ heroku run bundle show GEM_NAME
I tried this tip: https://github.com/thoughtbot/laptop/pull/14#issuecomment-3192270 .
On deploy I see
-----> Using RUBY_VERSION: ruby-1.9.3-p0
But my logs show the environment variable is not respected
INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
Hacky / experimental solutions accepted!
Edit: I am on the cedar stack.
Here's an update for everyone referencing this question... Heroku now allows you to specify your ruby version in your Gemfile, thanks to their addition to the latest version of bundler.
First run:
gem install bundler --pre
then add ruby '1.9.3' to your Gemfile as such.
source 'http://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.3'
The full release from Heroku with details is at http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/
Right, so Ruby 1.9.3 is definitely possibly. As you said hacky/experimental solutions were accepted - this is definitely one of them.
It's actually really simple;
Enable Heroku Labs's user_env_compile feature for your application.
Set a heroku config variable to RUBY_VERSION to ruby-1.9.3-p0 (heroku config:add RUBY_VERSION=ruby-1.9.3-p0)
ENSURE that the heroku PATH config variable has bin at the front (heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin)
When you next deploy you should see your application using 1.9.3 - the deployment output will show this too;
-> Heroku receiving push
-----> Ruby/Rails app detected
-----> Using RUBY_VERSION: ruby-1.9.3-p0
-----> Installing dependencies using Bundler version 1.1.rc.7
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Since May 10 it is possible to use Ruby 1.9.3 in an easier way. Just take a look at Heroku's blog:
http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/
I was able to get a Rails 3.2 app running on Ruby 1.9.3-p0 on Heroku cedar today
I followed the steps on
http://railsapps.github.com/rails-heroku-tutorial.html
ran into a problem locally with 1.9.3 and openssl
but was able to get an app deployed and working
http://mccaffrey-rails32-193.herokuapp.com
no Procfile
thin and pg in Gemfile
I added some debug output so you can see the rails and ruby version info
Its crazy that a basic rails app slug size is 28.9MB!
I had the same problem: Specifying 1.9.3 in my Gemfile, but it was using 1.9.2. This fixed it:
heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
According to the Heroku Cedar stack definition here Cedar currently only supports MRI 1.9.2. Have you tried contacting Heroku support? They're generally pretty responsive.
Edit: it's possible to 'fool' the platform sometimes into running some binaries such as running Haskell on Heroku so if you're feeling really dedicated you might be able to package something up. I imagine this isn't too easy with MRI though.