Created
April 4, 2013 22:22
-
-
Save tfl/5314901 to your computer and use it in GitHub Desktop.
a simple capistrano recipe to use with sinatra
This file contains hidden or 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
set :user, "root" | |
set :use_sudo, false | |
set :scm, :git | |
set :repository, 'file://path/to/your/local/repo' | |
set :config_dir, '<your webserver has to read this dir>' | |
set :deploy_to, '<the webroot of your sinatra application>' | |
set :deploy_via, :copy | |
set :copy_exclude, [".git", ".gitignore", "config", "Gemfile"] | |
role :app, "<hostname or ip address of your server>" | |
set :normalize_asset_timestamps, false # prevent touchin' public images/javascript folders. | |
set :shared_children, %w() # dont create shared folders | |
namespace :deploy do | |
task :start, :roles => :app do | |
run "mkdir #{current_path}/tmp" | |
run "touch #{current_path}/tmp/restart.txt" | |
end | |
task :stop, :roles => :app do | |
# no-op | |
end | |
task :finalize, :roles => :app do | |
run "mkdir #{current_path}/config" | |
run "cp #{config_dir}/* #{current_path}/config/" | |
run "chown -R 33:33 #{deploy_to}" # on debian 33 is wwwroot's uid and group id | |
run "chmod -R og-rwx #{deploy_to}" | |
end | |
task :restart, :roles => :app do | |
deploy.stop | |
deploy.start | |
end | |
end | |
after "deploy", "deploy:finalize" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment