Capistrano is erroring out on this command
* executing "cd -- /home/root/apps/case/releases/20130221234114 && bundle exec
rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile && cp --
/home/root/apps/case/shared/assets/manifest.yml
/home/root/apps/case/releases/20130221234114/assets_manifest.yml"
and I get this response after it
** [out :: 108.60.137.195] ruby
** [out :: 108.60.137.195] :
** [out :: 108.60.137.195] no -I allowed while running setgid
** [out :: 108.60.137.195] (
** [out :: 108.60.137.195] SecurityError
** [out :: 108.60.137.195] )
Can't seem to find anything related except for a couple of issues with Ruby compiling on macports. I'm using rbenv with Ruby 1.9.3-p385 on Debian 6.
Is it a shared (system-wide) install of rbenv? Old instructions (deleted from wiki as of now, but can be accessed at https://github.com/sstephenson/rbenv/wiki/Shared-install-of-rbenv/a86ef2e6b12254eeb7cecfd3bd878cf7382d1b4a) suggests setting SGID permission bit on Ruby interpreter, which triggers security warnings (and with a good reason).
Current rbenv documentation suggests installing a project-local installation (https://github.com/sstephenson/rbenv/wiki/Deploying-with-rbenv). Alternatively, it could use a system-wide installation without SGID, and using --deployment flag for bundler so that it doesn't try to write to system-wide directories.
Related
I have the following Capistrano snippet:
namespace :bundle do
task :install do
run "gem list && bundle -v"
end
end
When I run
cap bundle:install
I get the following output:
** [out :: ....compute-1.amazonaws.com]
** [out :: ....compute-1.amazonaws.com] *** LOCAL GEMS ***
** [out :: ....compute-1.amazonaws.com]
** [out :: ....compute-1.amazonaws.com]
** [out :: ....compute-1.amazonaws.com] bundler (1.3.4)
** [out :: ....compute-1.amazonaws.com] rake (10.0.3)
** [out :: ....compute-1.amazonaws.com] rubygems-bundler (1.1.1)
** [out :: ....compute-1.amazonaws.com] rvm (1.11.3.6)
** [out :: ....compute-1.amazonaws.com]
** [out :: ....compute-1.amazonaws.com] ERROR: Gem bundler is not installed, run `gem install bundler` first.
gem is showing bundler is installed, but when I try to run bundle -v, I get a contradicting error saying it's not? I don't understand why?
The other thing I tried was to login to the server via terminal, when I run bundle -v there, it works fine?
Any ideas what's wrong?
do you use rvm-capistrano gem? It will load RVM for you.
I managed to get my script working by adding some environment variables:
set :default_environment, {
:PATH => "/home/ubuntu/.rvm/gems/ruby-1.9.2-p320#my_gemset/bin:" +
"/home/ubuntu/.rvm/gems/ruby-1.9.2-p320#global/bin:" +
"/home/ubuntu/.rvm/rubies/ruby-1.9.2-p320/bin:" +
"/home/ubuntu/.rvm/bin:" +
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
:RUBY_VERSION => 'ruby-1.9.2-p320',
:GEM_HOME => '/home/ubuntu/.rvm/gems/ruby-1.9.2-p320#my_gemset',
:GEM_PATH => '/home/ubuntu/.rvm/gems/ruby-1.9.2-p320#my_gemset:/home/ubuntu/.rvm/gems/ruby-1.9.2-p320#global'
}
My deployment set up is to have Heroku precompile assets. I want them precompiled so I can send them to a CDN (via asset_sync) and I want that done on Heroku so I don't have any compiled assets in my repo. I set that up using Heroku's guide and that had been working great. I added turbo-sprockets-rails3 for a speed boost. It had all been working fine and then stopped; I can't figure out why.
Now when I deploy (without public/assets) the assets:precompile Rake task times out on Heroku. To see how long it's really taking, I went into a shell (heroku run bash):
~ $ time bundle exec rake assets:precompile
AssetSync: YAML file found /app/config/asset_sync.yml settings will be merged into the configuration
AssetSync: Syncing.
Using: Directory Search of /app/public/assets
AssetSync: Done.
real 19m29.575s
user 17m43.690s
sys 0m28.480s
Twenty minutes! But when I run it locally (2011 iMac), it's only only a few minutes:
$ env RAILS_ENV=production time bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
~/.rbenv/versions/1.9.3-p327-perf/bin/ruby ~/.rbenv/versions/1.9.3-p327-perf/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Invoke assets:cache:clean (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
AssetSync: YAML file found ~/Code/Ruby/myproject-rails/config/asset_sync.yml settings will be merged into the configuration
** Execute assets:cache:clean
** Execute assets:precompile:all
AssetSync: Syncing.
Using: Directory Search of ~/Code/Ruby/myproject-rails/public/assets
Uploading: assets/application-3a6de939348195e9610f1321df27837a.js
Uploading: assets/application-3a6de939348195e9610f1321df27837a.js.gz
Uploading: assets/jquery.min-959a5819c76e1508f5a8655c289c0de8.map
Uploading: assets/jquery.min.map
Uploading: assets/rails_admin/rails_admin-76cfbf31a605916a55eee29464ca3e6d.js
Uploading: assets/rails_admin/rails_admin-76cfbf31a605916a55eee29464ca3e6d.js.gz
AssetSync: Done.
179.92 real 19.29 user 3.98 sys
I wrote Heroku support over a week ago and after some days they said they'd escalate it to their Ruby buildback team, but I still haven't heard anything. Do any of the smart people on Stack Overflow have possible solutions?
The solution was to use tell Heroku to use Ruby 1.9.3, like my local machine. Apparently 1.9.3 is much faster at assets compilation than 1.9.2 which Heroku defaults to.
To fix it, make sure your Gemfile starts:
source "https://rubygems.org"
ruby "1.9.3"
# ...
More at Heroku docs on Ruby versions.
My heroku deployment is crashing with following errors.
2012-12-12T17:16:18+00:00 app[web.1]: bash: bundle: command not found
2012-12-12T17:16:19+00:00 heroku[web.1]: Process exited with status 127
2012-12-12T17:16:19+00:00 heroku[web.1]: State changed from starting to crashed
The Heroku documentation for this error is to set PATH and GEM variables as described in https://devcenter.heroku.com/articles/changing-ruby-version-breaks-path I tried that, however that too is not helping.
→ heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
→ heroku config:add GEM_PATH=vendor/bundle/ruby/1.9.1
→ heroku run rake db:migrate
Running rake db:migrate attached to terminal... up, run.7130
bash: bundle: command not found
Next, I tried setting Ruby version in my Heroku app. This increased the slugsize. But app was still not up.
Gemfile
ruby "1.9.2"
Pushed to Heroku
-----> Using Ruby version: ruby-1.9.2
-----> Installing dependencies using Bundler version 1.2.2
heroku run "ruby -v"
Running `ruby -v` attached to terminal... up, run.4483
ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]
Can someone please advice
The error is because your path is incorrect.
If you're trying to use Ruby 1.9.3 you don't need to do anything,
it's the default Ruby so you can remove those config vars.
If you're using
1.8.7 or 1.9.2, then upgrade to 1.9.3 as it's current.
If you're looking at using Ruby 2.0.0.p3 - you're on your own ;)
I recently installed the gem rvm-capistrano in order to deploy in my server. First, I tried to run cap deploy:setup. It seems that installed RVM, but for some reasons (permissions or something else), it couldn't install REE:
Warning:
*** [err :: myserver.com] Failed to create the file ruby-enterprise-1.8.7-2012.02.tar.gz
[...]
There was an error, please check /usr/local/rvm/log//*.log. Next we'll try to fetch via http.
** [out :: myserver.com] Trying ftp:// URL instead.
I didn't include more because is irrelevant.
Obviously in deploy.rb sudo options is set as 'root'.
adduser #{user} rvm
Fixed it for me. Where #{user} is the name of your cap deploy user.
I'm trying to run the ruby gem "mongo3" (http://mongo3.com/)
I'm new to gem, but I would think that running "gem mongo3" should execute it, but I get this error:
chris#Zombie:~$ gem mongo3
ERROR: While executing gem ... (RuntimeError)
Unknown command mongo3
So I did "gem which mongo3" and it said it is located at "/var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb". I then ran "ruby /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb" with the following result:
chris#Zombie:~$ ruby /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb
/var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3/node.rb:1:in `require': no such file to load -- json (LoadError)
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3/node.rb:1
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `require'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `require_all_libs_relative_to'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `each'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `require_all_libs_relative_to'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:53
I'm not sure what I'm doing wrong - I suspect that ruby and gems are confused about where the gems should be loaded from or something. Thanks!
You don't need to do a gem mongo3 or ruby /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb. Instead, just simply run mongo3.
Make sure to follow the usage instructions here to configure it or you'll get runtime errors.
Edit: If you don't install the gem using sudo, then you won't have proper write access to /usr/bin, meaning the mongo3 executable will not be in your path. You'll probably see a warning like this when installing:
WARNING: Installing to ~/.gem since /var/lib/gems/1.8 and
/usr/bin aren't both writable.
WARNING: You don't have /home/chris/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
You have two options: install the gem using sudo gem install mongo3 so it properly links to /usr/bin, or add /home/chris/.gem/ruby/1.8/bin to your path.