Skip to content

Instantly share code, notes, and snippets.

View proffalken's full-sized avatar

Matthew Macdonald-Wallace proffalken

View GitHub Profile
vhost.rb:7: undefined method `createDomainLinux' for #<Libvirt::Connect:0x7f117529b5e8> (NoMethodError)
from vhost.rb:6:in `open'
from vhost.rb:6
require 'libvirt'
conn = Libvirt::open("qemu:///system")
puts conn.capabilities
xmlcontent = File.read("domain.xml")
conn.create_domain_linux(xmlcontent, nil)
# Deploy Variables:
set :scm_uri, "http://svnserver/svn" # The URI of the SCM server (http://server/svn or git://server etc)
set :application, "mycoolwebapp" # The name of the application (also doubles as the repository name
set :repository_root, "#{scm_uri}/#{application}"
set(:release) {
Capistrano::CLI.ui.ask("Release Version to deploy (or type 'trunk' to deploy from trunk): ")
}
set(:repository) {
(release == "trunk") ? "#{repository_root}/trunk" : "#{repository_root}/releases/Release-#{release}"
}
namespace :deploy do
desc <<-DESC
Checks the latest version of the libraries
to make sure we're not deploying our code
onto a platform which is not prepared for it
DESC
task :checkdeps do
required_libs.each do | appname,version |
current_version = capture("cat /var/www/#{appname}/application/config/version").strip()
if version.to_f() > current_version.to_f() then
# Set the dependencies for this application (format: 'application' => 'version number')
set :required_libs, {'libs' => '0.2'}
#
# Other stuff goes here...
#
#Check all dependencies before setting up and deploying
before 'deploy:setup', 'deploy:checkdeps'
before 'deploy', 'deploy:checkdeps'
@proffalken
proffalken / Capfile
Created May 27, 2011 19:45
Puppet, MCollective and Capistrano
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
require 'capistrano'
require 'rubygems'
require 'railsless-deploy'
load 'config/deploy'
@proffalken
proffalken / deploy.rb
Created May 27, 2011 19:50
config/deploy.rb
set :stages, %w[staging production]
set :deploy_to, "/usr/share/puppet/configuration"
set :deploy_via, :export
set :application, "Puppet Manifests"
set :repository, "git://gitserver/puppet.git"
set :scm, :git
set :default_stage, "staging"
set :use_sudo, false
require 'capistrano/ext/multistage'
@proffalken
proffalken / staging.rb
Created May 27, 2011 20:20
staging cap recipe
set :user, "deploy"
role :web, "staging"
after 'deploy:symlink', 'puppet:run'
@proffalken
proffalken / production.rb
Created May 27, 2011 20:22
production cap config
set :gateway, "deploy@support-gateway"
set :user, "deploy"
set :deploy_via, :copy
role :web, "puppetmaster" # set this to the fully qualified domain name of your puppetmaster
after 'deploy:symlink', 'puppet:run'
after 'deploy:rollback', 'puppet:run'