Closed mpapis closed 10 years ago
I'll try to add some context:
Deploying to a brand new VPS using capistrano, I was getting a file or directory not found error when my unicorn_init.sh script was being executed. The script could not find the unicorn wrapper.
mpapis suggested running gem wrappers regenerate
which works (when executed from within app_root).
I tried adding run "rvm #{rvm_ruby_string_evaluated} do gem regenerate wrappers"
to my deploy, but that does not seem to work. I have to manually run the gem wrappers regenerate
from app_root to get the wrappers working. Once the wrappers are regenerated, the server starts as expected.
When my deploy script runs, I get:
executing "rvm ruby-2.0.0-p353@arcsite_mysql do gem regenerate wrappers"
servers: ["ip"]
[ip] executing command
** [out :: ip] try also: gem pristine --binstubs
deploy log:
MacBook-Pro:arcsite_mysql <user>$ cap deploy_test deploy:cold
triggering load callbacks
* 2014-02-17 22:24:40 executing `deploy_test'
triggering start callbacks for `deploy:cold'
* 2014-02-17 22:24:40 executing `multistage:ensure'
* 2014-02-17 22:24:40 executing `deploy:cold'
* 2014-02-17 22:24:40 executing `deploy:update'
** transaction: start
* 2014-02-17 22:24:40 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@github.com:<company>/arcsite_mysql.git deploy_test"
command finished in 997ms
* executing "if [ -d /home/deployer/apps/arcsite/shared/cached-copy ]; then cd /home/deployer/apps/arcsite/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 6cdf5b5a30972b2da3b16867b89ac59ed64ab358 && git clean -q -d -x -f; else git clone -q -b deploy_test git@github.com:<company>/arcsite_mysql.git /home/deployer/apps/arcsite/shared/cached-copy && cd /home/deployer/apps/arcsite/shared/cached-copy && git checkout -q -b deploy 6cdf5b5a30972b2da3b16867b89ac59ed64ab358; fi"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 25430ms
copying the cached version to /home/deployer/apps/arcsite/releases/20140218042513
* executing "cp -RPp /home/deployer/apps/arcsite/shared/cached-copy /home/deployer/apps/arcsite/releases/20140218042513 && (echo 6cdf5b5a30972b2da3b16867b89ac59ed64ab358 > /home/deployer/apps/arcsite/releases/20140218042513/REVISION)"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 835ms
* 2014-02-17 22:25:14 executing `deploy:finalize_update'
triggering before callbacks for `deploy:finalize_update'
* 2014-02-17 22:25:14 executing `deploy:assets:symlink'
* executing "rm -rf /home/deployer/apps/arcsite/releases/20140218042513/public/assets && mkdir -p /home/deployer/apps/arcsite/releases/20140218042513/public && mkdir -p /home/deployer/apps/arcsite/shared/assets && ln -s /home/deployer/apps/arcsite/shared/assets /home/deployer/apps/arcsite/releases/20140218042513/public/assets"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 609ms
* 2014-02-17 22:25:14 executing `bundle:install'
* executing "cd /home/deployer/apps/arcsite/releases/20140218042513 && bundle install --gemfile /home/deployer/apps/arcsite/releases/20140218042513/Gemfile --system --without development test"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
** [out :: <IP_ADDRESS>] Using rake (10.0.4)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using i18n (0.6.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using multi_json (1.7.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using activesupport (3.2.13)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using builder (3.0.4)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using activemodel (3.2.13)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using erubis (2.7.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using journey (1.0.4)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rack (1.4.5)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rack-cache (1.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rack-test (0.6.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using hike (1.2.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using tilt (1.3.7)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using sprockets (2.2.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using actionpack (3.2.13)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using mime-types (1.23)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using polyglot (0.3.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using treetop (1.4.12)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using mail (2.5.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using actionmailer (3.2.13)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using arel (3.0.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using tzinfo (0.3.37)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using activerecord (3.2.13)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using activerecord-import (0.3.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rgeo (0.3.20)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rgeo-activerecord (0.5.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using activerecord-postgis-adapter (0.6.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using activeresource (3.2.13)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using addressable (2.3.4)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using bcrypt-ruby (3.0.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using sass (3.2.12)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using bootstrap-sass (3.1.0.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using cancan (1.6.9)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using highline (1.6.18)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using net-ssh (2.6.7)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using net-scp (1.1.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using net-sftp (2.1.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using net-ssh-gateway (1.2.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using capistrano (2.15.4)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using climate_control (0.0.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using cocaine (0.5.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using coffee-script-source (1.6.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using execjs (1.4.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using coffee-script (2.2.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rack-ssl (1.3.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using json (1.7.7)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rdoc (3.12.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using thor (0.18.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using railties (3.2.13)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using coffee-rails (3.2.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using cookiejar (0.3.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using daemons (1.1.9)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using dalli (2.6.4)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using fastercsv (1.5.5)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using dbf (2.0.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using orm_adapter (0.4.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using warden (1.2.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using devise (2.2.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using eco-source (1.1.0.rc.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using eco (1.0.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using eventmachine (1.0.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using em-socksify (0.3.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using http_parser.rb (0.6.0.beta.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using em-http-request (1.1.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using websocket-driver (0.2.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using faye-websocket (0.6.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using yajl-ruby (1.1.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using faye (0.8.9)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using forgery (0.5.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using haml (4.0.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using haml-rails (0.4)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using jqplot-rails (0.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using jquery-rails (2.2.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using jquery-ui-rails (4.0.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using kgio (2.8.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using openlayers-rails (0.0.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using paperclip (3.4.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using pg (0.15.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using polyamorous (0.5.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using private_pub (1.0.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using bundler (1.3.5)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rails (3.2.13)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using raindrops (0.11.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rgeo-shapefile (0.2.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rolify (3.2.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using rvm-capistrano (1.3.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using sass-rails (3.2.6)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using simple_form (2.1.0)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using spork (0.9.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using squeel (1.0.18)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using thin (1.5.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using transaction_isolation (1.0.3)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using uglifier (2.0.1)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using unicorn (4.6.2)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using will_paginate (3.0.4)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Using will_paginate-bootstrap (0.2.5)
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Your bundle is complete!
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Gems in the groups development and test were not installed.
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Use `bundle show [gemname]` to see where a bundled gem is installed.
** [out :: <IP_ADDRESS>]
command finished in 1284ms
* executing "chmod -R -- g+w /home/deployer/apps/arcsite/releases/20140218042513 && rm -rf -- /home/deployer/apps/arcsite/releases/20140218042513/public/system && mkdir -p -- /home/deployer/apps/arcsite/releases/20140218042513/public/ && ln -s -- /home/deployer/apps/arcsite/shared/system /home/deployer/apps/arcsite/releases/20140218042513/public/system && rm -rf -- /home/deployer/apps/arcsite/releases/20140218042513/log && ln -s -- /home/deployer/apps/arcsite/shared/log /home/deployer/apps/arcsite/releases/20140218042513/log && rm -rf -- /home/deployer/apps/arcsite/releases/20140218042513/tmp/pids && mkdir -p -- /home/deployer/apps/arcsite/releases/20140218042513/tmp/ && ln -s -- /home/deployer/apps/arcsite/shared/pids /home/deployer/apps/arcsite/releases/20140218042513/tmp/pids"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 557ms
triggering after callbacks for `deploy:finalize_update'
* 2014-02-17 22:25:16 executing `deploy:rvm_app_alias'
* executing "rvm alias create arcsite ruby-2.0.0-p353@arcsite_mysql"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
** [out :: <IP_ADDRESS>] Creating alias arcsite for ruby-2.0.0-p353@arcsite_mysql
** [out :: <IP_ADDRESS>] |
** [out :: <IP_ADDRESS>] /
** [out :: <IP_ADDRESS>] -
** [out :: <IP_ADDRESS>] \
** [out :: <IP_ADDRESS>] |
** [out :: <IP_ADDRESS>] /
** [out :: <IP_ADDRESS>] .
** [out :: <IP_ADDRESS>]
command finished in 917ms
* executing "rvm ruby-2.0.0-p353@arcsite_mysql do gem regenerate wrappers"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
** [out :: <IP_ADDRESS>] try also: gem pristine --binstubs
** [out :: <IP_ADDRESS>]
command finished in 1339ms
* 2014-02-17 22:25:18 executing `deploy:symlink_config'
* executing "ln -nfs /home/deployer/apps/arcsite/shared/config/database.yml /home/deployer/apps/arcsite/releases/20140218042513/config/database.yml"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 441ms
triggering after callbacks for `deploy:update_code'
* 2014-02-17 22:25:19 executing `deploy:assets:precompile'
triggering before callbacks for `deploy:assets:precompile'
* 2014-02-17 22:25:19 executing `deploy:assets:update_asset_mtimes'
* executing "[ -e /home/deployer/apps/arcsite/shared/assets/manifest* ] && cat /home/deployer/apps/arcsite/shared/assets/manifest* || echo"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 596ms
** Updating mtimes for ~944 assets...
servers: ["<IP_ADDRESS>"]
** scp upload #<StringIO:0x007fcae320ecd8> -> /home/deployer/apps/arcsite/TOUCH_ASSETS
[<IP_ADDRESS>] /home/deployer/apps/arcsite/TOUCH_ASSETS
* scp upload complete
* executing "cat /home/deployer/apps/arcsite/TOUCH_ASSETS | while read asset; do touch -c -- \"$asset\"; done && rm -f -- /home/deployer/apps/arcsite/TOUCH_ASSETS"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 1435ms
* executing "cd -- /home/deployer/apps/arcsite/releases/20140218042513 && bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 90727ms
* executing "ls -1 /home/deployer/apps/arcsite/shared/assets/manifest* | wc -l"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 614ms
* executing "ls /home/deployer/apps/arcsite/shared/assets/manifest*"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 507ms
* executing "ls -x /home/deployer/apps/arcsite/releases"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 508ms
* executing "cp -- /home/deployer/apps/arcsite/shared/assets/manifest.yml /home/deployer/apps/arcsite/releases/20140218042513/assets_manifest.yml"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 443ms
* 2014-02-17 22:26:54 executing `deploy:create_symlink'
* executing "rm -f /home/deployer/apps/arcsite/current && ln -s /home/deployer/apps/arcsite/releases/20140218042513 /home/deployer/apps/arcsite/current"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 484ms
** transaction: commit
* 2014-02-17 22:26:55 executing `deploy:migrate'
* executing "cd /home/deployer/apps/arcsite/releases/20140218042513 && bundle exec rake RAILS_ENV=staging db:migrate"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
command finished in 16324ms
* 2014-02-17 22:27:11 executing `deploy:start'
* executing "/etc/init.d/unicorn start"
servers: ["<IP_ADDRESS>"]
[<IP_ADDRESS>] executing command
** [out :: <IP_ADDRESS>] /home/deployer/apps/arcsite/current:
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Starting -
** [out :: <IP_ADDRESS>] /etc/init.d/unicorn: line 68: /home/deployer/.rvm/wrappers/arcsite/unicorn: No such file or directory
** [out :: <IP_ADDRESS>]
** [out :: <IP_ADDRESS>] Failed!
** [out :: <IP_ADDRESS>]
command finished in 572ms
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ruby-2.0.0-p353@arcsite_mysql' -c '/etc/init.d/unicorn start'" on <IP_ADDRESS>
There was an error in our call to run "rvm #{rvm_ruby_string_evaluated} do gem regenerate wrappers"
. It should be run "rvm #{rvm_ruby_string_evaluated} do gem wrappers regenerate"
. Notice that wrappers
and regenerate
were called in the wrong order
A deploy script like this works:
namespace :deploy do
task :rvm_app_alias, roles: :app do
run "rvm alias create #{application} #{rvm_ruby_string_evaluated}"
run "rvm #{rvm_ruby_string_evaluated} do gem wrappers regenerate"
#run "rvm wrapper #{application} --no-links --all"
end
after "deploy:finalize_update", "deploy:rvm_app_alias"
end
yep so we have confirmation the automated process did not work with bundler
(or capistrano
), I will investigate
gem list bundler
*** LOCAL GEMS ***
bundler (1.3.5)
bundler-unload (1.0.2)
rubygems-bundler (1.4.2)
does this problem still persist with bundler 1.7+
?
I've forgotten, what is the expected behavior? Should we not need the wrappers regenerate
line?
http://rvm.io/integration/init-d suggests alias
is enough, I guess you might need to upgrade all rvm, rubygems and bundler, then comment the line with wrappers regenerate
and check if it works now, let me know if the problem still persists
Bundler 1.7.2 appears to fix this issue
thank you!
forwarding wayneeseguin/rvm#2629 - need to check scenario with bundler, notify @workmaster2n