Skip to content

Instantly share code, notes, and snippets.

@natebird
Created December 20, 2008 21:12
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 natebird/38430 to your computer and use it in GitHub Desktop.
Save natebird/38430 to your computer and use it in GitHub Desktop.
multi stage production recipe for slicehost
#############################################################
# Application
#############################################################
set :application, "app_name"
set :deploy_to, "/home/user/public_html/#{application}"
#############################################################
# Settings
#############################################################
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :use_sudo, true
set :scm_verbose, true
set :rails_env, "production"
#############################################################
# Servers
#############################################################
set :user, "user"
set :ssh_options, { :forward_agent => true }
set :port, "PORT#"
set :domain, "www.example.com"
server domain, :app, :web
role :db, domain, :primary => true
#############################################################
# Git
#############################################################
set :scm, :git
set :branch, "master"
# set :scm_user, 'user'
# set :scm_passphrase, "PASSWORD"
set :repository, "git@github.com:gituser/gitrepo.git"
set :deploy_via, :remote_cache
#############################################################
# Passenger
#############################################################
namespace :deploy do
desc "Create the database yaml file"
task :after_update_code do
db_config = <<-EOF
production:
adapter: mysql
encoding: utf8
username: user
password: password
database: production
host: localhost
EOF
put db_config, "#{release_path}/config/database.yml"
# desc "Symlink the upload directories"
# task :before_symlink do
# run "mkdir -p #{shared_path}/uploads"
# run "ln -s #{shared_path}/uploads #{release_path}/public/uploads"
# end
end
#############################################################
# Passenger
#############################################################
# Restart passenger on deploy
desc "Restarting mod_rails with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end
[:start, :stop].each do |t|
desc "#{t} task is a no-op with mod_rails"
task t, :roles => :app do ; end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment