Skip to content

Instantly share code, notes, and snippets.

Matthew Macdonald-Wallace proffalken

View GitHub Profile
View Error
vhost.rb:7: undefined method `createDomainLinux' for #<Libvirt::Connect:0x7f117529b5e8> (NoMethodError)
from vhost.rb:6:in `open'
from vhost.rb:6
View vhost.rb
require 'libvirt'
conn = Libvirt::open("qemu:///system")
puts conn.capabilities
xmlcontent = File.read("domain.xml")
conn.create_domain_linux(xmlcontent, nil)
View Capfile
# 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
View config.rb
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}"
}
View config.rb
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
View Capfile
# 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
Puppet, MCollective and Capistrano
View Capfile
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
config/deploy.rb
View 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
staging cap recipe
View staging.rb
set :user, "deploy"
role :web, "staging"
after 'deploy:symlink', 'puppet:run'
@proffalken
proffalken / production.rb
Created May 27, 2011
production cap config
View production.rb
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'
You can’t perform that action at this time.