Skip to content

Instantly share code, notes, and snippets.

@camelpunch
Created June 18, 2010 05:29
Show Gist options
  • Save camelpunch/443286 to your computer and use it in GitHub Desktop.
Save camelpunch/443286 to your computer and use it in GitHub Desktop.
<VirtualHost *:80>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ServerName blog.andrewbruce.net
ServerAdmin [email protected]
DocumentRoot /websites/blog.andrewbruce.net/current/public
ErrorLog /var/log/apache2/blog.andrewbruce.net-error.log
LogLevel warn
CustomLog /var/log/apache2/blog.andrewbruce.net-access.log combined
ServerSignature Off
<Directory "/websites/blog.andrewbruce.net/current/public">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Options -Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php5
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
set(:application, "blog-andrewbruce")
set(:repository) { "[email protected]:camelpunch/#{application}.git" }
set(:domain) { "blog.andrewbruce.net" }
set(:deploy_to) { "/websites/#{domain}" }
set :user, "ubuntu"
ssh_options[:keys] = ["#{ENV['HOME']}/.ssh/camelpunch.pem"]
server 'camelpunch.com', :app, :web
role :db, 'camelpunch.com', :primary => true
set :scm, :git
# based on Duncan's http://whomwah.com/2009/02/01/deploying-wordpress-to-slicehost-using-capistrano-and-git/
namespace :deploy do
task :fix_setup_permissions do
run "#{sudo} chown ubuntu.ubuntu #{deploy_to} #{deploy_to}/*"
end
desc <<-DESC
A macro-task that updates the code and fixes the symlink.
DESC
task :default do
transaction do
update_code
symlink
end
end
namespace :apache do
task :reload do
run "#{sudo} service apache2 reload"
end
end
namespace :web do
task :disable do
run "#{sudo} a2dissite #{domain}"
end
task :enable do
run "#{sudo} a2ensite #{domain}"
end
end
task :copy_sites_available do
run "#{sudo} cp #{current_path}/config/apache/* /etc/apache2/sites-available/"
end
task :update_code, :except => { :no_release => true } do
on_rollback { run "rm -rf #{release_path}; true" }
strategy.deploy!
end
task :touch_sitemaps do
run "touch /websites/#{domain}/shared/sitemap.xml"
run "touch /websites/#{domain}/shared/sitemap.xml.gz"
run "chmod 666 /websites/#{domain}/shared/sitemap.xml"
run "chmod 666 /websites/#{domain}/shared/sitemap.xml.gz"
end
end
after "deploy:web:enable", "deploy:apache:reload"
after "deploy:web:disable", "deploy:apache:reload"
after "deploy:setup", "deploy:fix_setup_permissions"
after "deploy:setup", "deploy:touch_sitemaps"
after "deploy", "deploy:copy_sites_available"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment