Mina Deploy Not Working All the Time - ruby-on-rails

I have been having this issue for 3 months or so now. When I do a mina deploy no errors will happen and it shows starting/stopping of sidekiq etc.. but sometimes the latest code doesn't actually deploy to the production server. Using the same code I have never had this issue on the staging environment either, which is really confusing.
To fix the issue, I have to manually kill the unicorn pid and then do a re-deploy and this works every time.
I'm not very familiar with any of this and it is mainly copied from articles & SO, but do you see anything in the code that could be causing issues? Should I be stopping unicorn and then starting it back up instead of just restarting it? My thought there is that I might miss requests.
desc "Deploys the current version to the server."
task :deploy => :environment do
deploy do
# stop accepting new workers
invoke :'sidekiq:quiet'
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
to :launch do
invoke :'sidekiq:restart'
invoke :'unicorn:restart'
end
end
Is there anyway I can output statements at certain times inside of the deploy or have it create a log?
-- EDIT: (ADDED TRACE) --
This is a passing trace. Is there some type of error that should show up on a failing trace that I can look for? It doesn't fail all the time, but I can run trace each time to try to catch a failing one.
** Invoke deploy (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke rbenv:load (first_time)
** Execute rbenv:load
** Execute deploy
** Invoke sidekiq:quiet (first_time)
** Invoke environment
** Execute sidekiq:quiet
** Invoke git:clone (first_time)
** Execute git:clone
** Invoke deploy:link_shared_paths (first_time)
** Execute deploy:link_shared_paths
** Invoke bundle:install (first_time)
** Execute bundle:install
** Invoke rails:db_migrate (first_time)
** Execute rails:db_migrate
** Invoke rails:assets_precompile (first_time)
** Execute rails:assets_precompile
** Invoke deploy:cleanup (first_time)
** Execute deploy:cleanup
** Invoke sidekiq:restart (first_time)
** Execute sidekiq:restart
** Invoke sidekiq:stop (first_time)
** Invoke environment
** Execute sidekiq:stop
** Invoke sidekiq:start (first_time)
** Invoke environment
** Execute sidekiq:start
** Invoke unicorn:restart (first_time)
** Invoke environment
** Execute unicorn:restart
-----> Loading environment
$ source ~/.bashrc
-----> Loading rbenv
$ export RBENV_ROOT="$HOME/.rbenv"
$ export PATH="$HOME/.rbenv/bin:$PATH"
$ eval "$(rbenv init -)"
-----> Creating a temporary build path
$ touch "deploy.lock"
$ mkdir -p "$build_path"
$ cd "$build_path"
-----> Quiet sidekiq (stop accepting new work)
$ RAILS_ENV="staging" bundle exec sidekiqctl quiet /home/deploy/PATH $ RAILS_ENV="staging" bundle exec sidekiqctl quiet /home/deploy/PATHNAME//shared/pids/sidekiq.pid
-----> Fetching new git commits
$ (cd "/home/deploy/PATHNAME//scm" && git fetch "git#github.com:k $ (cd "/home/deploy/PATHNAME//scm" && git fetch "git#github.com:kenmazaika/PATHNAME.git" "master:master" --force)
-----> Using git branch 'master'
$ git clone "/home/deploy/PATHNAME//scm" . --recursive --branch " $ git clone "/home/deploy/PATHNAME//scm" . --recursive --branch "master"
Cloning into '.'...
done.
-----> Using this git commit
$ git --no-pager log --format='%aN (%h):%n> %s' -n 1
MYNAME (a0ba681):
> Merge pull request #2040 from repo/issue2039
$ rm -rf .git
-----> Symlinking shared paths
$ mkdir -p "./config"
$ mkdir -p "."
$ rm -rf "./config/database.yml"
$ ln -s "/home/deploy/PATHNAME//shared/config/database.yml" "./co $ ln -s "/home/deploy/PATHNAME//shared/config/database.yml" "./config/database.yml"
$ rm -rf "./log"
$ ln -s "/home/deploy/PATHNAME//shared/log" "./log"
$ rm -rf "./config/secrets.yml"
$ ln -s "/home/deploy/PATHNAME//shared/config/secrets.yml" "./con $ ln -s "/home/deploy/PATHNAME//shared/config/secrets.yml" "./config/secrets.yml"
-----> Installing gem dependencies using Bundler
$ mkdir -p "/home/deploy/PATHNAME//shared/bundle"
$ mkdir -p "./vendor"
$ ln -s "/home/deploy/PATHNAME//shared/bundle" "./vendor/bundle"
$ bundle install --without development:test --path "./vendor/bundle" --de $ bundle install --without development:test --path "./vendor/bundle" --deployment
### USING A BUNCH OF GEMS ###
-----> DB migrations unchanged; skipping DB migration
-----> Skipping asset precompilation
$ cp -R "/home/deploy/PATHNAME//current/public/assets" "./public"
-----> Cleaning up old releases (keeping 5)
$ cd "/home/deploy/PATHNAME//releases" || exit 15
$ count=`ls -1d [0-9]* | sort -rn | wc -l`
$ remove=$((count > 5 ? count - 5 : 0))
$ ls -1d [0-9]* | sort -rn | tail -n $remove | xargs rm -rf {}
-----> Build finished
-----> Moving build to releases/301
$ mv "$build_path" "$release_path"
-----> Updating the current symlink
$ ln -nfs "$release_path" "current"
-----> Launching
$ cd "$release_path"
-----> Stop sidekiq
$ RAILS_ENV="staging" bundle exec sidekiqctl stop /home/deploy/PATHl $ RAILS_ENV="staging" bundle exec sidekiqctl stop /home/deploy/PATHNAME//shared/pids/sidekiq.pid 10
Sidekiq shut down gracefully.
-----> Start sidekiq
$ nohup bundle exec sidekiq -e staging -C /home/deploy/PATHNAME//current/config/sidekiq.yml -i 0 -P /home/deploy/PATHNAME//shared/pids/si $ nohup bundle exec sidekiq -e staging -C /home/deploy/PATHNAME//current/config/sidekiq.yml -i 0 -P /home/deploy/PATHNAME//shared/pids/sidekiq.pid >> /home/deploy/PATHNAME//current/log/sidekiq.log 2>&1 &
-----> Starting Unicorn...

Related

Gitlab Pipeline Job is not finding webpack

The project was recently updated from Ruby 3.0.1 and Rails 6.1.4 to Ruby 3.1.1 and Rails 7.0.2.
All tests pass in my local dev environment. I can't get the CI Pipeline to work. I'm using the Cloud version of Gitlab (Shared Gitlab? - I forget what it's called) and so I can't access the pipeline job from a command line. (I don't think).
I cleared my runner caches and made numerous changes to try and get it to work but to no avail.
Here is the CI file:
stages:
- test
- deploy
test-job:
stage: test
image: ruby:3.1
services:
- postgres:12.7
variables:
POSTGRES_USER: depot_postgresql
POSTGRES_PASSWORD: depot_postgresql
DB_USERNAME: depot_postgresql
DB_PASSWORD: depot_postgresql
DB_HOST: postgres
RAILS_ENV: test
# BUNDLE_PATH: vendor/bundle
before_script:
- gem update --system
script:
- apt-get update
- apt-get --assume-yes install sudo
- sudo apt install curl
- curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get update
- sudo apt-get install nodejs yarn
- node -v
- npm -v
- yarn -v
- gem install bundler -v 2.3.8
- bundle install
- bundle exec ruby -v
- bundle exec bundle version
- bundle exec rails -v
- bundle exec rails db:create db:schema:load --trace
- bundle exec rake assets:precompile
- bundle exec rails test
# - bundle exec rails test:system
The job gets to this point with no previous errors or warnings and then fails.
$ bundle exec ruby -v
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux]
$ bundle exec bundle version
Bundler version 2.3.8 (2022-02-23 commit 4e812b9ca5)
$ bundle exec rails -v
Rails 7.0.2
$ bundle exec rails db:create db:schema:load --trace
Running via Spring preloader in process 2861
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:create
Created database 'db/test.sqlite3'
** Invoke db:schema:load (first_time)
** Invoke db:load_config
** Invoke db:check_protected_environments (first_time)
** Invoke db:load_config
** Execute db:check_protected_environments
** Execute db:schema:load
$ bundle exec rake assets:precompile
I, [2022-03-10T19:46:45.438504 #2865] INFO -- : Writing /builds/goandgit/yumbin/public/assets/turbo-89398ded557eeb147879794d5b139c5e68c471e7ae9ee6ed32e01fb3a0798ce1.js
I, [2022-03-10T19:46:45.439116 #2865] INFO -- : Writing /builds/goandgit/yumbin/public/assets/turbo-89398ded557eeb147879794d5b139c5e68c471e7ae9ee6ed32e01fb3a0798ce1.js.gz
and so on. Then...
I, [2022-03-10T19:46:45.509345 #2865] INFO -- : Writing /builds/goandgit/yumbin/public/assets/users-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
I, [2022-03-10T19:46:45.509685 #2865] INFO -- : Writing /builds/goandgit/yumbin/public/assets/users-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
Compiling...
Compilation failed:
yarn run v1.22.17
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command "webpack" not found.
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
If it is going through my public folder sequentially then it is failing in my packs/js/controllers folder perhaps specifically on this first bit of a code:
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
I'm stumped.

Getting a Pending Migrations error on my rails app after deployment

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

erros in Ubuntu Terminal when deploying my rails app

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.

Capistrano / Mercurial / tar "time stamp in the future" Message

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?

I am trying to deploy my first rails app using Capistrano and am getting an error

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.

Resources