Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set :application, "your_application_name"
- set :ip_address , "000.000.000.000"
- set :scm, :git
- set :repository, "git@github.com:albertoleal/OlaMundo.git"
- set :branch, "master"
- set :deploy_via, :remote_cache # Deploy only the changes you have made since last deploy.
- set :user , "albertoleal"
- set :deploy_to, "/home/albertoleal/#{application}"
- set :shared_directory, "#{deploy_to}/shared"
- set :use_sudo, false
- set :group_writable, false
- set :scm_verbose, true
- default_run_options[:pty] = true
- # ROLES
- server ip_address, :app, :web, :db, :primary => true
- # HOOKS
- after 'deploy:setup', 'db:setup'
- after 'deploy:update_code' do
- db.symlink
- assets.symlink
- end
- before 'deploy:migrate' do
- deploy.bundle_install
- end
- # TASKS
- namespace :deploy do
- # 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
- desc "Run bundle install"
- task :bundle_install do
- run "cd #{release_path}/ && bundle install"
- end
- end
- namespace :db do
- desc "upload database.yml"
- task :setup do
- upload File.join(File.dirname(__FILE__),"database.yml"), "#{shared_path}/database.yml"
- end
- desc "link database.yml"
- task :symlink do
- run "rm -rf #{release_path}/config/database.yml"
- run "ln -s #{shared_path}/database.yml #{release_path}/config/database.yml"
- end
- desc "seed database"
- task :seed do
- run "cd #{current_path} && rake db:seed RAILS_ENV=production"
- end
- end
- namespace :assets do
- desc "assets symlink"
- task :symlink, :roles => :app do
- run <<-CMD
- rm -rf #{current_path}/public/images/system &&
- ln -nfs #{shared_path}/system #{release_path}/public/images/system
- CMD
- end
- end
Add Comment
Please, Sign In to add comment