Для работы локального развертывания необходимо установить сервер ssh, например openssh (sudo apt-get install openssh-server
для установки)
конфиг / развернуть / staging.rb
set :stage, :staging
role :app, %w{127.0.0.1}
role :web, %w{127.0.0.1}
role :db, %w{127.0.0.1}
server '127.0.0.1', user: 'your-username', roles: %w{web app}
set :branch, "staging"
конфиг / deploy.rb
set :deploy_to ,'/home/your/app/path/deploy'
# Path of tests to be run, use array with empty string to run all tests
set :tests, ['']
namespace :deploy do
desc "Runs test before deploying, can't deploy unless they pass"
task :run_tests do
test_log = "log/capistrano.test.log"
tests = fetch(:tests)
tests.each do |test|
puts "--> Running tests: '#{test}', please wait ..."
unless system "bundle exec rspec #{test} > #{test_log} 2>&1"
puts "--> Aborting deployment! One or more tests in '#{test}' failed. Results in: #{test_log}"
exit;
end
puts "--> '#{test}' passed"
end
puts "--> All tests passed, continuing deployment"
system "rm #{test_log}"
end
# Only allow a deploy with passing tests to be deployed
before :deploy, "deploy:run_tests"
end
Запустите его с помощью
cap staging deploy