Created
March 30, 2015 08:55
-
-
Save robinboening/c660ebc2d7020d7df86e to your computer and use it in GitHub Desktop.
Basic deploy.rb for alchemy_cms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/capistrano' | |
require 'alchemy/capistrano' | |
require 'capistrano/ext/multistage' | |
set :bundle_without, %w(development test) | |
set :bundle_flags, "--deployment --binstubs" | |
set :use_sudo, false | |
set :scm, :git | |
set :repository, "ssh://[email protected]/to/your/repo.git" | |
set :ssh_options, { :forward_agent => true } | |
# multistage support | |
set :stages, %w(staging production) | |
set :default_stage, :staging | |
# run in pty to allow remote commands via ssh | |
default_run_options[:pty] = true | |
set :user, "your_user" | |
set :deploy_to, "/your/remote/deploy/path" | |
# before hooks | |
before "deploy:start", "deploy:seed" | |
before "deploy:create_symlink", "deploy:migrate" | |
# after hooks | |
after "deploy:setup", "alchemy:database_yml:create" | |
after "deploy:finalize_update", "alchemy:database_yml:symlink" | |
after "deploy", "deploy:cleanup" | |
namespace :log do | |
desc "show last 100 lines of production.log" | |
task :show do | |
run "tail -n100 #{shared_path}/log/#{rails_env}.log" | |
end | |
desc "watch tail of production.log and wait for additional data to be appended to the input" | |
task :watch do | |
stream("tail -f #{shared_path}/log/#{rails_env}.log") | |
end | |
end | |
namespace :deploy do | |
task :start do ; end | |
task :stop do ; end | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" | |
end | |
desc 'Seeds the database' | |
task :seed, :roles => :app, :except => { :no_release => true } do | |
run "cd #{release_path} && #{rake} RAILS_ENV=#{rails_env} db:seed" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment