forked from emiltin/poolparty_example
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
capistrano integration. pp-extensions not neeed anymore for rails_deploy
- Loading branch information
Showing
10 changed files
with
527 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | ||
load 'config/deploy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Capistrano deploy specification. | ||
# Integrated with poolparty by getting node addresses from poolparty, and use them to set cap roles. | ||
|
||
|
||
#gain access to poolparry node info | ||
require 'poolparty' | ||
require 'clouds.rb' | ||
|
||
main_cloud = :app | ||
|
||
|
||
#extract the hostnames of running instances from a poolparty cloud | ||
def find_running_nodes cloud | ||
clouds[cloud].nodes(:status=>"running").map { |node| node.hostname } | ||
end | ||
|
||
#find the rails deploy object so we can extract info | ||
def find_rails_deploy cloud | ||
clouds[cloud].ordered_resources.find { |node| node.is_a? RailsDeployClass } | ||
end | ||
|
||
#assign cap roles to pp nodes | ||
nodes = find_running_nodes(main_cloud) #get addresses of running instance in the poolparty cloud named 'app' | ||
role :app, *nodes | ||
role :web, *nodes | ||
role :db, *nodes | ||
|
||
# you must have both the public and the private key in the same folder, the public key should have the extension ".pub" | ||
# you can generate a public key from your private key by using 'ssh-keygen -y' on the command line | ||
ssh_options[:keys] = clouds[main_cloud].keypair.filepath #use the keyfile pointed to in clouds.rb | ||
ssh_options[:user] = "root" | ||
|
||
|
||
#use info from the rails_deploy block in clouds.rb to set deploy stuff | ||
deployer = find_rails_deploy(main_cloud) || raise("Can't find rails deploy object in clouds.rb!") | ||
deploy_dir = "#{deployer.dsl_options[:dir]}/#{deployer.dsl_options[:name]}" | ||
set :scm, "git" | ||
set :application, deployer.dsl_options[:name] | ||
set :repository, deployer.dsl_options[:repo] | ||
set :deploy_to, deploy_dir | ||
|
||
|
||
set :branch, "master" | ||
set :deploy_via, :remote_cache | ||
#set :user, "deployer" | ||
#default_run_options[:pty] = true | ||
#ssh_options[:forward_agent] = true | ||
|
||
|
||
desc <<-DESC | ||
Run whoami on the nodes. | ||
DESC | ||
task :stats do | ||
run "cd #{deploy_dir}/current && RAILS_ENV=production rake stats" | ||
end | ||
|
||
|
||
desc "tail production log files" | ||
task :logs, :roles => :app do | ||
run "tail -f #{deploy_dir}/shared/log/production.log" do |channel, stream, data| | ||
puts | ||
puts "#{channel[:host]}: #{data}" | ||
# printf '...' | ||
break if stream == :err | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
K 25 | ||
svn:wc:ra_dav:version-url | ||
V 55 | ||
/repos/!svn/ver/1064/webapp/trunk/webapp/config/recipes | ||
END | ||
clusters.rb | ||
K 25 | ||
svn:wc:ra_dav:version-url | ||
V 67 | ||
/repos/!svn/ver/1064/webapp/trunk/webapp/config/recipes/clusters.rb | ||
END | ||
dns.rb | ||
K 25 | ||
svn:wc:ra_dav:version-url | ||
V 61 | ||
/repos/!svn/ver/918/webapp/trunk/webapp/config/recipes/dns.rb | ||
END | ||
logs.rb | ||
K 25 | ||
svn:wc:ra_dav:version-url | ||
V 62 | ||
/repos/!svn/ver/917/webapp/trunk/webapp/config/recipes/logs.rb | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
8 | ||
|
||
dir | ||
3249 | ||
https://dev.koblo.com:444/repos/webapp/trunk/webapp/config/recipes | ||
https://dev.koblo.com:444/repos | ||
|
||
|
||
|
||
2008-04-11T21:16:32.233217Z | ||
1064 | ||
emil | ||
|
||
|
||
svn:special svn:externals svn:needs-lock | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
850aafe4-0746-43d5-bba1-ccadfad06b28 | ||
|
||
clusters.rb | ||
file | ||
|
||
|
||
|
||
|
||
2009-02-11T19:44:36.000000Z | ||
60d00427fe9f2961937b39efc0043f5a | ||
2008-04-11T21:16:32.233217Z | ||
1064 | ||
emil | ||
|
||
dns.rb | ||
file | ||
|
||
|
||
|
||
|
||
2009-02-11T19:44:36.000000Z | ||
d41d8cd98f00b204e9800998ecf8427e | ||
2008-03-16T11:46:45.926645Z | ||
918 | ||
emil | ||
|
||
logs.rb | ||
file | ||
|
||
|
||
|
||
|
||
2009-02-11T19:44:36.000000Z | ||
30cf0dfe0e15c13be50f6f5263c57d6d | ||
2008-03-16T10:00:59.987443Z | ||
917 | ||
emil | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8 |
Oops, something went wrong.