I'm experiencing an intermittent problem when deploying my rails app with capistrano. After the .gz is uploaded to the server, the log shows an error coming from tar, which says that the time stamp is in the future (see output below). This message repeats for what seems to be every file in the app.
I compared the server time against the numeric name of the .tar.gz file, and it's indeed a few minutes ahead. But how does this correlate to the actual timestamp on the files? And how can I get my changes to deploy correctly?
** sftp upload /var/folders/lo/loIUAyGAHFWqSREiNHhm-E+++TI/-Tmp-/20110603143429.tar.gz -> /tmp/20110603143429.tar.gz
[123.45.67.890] /tmp/20110603143429.tar.gz
[123.45.67.890] done
* sftp upload complete
* executing "cd /home/blah/releases && tar xzf /tmp/20110603143429.tar.gz && rm /tmp/20110603143429.tar.gz"
servers: ["123.45.67.890"]
[123.45.67.890] executing command
** [out :: 123.45.67.890] tar: 20110603143429/.autotest: time stamp 2011-06-03 14:34:33 is 368.72042712 s in the future
** [out :: 123.45.67.890] tar: 20110603143429/.bundle: time stamp 2011-06-03 14:34:33 is 368.719540808 s in the future
** [out :: 123.45.67.890] tar: 20110603143429/.hgignore: time stamp 2011-06-03 14:34:33 is 368.719465444 s in the future
** [out :: 123.45.67.890] tar: 20110603143429/app: time stamp 2011-06-03 14:34:34 is 369.719382175 s in the future
** [out :: 123.45.67.890] tar: 20110603143429: time stamp 2011-06-03 14:34:49 is 383.369448435 s in the future
command finished in 1616ms
* executing `deploy:finalize_update'
* executing "chmod -R g+w /home/blah/releases/20110603143429"
servers: ["123.45.67.890"]
[123.45.67.890] executing command
command finished in 193ms
* executing "rm -rf /home/blah/releases/20110603143429/log /home/blah/releases/20110603143429/public/system /home/blah/releases/20110603143429/tmp/pids &&\\\n mkdir -p /home/blah/releases/20110603143429/public &&\\\n mkdir -p /home/blah/releases/20110603143429/tmp &&\\\n ln -s /home/blah/shared/log /home/blah/releases/20110603143429/log &&\\\n ln -s /home/blah/shared/system /home/blah/releases/20110603143429/public/system &&\\\n ln -s /home/blah/shared/pids /home/blah/releases/20110603143429/tmp/pids"
servers: ["123.45.67.890"]
[123.45.67.890] executing command
command finished in 257ms
* executing "find /home/blah/releases/20110603143429/public/images /home/blah/releases/20110603143429/public/stylesheets /home/blah/releases/20110603143429/public/javascripts -exec touch -t 201106031435.03 {} ';'; true"
servers: ["123.45.67.890"]
[123.45.67.890] executing command
command finished in 1911ms
triggering after callbacks for `deploy:update_code'
* executing `bundle:install'
* executing "ls -x /home/blah/releases"
servers: ["123.45.67.890"]
[123.45.67.890] executing command
command finished in 140ms
* executing "bundle install --gemfile /home/blah/releases/20110603143429/Gemfile --path /home/blah/shared/bundle --deployment --quiet --without development test"
servers: ["123.45.67.890"]
[123.45.67.890] executing command
** [out :: 123.45.67.890] sh: bundle: not found
command finished in 158ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/blah/releases/20110603143429; true"
servers: ["123.45.67.890"]
[123.45.67.890] executing command
command finished in 261ms
failed: "sh -c 'bundle install --gemfile /home/blah/releases/20110603143429/Gemfile --path /home/blah/shared/bundle --deployment --quiet --without development test'" on 123.45.67.890
It sounds like you have have clock-skew. All all the computers involved in the process -- those commiting, those sending, those receiving/deploying in sync?
Related
Trying to deploy a simple rails to staging on ec2 with rubber. Process fails with following error. Have been trying for days to find a solution but can't figure it out.
Anyone know why it fails?
* 2014-03-05 15:20:13 executing `deploy:setup'
* executing "sudo -p 'sudo password: ' mkdir -p /mnt/bott.ly-production /mnt/bott.ly-production/releases /mnt/bott.ly-production/shared /mnt/bott.ly-production/shared/system /mnt/bott.ly-production/shared/log /mnt/bott.ly-production/shared/pids"
servers: ["staging.bott.ly"]
[staging.bott.ly] executing command
command finished in 1134ms
* executing "sudo -p 'sudo password: ' chmod g+w /mnt/bott.ly-production /mnt/bott.ly-production/releases /mnt/bott.ly-production/shared /mnt/bott.ly-production/shared/system /mnt/bott.ly-production/shared/log /mnt/bott.ly-production/shared/pids"
servers: ["staging.bott.ly"]
[staging.bott.ly] executing command
command finished in 1439ms
triggering after callbacks for `rubber:bootstrap'
* 2014-03-05 15:20:17 executing `rubber:collectd:bootstrap'
* executing "echo $(grep Rubber /etc/collectd/collectd.conf 2> /dev/null)"
servers: ["staging.bott.ly"]
[staging.bott.ly] executing command
command finished in 1208ms
* 2014-03-05 15:20:20 executing `deploy:setup'
* executing "sudo -p 'sudo password: ' mkdir -p /mnt/bott.ly-production /mnt/bott.ly-production/releases /mnt/bott.ly-production/shared /mnt/bott.ly-production/shared/system /mnt/bott.ly-production/shared/log /mnt/bott.ly-production/shared/pids"
servers: ["staging.bott.ly"]
[staging.bott.ly] executing command
command finished in 1187ms
* executing "sudo -p 'sudo password: ' chmod g+w /mnt/bott.ly-production /mnt/bott.ly-production/releases /mnt/bott.ly-production/shared /mnt/bott.ly-production/shared/system /mnt/bott.ly-production/shared/log /mnt/bott.ly-production/shared/pids"
servers: ["staging.bott.ly"]
[staging.bott.ly] executing command
command finished in 269ms
** updating code for bootstrap
* 2014-03-05 15:20:24 executing `deploy:update_code'
* getting (via checkout) revision to C:/Users/solanmi/AppData/Local/Temp/20140305142024
executing locally: xcopy . "C:/Users/solanmi/AppData/Local/Temp/20140305142024" /S/I/Y/Q/E
378 File(s) copied
command finished in 4328ms
* processing exclusions...
* Compressing C:/Users/solanmi/AppData/Local/Temp/20140305142024 to C:/Users/solanmi/AppData/Local/Temp/20140305142024.tar.gz
executing locally: tar czf 20140305142024.tar.gz 20140305142024
command finished in 51ms
shell command failed with return code pid 8760 exit 53
Looks like you are deploying from Windows and you may be missing the tar command locally or it's not in your $PATH
If you want to use Cygwin I recommend you install it using the it's Setup64 or Setup-x86 program. I believe the tar package is one of the default packages that get installed. If not you can find it here: http://gnuwin32.sourceforge.net/packages/gtar.htm
I've been trying to deploy my site to Webfaction from Github via Capistrano 2, and I've definitely made some progress.
Here's my repo: https://github.com/jaronoff/new_site
I'm trying to deploy to josharonoff.com
I finally have my deploy.rb the way I want it, and I checked cap deploy:status works fine, I run cap deploy and it works fine, but I for some reason am getting this error even though I've restarted via the deploy.rb file.
error:
ActiveRecord::PendingMigrationError at /
Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue.
When I run the cap deploy, the output I get says that it's deployed correctly, and even does the db migration to the rails env of production... so I'm not sure what I'm doing wrong.
Here's the output from the console when I run cap deploy:
* 2014-02-13 14:43:39 executing `deploy'
* 2014-02-13 14:43:39 executing `deploy:update'
** transaction: start
* 2014-02-13 14:43:39 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git#github.com:jaronoff/new_site.git master"
command finished in 2251ms
* executing "if [ -d /home/jaronoff/webapps/ac_site/shared/cached-copy ]; then cd /home/jaronoff/webapps/ac_site/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 3b7d990f32d1fa2bdb7153d1c00548fec510eb33 && git clean -q -d -x -f; else git clone -q -b master git#github.com:jaronoff/new_site.git /home/jaronoff/webapps/ac_site/shared/cached-copy && cd /home/jaronoff/webapps/ac_site/shared/cached-copy && git checkout -q -b deploy 3b7d990f32d1fa2bdb7153d1c00548fec510eb33; fi"
servers: ["web432.webfaction.com"]
[web432.webfaction.com] executing command
command finished in 1956ms
copying the cached version to /home/jaronoff/webapps/ac_site/releases/20140213194344
* executing "cp -RPp /home/jaronoff/webapps/ac_site/shared/cached-copy /home/jaronoff/webapps/ac_site/releases/20140213194344 && (echo 3b7d990f32d1fa2bdb7153d1c00548fec510eb33 > /home/jaronoff/webapps/ac_site/releases/20140213194344/REVISION)"
servers: ["web432.webfaction.com"]
[web432.webfaction.com] executing command
command finished in 233ms
* 2014-02-13 14:43:44 executing `deploy:finalize_update'
* executing "chmod -R -- g+w /home/jaronoff/webapps/ac_site/releases/20140213194344 && rm -rf -- /home/jaronoff/webapps/ac_site/releases/20140213194344/public/system && mkdir -p -- /home/jaronoff/webapps/ac_site/releases/20140213194344/public/ && ln -s -- /home/jaronoff/webapps/ac_site/shared/system /home/jaronoff/webapps/ac_site/releases/20140213194344/public/system && rm -rf -- /home/jaronoff/webapps/ac_site/releases/20140213194344/log && ln -s -- /home/jaronoff/webapps/ac_site/shared/log /home/jaronoff/webapps/ac_site/releases/20140213194344/log && rm -rf -- /home/jaronoff/webapps/ac_site/releases/20140213194344/tmp/pids && mkdir -p -- /home/jaronoff/webapps/ac_site/releases/20140213194344/tmp/ && ln -s -- /home/jaronoff/webapps/ac_site/shared/pids /home/jaronoff/webapps/ac_site/releases/20140213194344/tmp/pids"
servers: ["web432.webfaction.com"]
[web432.webfaction.com] executing command
command finished in 254ms
* executing "find /home/jaronoff/webapps/ac_site/releases/20140213194344/public/images /home/jaronoff/webapps/ac_site/releases/20140213194344/public/stylesheets /home/jaronoff/webapps/ac_site/releases/20140213194344/public/javascripts -exec touch -t 201402131943.44 -- {} ';'; true"
servers: ["web432.webfaction.com"]
[web432.webfaction.com] executing command
** [out :: web432.webfaction.com] find: `/home/jaronoff/webapps/ac_site/releases/20140213194344/public/images': No such file or directory
** [out :: web432.webfaction.com] find: `/home/jaronoff/webapps/ac_site/releases/20140213194344/public/stylesheets': No such file or directory
** [out :: web432.webfaction.com] find: `/home/jaronoff/webapps/ac_site/releases/20140213194344/public/javascripts': No such file or directory
command finished in 195ms
* 2014-02-13 14:43:45 executing `deploy:create_symlink'
* executing "rm -f /home/jaronoff/webapps/ac_site/current && ln -s /home/jaronoff/webapps/ac_site/releases/20140213194344 /home/jaronoff/webapps/ac_site/current"
servers: ["web432.webfaction.com"]
[web432.webfaction.com] executing command
command finished in 198ms
** transaction: commit
* 2014-02-13 14:43:45 executing `deploy:restart'
triggering before callbacks for `deploy:restart'
* 2014-02-13 14:43:45 executing `deploy:migrate'
* executing "cd /home/jaronoff/webapps/ac_site/releases/20140213194344 && rake RAILS_ENV=production db:migrate"
servers: ["web432.webfaction.com"]
[web432.webfaction.com] executing command
command finished in 1939ms
* executing "/home/jaronoff/webapps/ac_site/bin/restart"
servers: ["web432.webfaction.com"]
[web432.webfaction.com] executing command
command finished in 3217ms
Any help or anything would be greatly appreciated. I've gotten pretty far today just by trial and error.
Thanks in advance!!
~Josh
I have built a ruby on rails application using Ubuntu. My application is on github. Normally I transfer the latest developments from github to my website, www.mywebsite.com, by doing in Terminal:
cap production deploy:migrations
And everything works fine. I see in Terminal the progress of the transfer like:
* executing "rm -rf /var/www/apps/myapp/releases/20130720123042/public/assets &&\\\n mkdir -p /var/www/apps/myapp/releases/20130720123042/public &&\\\n mkdir -p /var/www/apps/myapp/shared/assets &&\\\n ln -s /var/www/apps/myapp/shared/assets /var/www/apps/myapp/releases/20130720123042/public/assets"
servers: ["92.51.243.6"]
[92.51.243.6] executing command
command finished in 626ms
* executing `bundle:install'
* executing "cd /var/www/apps/myapp/releases/20130720123042 && bundle install --gemfile /var/www/apps/myapp/releases/20130720123042/Gemfile --path /var/www/apps/myapp/shared/bundle --deployment --quiet --without development test"
servers: ["92.51.243.6"]
[92.51.243.6] executing command
command finished in 1595ms
* executing "chmod -R g+w /var/www/apps/myapp/releases/20130720123042"
servers: ["92.51.243.6"]
[92.51.243.6] executing command
command finished in 645ms
Now the process doesn't complete as it used to and I get this message:
* executing "cd /var/www/apps/myapp/releases/20130720123042 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
servers: ["92.51.243.6"]
[92.51.243.6] executing command
** [out :: 92.51.243.6] rake aborted!
** [out :: 92.51.243.6] Received wrong number of arguments. [nil]
** [out :: 92.51.243.6] /var/www/apps/myapp/shared/bundle/ruby/1.8/gems/omniauth-1.1.0/lib/omniauth/strategy.rb:136:in `initialize'
more stuff here like the line above..
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ree-1.8.7-2012.02' -c 'cd /var/www/apps/myapp/releases/20130720123042 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on 92.51.243.6
mypc#ubuntu:~/myapp$
Any idea how I can fix this problem? Thanks.
My deployment of a rails app with capistrano is failing and I hoping someone can provide me with pointers to troubleshoot.
The following is the command output
andrew#melb-web:~/projects/rails/guestbook2$ cap deploy:setup
* executing `deploy:setup'
* executing "mkdir -p /var/www/dev/guestbook2 /var/www/dev/guestbook2/releases /var/www/dev/guestbook2/shared /var/www/dev/guestbook2/shared/system /var/www/dev/guestbook2/shared/log /var/www/dev/guestbook2/shared/pids && chmod g+w /var/www/dev/guestbook2 /var/www/dev/guestbook2/releases /var/www/dev/guestbook2/shared /var/www/dev/guestbook2/shared/system /var/www/dev/guestbook2/shared/log /var/www/dev/guestbook2/shared/pids"
servers: ["dev.andrewbucknell.com"]
Enter passphrase for /home/andrew/.ssh/id_dsa:
Enter passphrase for /home/andrew/.ssh/id_dsa:
[dev.andrewbucknell.com] executing command
command finished
andrew#melb-web:~/projects/rails/guestbook2$ cap deploy:check
* executing `deploy:check'
* executing "test -d /var/www/dev/guestbook2/releases"
servers: ["dev.andrewbucknell.com"]
Enter passphrase for /home/andrew/.ssh/id_dsa:
[dev.andrewbucknell.com] executing command
command finished
* executing "test -w /var/www/dev/guestbook2"
servers: ["dev.andrewbucknell.com"]
[dev.andrewbucknell.com] executing command
command finished
* executing "test -w /var/www/dev/guestbook2/releases"
servers: ["dev.andrewbucknell.com"]
[dev.andrewbucknell.com] executing command
command finished
* executing "which git"
servers: ["dev.andrewbucknell.com"]
[dev.andrewbucknell.com] executing command
command finished
* executing "test -w /var/www/dev/guestbook2/shared"
servers: ["dev.andrewbucknell.com"]
[dev.andrewbucknell.com] executing command
command finished
You appear to have all necessary dependencies installed
andrew#melb-web:~/projects/rails/guestbook2$ cap deploy:migrations
* executing `deploy:migrations'
* executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote andrew#dev.andrewbucknell.com:/home/andrew/git/guestbook2.git master"
Enter passphrase for key '/home/andrew/.ssh/id_dsa':
* executing "if [ -d /var/www/dev/guestbook2/shared/cached-copy ]; then cd /var/www/dev/guestbook2/shared/cached-copy && git fetch origin && git reset --hard 369c5e04aaf83ad77efbfba0141001ac90915029 && git clean -d -x -f; else git clone andrew#dev.andrewbucknell.com:/home/andrew/git/guestbook2.git /var/www/dev/guestbook2/shared/cached-copy && cd /var/www/dev/guestbook2/shared/cached-copy && git checkout -b deploy 369c5e04aaf83ad77efbfba0141001ac90915029; fi"
servers: ["dev.andrewbucknell.com"]
Enter passphrase for /home/andrew/.ssh/id_dsa:
[dev.andrewbucknell.com] executing command
** [dev.andrewbucknell.com :: err] Permission denied, please try again.
** Permission denied, please try again.
** Permission denied (publickey,password).
** [dev.andrewbucknell.com :: err] fatal: The remote end hung up unexpectedly
** [dev.andrewbucknell.com :: out] Initialized empty Git repository in /var/www/dev/guestbook2/shared/cached-copy/.git/
command finished
failed: "sh -c 'if [ -d /var/www/dev/guestbook2/shared/cached-copy ]; then cd /var/www/dev/guestbook2/shared/cached-copy && git fetch origin && git reset --hard 369c5e04aaf83ad77efbfba0141001ac90915029 && git clean -d -x -f; else git clone andrew#dev.andrewbucknell.com:/home/andrew/git/guestbook2.git /var/www/dev/guestbook2/shared/cached-copy && cd /var/www/dev/guestbook2/shared/cached-copy && git checkout -b deploy 369c5e04aaf83ad77efbfba0141001ac90915029; fi'" on dev.andrewbucknell.com
andrew#melb-web:~/projects/rails/guestbook2$
The following fragment is from cap -d deploy:migrations
Preparing to execute command: "find /var/www/dev/guestbook2/releases/20100305124415/public/images /var/www/dev/guestbook2/releases/20100305124415/public/stylesheets /var/www/dev/guestbook2/releases/20100305124415/public/javascripts -exec touch -t 201003051244.22 {} ';'; true"
Execute ([Yes], No, Abort) ? |y| yes
* executing `deploy:migrate'
* executing "ls -x /var/www/dev/guestbook2/releases"
Preparing to execute command: "ls -x /var/www/dev/guestbook2/releases"
Execute ([Yes], No, Abort) ? |y| yes
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.17/lib/capistrano/recipes/deploy.rb:55:in `join': can't convert nil into String (TypeError)
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.17/lib/capistrano/recipes/deploy.rb:55:in `load'
I added default_run_options[:pty] = true to my deploy.rb and all worked fine. I am running on debian - I guess it needs its own pty or something to get the right permissions. Thanks for your tips guys.
Looks to me like a permission problem on the server side.
Enter passphrase for /home/andrew/.ssh/id_dsa:
[dev.andrewbucknell.com] executing command
** [dev.andrewbucknell.com :: err] Permission denied, please try again.
** Permission denied, please try again.
** Permission denied (publickey,password).
** [dev.andrewbucknell.com :: err] fatal: The remote end hung up unexpectedly
Looks like git (on the server) is having difficulty authenticating with the git server.
Very helpful for me was to run cap deploy:check before doing anything else. Once that ran error free it was much easier to sort everything else out.
When do the cap deploy everything works fine except the ferret-server, while restarting server its try to stop the ferret_server in production mode and try to start the ferret_server but it fails due to permission problem .Here is the output from my deploy file** transaction: commit
executing deploy:restart'
triggering before callbacks fordeploy:restart'
executing `ferret:stop'
executing "cd /home/sj/reelinfo/current; script/ferret_server -e production stop || true"
servers: ["67.23.28.171"]
[67.23.28.171] executing command
** [out :: 67.23.28.171] sh: script/ferret_server: Permission denied
command finished
executing "chown www-data -R /home/sj/reelinfo/current/"
servers: ["67.23.28.171"]
[67.23.28.171] executing command
command finished
executing "touch /home/sj/reelinfo/current/tmp/restart.txt"
servers: ["67.23.28.171"]
[67.23.28.171] executing command
command finished
triggering after callbacks for `deploy:restart'
executing `ferret:start'
executing "cd /home/sj/reelinfo/current; script/ferret_server -e production start"
servers: ["67.23.28.171"]
[67.23.28.171] executing command
** [out :: 67.23.28.171] sh: script/ferret_server: Permission denied
command finished
failed: "sh -c \"cd /home/sj/reelinfo/current; script/ferret_server -e production start\"" on 67.23.28.171
I've had this problem as well, the issue is that script/ferret_server did not have executable permissions.
I added the following deploy task to handle the permissions:
before "deploy:restart", "correct_ferret_server_permissions"
task :correct_ferret_server_permissions do
run "chmod a+x #{current_path}/script/ferret_server
end