SSHKit is an amazing tool to run any commands on your VPS or docker images as any user. Capistrano uses it to all the server related stuffs. In other words you can build your own deployer software or server maintenance tools using SSHKit.
$ gem install sshkit
Lets create a ruby script to create a file in my VPS’s home directory
require 'sshkit' require 'sshkit/dsl' on ['deployer@4X.79.XXX.XX1'], in: :sequence, wait: 1 do |host| within '~' do # or '/home/deployer/' as :deployer do execute 'echo', 'My name is shiva > shiva.txt' end end end
Go and check in your VPS, you see the file Continue reading