Capistrano::Shell
Opens SSH shell on remote host in current release directory. Requires Capistrano 3.
Installation
Add this line to your application's Gemfile:
gem 'capistrano-shell'
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-shell
Usage
# Capfile
require 'capistrano/shell'
# config/deploy/production.rb
server 'server1', user: 'deploy', roles: %w{app}
server 'server2', user: 'deploy', roles: %w{db}, no_release: true
Then you should be able to do something like this:
$ cap production -n shell
$ cap production -n shell ROLES=app
$ cap production -n shell HOSTS=server1
$ cap production -n shell HOSTS=server2
When connecting to server1
ssh will cd into /var/www/your_app/current
directory(release_path
). But when connecting to server2
just /home/deploy
will be opened because server2
is marked as no_release
.
In the last two example the HOSTS
environment variable is used. However, you probably don't need to use it because capistrano/shell
asks you what server to use when there are many.
Shell command
It is possible to redefine shell command (by default $SHELL --login
is used):
set :shell_cmd, '/bin/zsh -l'
Contributing
- Fork it ( https://github.com/marshall-lee/capistrano-shell/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request