Skip to content

Instantly share code, notes, and snippets.

@tfl
Created April 4, 2013 22:22
Show Gist options
  • Save tfl/5314901 to your computer and use it in GitHub Desktop.
Save tfl/5314901 to your computer and use it in GitHub Desktop.
a simple capistrano recipe to use with sinatra
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