Questions tagged [sshkit]

sshkit is a toolkit for deploying code and assets to servers in a repeatable, testable, reliable way.

SSHKit is a toolkit for deploying code and assets to servers in a repeatable, testable, reliable way. In other words, SSHKit is a toolkit for running commands in a structured way on one or more servers.

SSHKit provides a convenient set of API which are nestable in any order, repeatable, and stackable. There are some helper APIs also which are convenient helpers for Ruby, and Rails based apps.

SSHKit uses a simple connection pool (enabled by default) to reduce the cost of negotiating a new SSH connection for every on() block. Depending on usage and network conditions, this can add up to a significant time savings. In one test, a basic cap deploy ran 15-20 seconds faster thanks to the connection pooling added in recent versions of SSHKit. It provides concurrency handling, sane error checking and control flow that would otherwise be difficult to achieve with pure Net::SSH.

You should use this tag if your question is related with SSHkit toolkit usage.

42 questions
13
votes
1 answer

Capistrano log level

I've set my Capistrano configuration's log level to error to prevent verbose output. In deploy.rb I've added set :log_level, :error. This works great. However, when I run commands via execute, it isn't printed as it's being written under the log…
Jey Balachandran
  • 3,585
  • 5
  • 27
  • 36
7
votes
1 answer

Rails 4, Capistrano 3 fail during bundle exec rake assets:precompile and returns rake stdout: Nothing

Deploying with Capistrano fail during rake assets:precompile: /usr/local/rvm/bin/rvm ruby-2.0.0-p353 do bundle exec rake assets:precompile The Prompt Respond with this error: INFO [b438501f] Running /usr/local/rvm/bin/rvm ruby-2.0.0-p353 do bundle…
7
votes
3 answers

Capistrano 3 / SSHKit write to a file in custom task

I want mark the current deployed directory with my release number. I tried this approach: Get locally the app version, store it into a variable, and on the remote host, store it in a file. namespace :deploy do desc "Set a release number as the…
astropanic
  • 10,800
  • 19
  • 72
  • 132
6
votes
1 answer

What is the difference between execute, test and capture commands in Capistrano?

On SSHkit-Github it's says: All backends support the execute(*args), test(*args) & capture(*args) From SSHkit-Rubydoc, I understand that execute is actually an alias to test? What is the difference between test, execute, capture in…
Evgenia Karunus
  • 10,715
  • 5
  • 56
  • 70
6
votes
2 answers

How to continue when script fails(errors) and capture the output using Capistrano 3

In Capistrano 2.x you could simply add :on_error => :continue like this: task :bad_script, :on_error => :continue do my_error = capture('/path/to/tomcat/shutdown.sh') end I don't see any way to do this in Capistrano 3.x or ssh-kit (the…
Richie Rich
  • 643
  • 1
  • 8
  • 17
5
votes
2 answers

Capistrano 3. To set bash shell on server instead csh

When cap3 try to execute comands on my FreeBSD server - I have an errors and my cap3 tasks doesn't work DEBUG [0bb99d53] Command: if test ! -d /home/web_server/data/www/capistrano/site/shared/dumps; then echo "Directory does not exist…
the-teacher
  • 589
  • 8
  • 19
4
votes
2 answers

Capistrano 3: How can I suppress status output?

I've created a Capistrano task to execute a rake command. I plan to redirect the output (STDOUT) to a file. E.g. cap production invoke:rake TASK=mytask > out This works, but my output includes some additional Capistrano status output, e.g. 00:00…
Felix Livni
  • 1,164
  • 13
  • 24
3
votes
0 answers

Why does Capistrano 3 not filter when using "on roles(:web)"?

I'm not sure if this is just a misunderstanding on Capistrano and Rake on my part, but I'm going through the Capistrano 3 set up pages (www.capistranorb.com) and a few of the steps mention how to write up the servers and how to run the basic task of…
Jon
  • 793
  • 1
  • 8
  • 21
3
votes
1 answer

Capistrano : NoMethodError: undefined method `recv' for #

This error in Capistrano (> 3) prevents me from deploying my Rails application. My Capistrano config works fine on another environment. DEBUG [6c7d7bed] Command: if test ! -d /opt/my_app/releases/20140429175529; then echo "Directory does not exist…
Such
  • 910
  • 1
  • 9
  • 20
2
votes
2 answers

Capistrano can't deploy to new Ubuntu server because SSHKit / Net::SSH can't authenticate

I'm trying to set up a staging/testing server for a new version of an application I'm working on. So I have set it up so that my local account can authenticate into the deployment server without having to type in a password: $ ssh…
Hakanai
  • 12,010
  • 10
  • 62
  • 132
2
votes
1 answer

Capistrano 3 useless error message

I'm trying to figure out what's wrong with this command when run via a capistrano task. It runs fine if i run it directly on the server: desc 'Run npm install on remote server' task :npm_install do on roles(:app) do puts '**** NPM…
Catfish
  • 18,876
  • 54
  • 209
  • 353
2
votes
2 answers

Is it possible for sshkit capture to not error when the command executed returns nothing

What I'm trying to achieve is a capistrano3 task that does a log file grep on all servers - this would save a lot of time as we have a lot of servers so doing it manually or even scripted but sequentially takes ages. I have a rough at the edges task…
2
votes
1 answer

How to deploy as another user with Capistrano 3

I'm using and Ruby 2.1 and Capistrano 3.1 on OS X 10.9.1, deploying to CentOS 6.5. On my target deployment server, I cannot ssh in as my deploy user, admin@myserver, but I can ssh in as paul@myserver and then sudo su - admin. I made a test…
Paul Schreiber
  • 12,531
  • 4
  • 41
  • 63
2
votes
1 answer

To use bash --login by default with capistrano 3 + sshkit + rvm

I have following cap3 task task :gemset do on roles(:all) do if remote_dir_exists?(".rvm") execute :rvm, :gemset, :use, "#{ Configs.rvm.ruby }@#{ Configs.rvm.gemset } --create" else info "RVM not installed" end end end…
the-teacher
  • 589
  • 8
  • 19
1
vote
1 answer

SSHKit::Runner::ExecuteError on ruby 3.1.2

Hi rails 7.0.3 ruby 3.1.2 both servers (production / staging) and the repository are on my own linux. manually, i can ssh into production server and ssh from there to the repository server. git clone from the production machine also does his work…
chmich
  • 834
  • 9
  • 20
1
2 3