Permalink
Browse files

deploy script for vagrant box

  • Loading branch information...
1 parent 1485694 commit 9215ab0d83e4a92b4512196160e13425e277cdd8 @atomical atomical committed Mar 21, 2013
Showing with 49 additions and 4 deletions.
  1. +4 −4 config/deploy.rb
  2. +45 −0 config/deploy/vagrant.rb
View
@@ -6,7 +6,7 @@
set :application, "avalon"
set :repository, "git://github.com/avalonmediasystem/avalon.git"
-set :stages, %W(dev testing prod)
+set :stages, %W(dev testing prod vagrant)
set :default_stage, "dev"
require 'capistrano/ext/multistage'
@@ -42,9 +42,9 @@
end
namespace :deploy do
- task :trust_rvmrc do
- run "/usr/local/rvm/bin/rvm rvmrc trust #{latest_release}"
- end
+ task :trust_rvmrc do
+ run "/usr/local/rvm/bin/rvm rvmrc trust #{latest_release}"
+ end
task :start do
run "cd #{current_release} && bundle exec rake delayed_job:start"
View
@@ -0,0 +1,45 @@
+set :user, 'avalon'
+set :ssh_options, {port: 2222, keys: ['~/.vagrant.d/insecure_private_key']}
+
+role :web, 'localhost'
+role :app, 'localhost'
+
+set :deploy_to, '/var/www/avalon'
+
+set :rails_env, 'production'
+set :rvm_bin_path, '/usr/local/rvm/bin'
+set :rvm_path, '/usr/local/rvm'
+set :rvm_ruby_string, '1.9.3'
+set :rvm_type, 'avalon'
+set :git_enable_submodules, false
+
+set(:bundle_flags) { "--path=#{deploy_to}/shared/gems --verbose" }
+
+before 'deploy:finalize_update', 'deploy:remove_shared_children'
+before 'bundle:install', 'deploy:trust_rvmrc'
+
+namespace :deploy do
+ task :remove_shared_children do
+ shared_children.each do |child_path|
+ run("rm -rf #{File.join(release_path, child_path)}")
+ end
+ end
+ task :trust_rvmrc do
+ puts "/usr/local/rvm/bin/rvm rvmrc trust #{current_release}"
+ run "/usr/local/rvm/bin/rvm rvmrc trust #{current_release}"
+ end
+end
+
+# desc 'Update Matterhorn if necessary'
+# task :update_matterhorn, :roles => :app do
+# puts capture('uname -a')
+# raise 'asdfasdf'
+# current_version = capture("curl --silent -N -L https://github.com/avalonmediasystem/avalon-felix/archive/1.4.x.tar.gz | cut -b 1-1024 | gunzip -c | git get-tar-commit-id")
+# local_version = capture("cat /opt/staging/matterhorn/matterhorn.tar.gz | cut -b 1-1024 | gunzip -c | git get-tar-commit-id")
+# # raise "Could not find the current version of matterhorn. Output: '#{current_version}'" if current_version.empty? || current_version.length != 40
+# # raise "Could not find the local version of matterhorn Output: '#{local_version}'" if local_version.empty? || local_version.length != 40
+# # raise 'abc'
+# # if current_version != local_version
+# # update_matterhorn
+# # end
+# end

0 comments on commit 9215ab0

Please sign in to comment.