How do you deploy to only one server with Capistrano v3? All the solutions I found out there deploy to every server, so, I would assume they are for v2.
I don't want to deploy a stage, I'm already using multistaging and I want to deploy to only one server in one of the stages.
As pointed out, in Capistrano 3 the way to deploy specific parts of your app to a single server is making use of HOST filtering. Let’s imagine that you are deploying directly to production and you have this configuration in config/deploy/production.rb
set :stage, :production
server "webserver1.example.com”, roles: [:web]
server "appserver1.example.com", roles: [:app]
server "appserver2.example.com", roles: [:app]
server "appserver3.example.com", roles: [:app]
server “dbserver1.example.com”, roles: [:db]
server “dbserver2.example.com”, roles: [:db]
Then if you want to deploy only to your webserver1, you just run the command:
cap --hosts=webserver1.example.com production deploy
You must use settings multistage.
Capistrano 3.x is multistage by default.
In one of his stage you define only the server you want.
set :stage, :staging
server 'staging.zodiacmedia.co.uk', roles: %w{web app db}, port: 22
set :deploy_to, '/var/www/staging.example.com'
Run command:
cd /home/deploy/capistrano/example
cap staging something:to:do
This tutorial is old but may help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With