Open danielristic opened 10 years ago
If you set your ssh port in config/deploy/production.rb
with:
set :ssh_options, {
port: 42663
}
Then you could do:
execute "rsync -av -e 'ssh -p #{fetch(:ssh_options)[:port]}' ./public/assets/ #{role.user}@#{role.hostname}:#{release_path}/public/assets/;"
Which isn't pretty, but now you're not repeating yourself or statically defining anything in your compile_assets_locally.cap
.
This would fail if ssh_options[:port]
is undefined.
@christiangenco that solution works only when you use the :ssh_options configuration, when you put the port into connection string or in server options, it won't work.
I fixed this by using upload! capistrano function. Unfortunately I didn't figure out how to connect my pull request to this issue.
I'm testing deploys on vagrant but it failed during asset precompilation as rsync was using the default 22 port and vagrant is expecting port 2222 by default.
I set this up in the
vagrant.rb
file I use to define the deploy environment:But rsync still used the port 22.
So I directly modified the code in
compile_assets_locally.cap
toBut it looks like there's probably a cleaner way to specify the port used when deploying?