contactorama/config/deploy.rb

72 lines
2.4 KiB
Ruby

# Commented out as capistrano cannot finde 'bundle' on production site.
# require 'bundler/capistrano'
set :application, "contactorama"
set :local_repository, "web1@railshosting.de:/files/repositories/git/contactorama.git"
set :repository, "/var/www/htdocs/web1/files/repositories/git/contactorama.git"
set :deploy_to, "/var/www/htdocs/web1/files/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, "web1"
ssh_options[:port] = 981
set :use_sudo, false
set :deploy_via, :remote_cache
role :web, "railshosting.de" # Your HTTP server, Apache/etc
role :app, "railshosting.de" # This may be the same as your `Web` server
role :db, "railshosting.de", :primary => true # This is where Rails migrations will run
# role :db, "railshosting.de"
# extend $PATH to make sure that 'rake' can be found.
set :default_environment, {
'PATH' => "/var/www/htdocs/web1/.gem/ruby/1.9.1/bin/:$PATH"
}
# 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 RAILS_ENV=#{rails_env}")
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