Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 48 lines (41 sloc) 1.374 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
require 'capistrano/ext/multistage'
require "rvm/capistrano" # Use the gem, don't unshift RVM onto the load path, that's crazy.

set :rvm_ruby_string, ENV['rvm_ruby_string']
set :rvm_type, :user

set :app_name, :foo
set(:app_dir) { "/var/#{stage}/#{app_name}" }
set :user, "mkocher"
default_run_options[:pty] = true

desc "Deploys"
task :deploy do
  install_base_gems
  upload_cookbooks
  run_chef
end

desc "Install gems that are needed for a chef run"
task :install_base_gems do
  run "gem list | grep soloist || gem install soloist --no-rdoc --no-ri"
  run "gem list | grep bundler || gem install bundler --no-rdoc --no-ri"
end

desc "Upload cookbooks"
task :upload_cookbooks do
  run "sudo mkdir -p #{app_dir}"
  run "sudo chown -R #{user} #{app_dir}"
  run "rm #{app_dir}/soloistrc || true"
  run "rm -r #{app_dir}/chef || true"
  upload("soloistrc", "#{app_dir}/soloistrc")
  upload("chef/", "#{app_dir}/chef/", :via => :scp, :recursive => true)
end

desc "Run Chef"
task :run_chef do
  run "cd #{app_dir} && PATH=/usr/sbin:$PATH APP_NAME=#{fetch(:app_name)} APP_DIR=#{fetch(:app_dir)} LOG_LEVEL=debug soloist"
end

desc "bootstrap"
task :bootstrap do
  app_user = fetch(:user)
  set :user, "root"
  set :default_shell, "/bin/bash"
  upload "bootstrap.sh", "/root/bootstrap.sh"
  run "chmod a+x /root/bootstrap.sh"
  run "APP_USER=#{app_user} /root/bootstrap.sh"
end
Something went wrong with that request. Please try again.