Last Updated: February 25, 2016
·
3.056K
· dz0ny

capistrano + vagrant

Can be used for dev, staging server... You name it.

config/deploy.rb

set :application, "vagrant"
set :repository,  "."

set :scm, :none

# vagrant ssh-config > .ssh/config, change "Host default" to "Host vagrant"
role :web, "vagrant"     
role :app, "vagrant"

#default run and user
set :use_sudo, true
set :user, 'root'
set :run_method, :sudo

# Must be set for the password prompt from git to work
default_run_options[:pty] = true

#uses local defined vagrant ssh config .ssh/config
ssh_options[:forward_agent] = true

# in Vagrantfile config.vm.share_folder "airtime-devel", "/opt/airtime","./airtime-devel"
set :vagrant_mount_path, "/opt/airtime/devel/"

namespace :update do

  desc "Update playout"
  task :playout, :roles => :app do
    run "#{vagrant_mount_path}/install_minimal/airtime-install -p"
    run "airtime-liquidsoap -p /usr/lib/airtime/pypo/bin/liquidsoap_scripts/ls_script.liq"
  end

  desc "Update web"
  task :web, :roles => :app do
    run "#{vagrant_mount_path}/install_minimal/airtime-install -w"
  end

  desc "Update media monitor"
  task :media, :roles => :app do
    run "#{vagrant_mount_path}/install_minimal/airtime-install -m"
  end

end

desc 'Check setup'
task :check, :roles => :app do
  run "airtime-liquidsoap -p /usr/lib/airtime/pypo/bin/liquidsoap_scripts/ls_script.liq"
end

desc 'Tail airtime log'
task :tail_play, :roles => :app do
  run "airtime-log -t playout"
end

desc 'Tail airtime log'
task :tail_liq, :roles => :app do
  run "airtime-log -t liquidsoap"
end

3 Responses
Add your response

Tip on vagrant ssh-config was SO useful. Thanks!

over 1 year ago ·

You has this line:

# vagrant ssh-config > .ssh/config, change "Host default" to "Host vagrant"

You could instead config.vm.define = "vagrant" and now it will use that instead of default :)

over 1 year ago ·

vagrant ssh-config > .ssh/config should be vagrant ssh-config >> .ssh/config

over 1 year ago ·