miscellaneous notes about capistrano (general information, troubleshooting).



first run of deploy:assets:precompile task exited with error ExecJS::RuntimeError: (execjs):1

on the next run assets were precompiled without errors.

capistrano runs rake db:migrate on first deploy instead of rake db:schema:load

one option is to comment out require 'capistrano/rails/migrations' line in Capfile, run RAILS_ENV=staging rake db:schema:load manually and uncomment the line afterwards.

sidekiq:start task hangs, just hangs

problem was solved by removing command to source RVM script from Sidekiq init.d script.

fatal: Could not read from remote repository.

$ cap production deploy
00:05 git:check
      01 git ls-remote******d/sith.git HEAD
      01 Warning: Permanently added the RSA host key for IP address '52.74.XXX.XXX' to the list of known hosts.
      01 Permission denied (publickey).
      01 fatal: Could not read from remote repository.
      01 Please make sure you have the correct access rights
      01 and the repository exists.



first make sure you forward agent in .ssh/config:

Host sith
 User sith
 Hostname <hostname>
 IdentityFile ~/.ssh/id_rsa
 ForwardAgent yes

then it’s necessary to restart SSH agent: either restart terminal if you’re using ssh-agent Zsh plugin or restart SSH agent manually:

$ ssh-add -D
$ ssh-agent
$ ssh-add