contactorama/config/deploy.rb
2013-11-01 23:36:06 +01:00

66 lines
2.1 KiB
Ruby

require 'bundler/capistrano'
set :application, "contactorama"
set :local_repository, "apps@freebsd.tailorama.com:/home/apps/gitrepo/contactorama.git"
set :repository, "/home/apps/gitrepo/contactorama.git"
set :deploy_to, "/home/apps/rails/#{application}"
#set :symlink_path, "/var/www/htdocs/web1/html/rails/#{application}"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :user, "apps"
# ssh_options[:port] = 981
set :use_sudo, false
set :deploy_via, :remote_cache
role :web, "tailorama.com" # Your HTTP server, Apache/etc
role :app, "tailorama.com" # This may be the same as your `Web` server
role :db, "tailorama.com", :primary => true # This is where Rails migrations will run
# role :db, "tailorama.com"
# copy shared files after update
task :update_config, :roles => :app do
run "cp -Rf #{shared_path}/config/* #{release_path}/config/"
end
# create symlink after setup
# task :symlink_config, :roles => :app do
# run "mkdir -p /var/www/htdocs/#{user}/html/rails"
# run "ln -nfs #{current_path}/public #{symlink_path}"
# end
#after "deploy:setup", :symlink_config
after "deploy:update_code", :update_config
# mod_rails (phusion_passenger) stuff
namespace :deploy do
desc "Restart Application"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end
[:start, :stop].each do |t|
desc "start/stop is not necessary with mod_rails"
task t, :roles => :app do
# nothing
end
end
end
# Precompile the assets and copy them over to the production site. (Don't build them there.)
namespace :assets do
after "deploy:update_code", "assets:precompile"
after "assets:precompile", "assets:upload_assets"
desc "precompile assets"
task :precompile do
run_locally("bundle exec rake assets:clean && bundle exec rake assets:precompile")
end
desc "precompile and upload assets to webserver"
task :upload_assets, :roles => :app do
top.upload( "public/assets", "#{release_path}/public/", :via => :scp, :recursive => true)
end
end