I’m trying to figure this out and would appreciate any help. I get the following error when running bundle exec cap staging deploy
** Invoke staging (first_time)
** Execute staging
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
INFO[ede001f7] Running /usr/bin/env mkdir -p /tmp/myapp/ on staging.server.com
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
Password:
INFO[ede001f7] Finished in 2.200 seconds with exit status 0 (successful).
INFOUploading /tmp/myapp/git-ssh.sh 100.0%
INFO[cf213741] Running /usr/bin/env chmod +x /tmp/myapp/git-ssh.sh on staging.heyyyyyy.com
INFO[cf213741] Finished in 0.150 seconds with exit status 0 (successful).
** Execute git:check
cap aborted!
SSHKit::ExecuteError: Exception while executing on host staging.heyyyyyy.com: exit
/usr/local/lib/ruby/gems/2.2.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:28:in exit' /usr/local/lib/ruby/gems/2.2.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:28:in
block (4 levels) in <top (required)>’
/usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:85:in with' /usr/local/lib/ruby/gems/2.2.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:27:in
block (3 levels) in <top (required)>’
/usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in instance_exec' /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in
run’
/usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in block (2 levels) in execute' SystemExit: exit /usr/local/lib/ruby/gems/2.2.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:28:in
exit’
/usr/local/lib/ruby/gems/2.2.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:28:in block (4 levels) in <top (required)>' /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:85:in
with’
/usr/local/lib/ruby/gems/2.2.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:27:in block (3 levels) in <top (required)>' /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in
instance_exec’
/usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in run' /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in
block (2 levels) in execute’
Tasks: TOP => git:check
The deploy has failed with an error: #<SSHKit::ExecuteError: Exception while executing on host staging.server.com: exit>
** Invoke deploy:failed (first_time)
** Execute deploy:failed
I’m guessing this has something to do with the SSH keys, obviously, but not sure what I am doing wrong.
My deploy.rb is
set :application, 'myapp'
set :repo_url, 'name@bitbucket.org/name/myrepo.git'
set :deploy_via, :copy
# Branch options
# Prompts for the branch name (defaults to current branch)
#ask :branch, -> { `git rev-parse --abbrev-ref HEAD`.chomp }
# Hardcodes branch to always be master
# This could be overridden in a stage config file
set :branch, :master
# set :deploy_to, -> { "/srv/www/#{fetch(:application)}" }
set :deploy_to, '/home/#{user}/'
# Use :debug for more verbose output when troubleshooting
set :log_level, :info
# Apache users with .htaccess files:
# it needs to be added to linked_files so it persists across deploys:
# set :linked_files, fetch(:linked_files, []).push('.env', 'web/.htaccess')
set :linked_files, fetch(:linked_files, []).push('.env')
set :linked_dirs, fetch(:linked_dirs, []).push('web/app/uploads')
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
execute :service, :nginx, :reload
end
end
end
# The above restart task is not run by default
# Uncomment the following line to run it on deploys if needed
after 'deploy:publishing', 'deploy:restart'
namespace :deploy do
desc 'Update WordPress template root paths to point to the new release'
task :update_option_paths do
on roles(:app) do
within fetch(:release_path) do
if test :wp, :core, 'is-installed'
[:stylesheet_root, :template_root].each do |option|
# Only change the value if it's an absolute path
# i.e. The relative path "/themes" must remain unchanged
# Also, the option might not be set, in which case we leave it like that
value = capture :wp, :option, :get, option, raise_on_non_zero_exit: false
if value != '' && value != '/themes'
execute :wp, :option, :set, option, fetch(:release_path).join('web/wp/wp-content/themes')
end
end
end
end
end
end
end
# The above update_option_paths task is not run by default
# Note that you need to have WP-CLI installed on your server
# Uncomment the following line to run it on deploys if needed
# after 'deploy:publishing', 'deploy:update_option_paths'
and my staging.rb is
set :stage, :staging
# Simple Role Syntax
# ==================
#role :app, %w{deploy@example.com}
#role :web, %w{deploy@example.com}
#role :db, %w{deploy@example.com}
# Extended Server Syntax
# ======================
# Capistrano > 3.2.0 supports echo: false
# ask(:password, nil, echo: false)
# server '50.22.39.148', user: 'username', port: 22, password: fetch(:password), roles: %w{web app db}
server 'staging.servername.com', user: 'username', roles: %w{web app db}
# you can set custom ssh options
# it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options
# you can see them in [net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start)
# set it globally
set :ssh_options, {
keys: %w(~/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(password)
}
fetch(:default_env).merge!(wp_env: :staging)
I know it’s a shot in the dark, but I’m running in circles on this.