Skip to content

Instantly share code, notes, and snippets.

@plentz
Created May 17, 2012 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plentz/2722268 to your computer and use it in GitHub Desktop.
Save plentz/2722268 to your computer and use it in GitHub Desktop.
environments files should be inside a folder named deploy.
require "capistrano_colors"
require "railsless-deploy"
set :default_stage, "dev"
require "capistrano/ext/multistage"
set :use_sudo, false
set :application, "bar"
set :user, "www-data"
set :group, "www-data"
set :scm, :git
set :repository, "git@github.com:foo/#{application}.git"
set :branch, "master"
set :deploy_via, :remote_cache
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
namespace :deploy do
task :set_deploy_folder do
set :deploy_to, "/var/www/#{application}_#{stage}"
end
task :run_ant do
run "cd #{release_path} && ant assembly -Dstage=#{stage}"
#keep just the WebContent folder
run "cd #{release_path} && ls | grep -v WebContent | xargs rm -fr"
end
end
after "deploy:symlink", "deploy:run_ant"
after "deploy:update", "deploy:cleanup"
before "deploy", "deploy:set_deploy_folder"
before "deploy:setup", "deploy:set_deploy_folder"
server 'dev.bar.com', :app, :web, :db, :primary => true
set :db_server, "jdbc:postgresql://devdb.bar.com/dev"
set :db_user, :dev
server 'production.bar.com', :app, :web, :db, :primary => true
set :db_server, "jdbc:postgresql://productiondb.bar.com/production"
set :db_user, :production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment