Last active
August 29, 2015 14:22
-
-
Save traviskroberts/667a83dbbf9a883f02ca to your computer and use it in GitHub Desktop.
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 'rubygems' | |
require 'vendor/sinatra/lib/sinatra.rb' | |
set :public, File.expand_path(File.dirname(__FILE__) + '/public') # Include your public folder | |
set :views, File.expand_path(File.dirname(__FILE__) + '/views') # Include the views | |
set :environment, :production | |
disable :run, :reload | |
require 'app_file' # replace this with your sinatra app file | |
run Sinatra::Application |
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
set :domain, "yourdomain.com" | |
set :application, "app_name" | |
set :deploy_to, "/var/www/apps/#{domain}" | |
set :user, "your_deploy_user" | |
set :use_sudo, false | |
set :scm, :git | |
set :repository, "git@github.com:you/application.git" | |
set :branch, 'master' | |
set :git_shallow_clone, 1 | |
role :web, domain | |
role :app, domain | |
role :db, domain, :primary => true | |
set :deploy_via, :remote_cache | |
namespace :deploy do | |
task :start do ; end | |
task :stop do ; end | |
# Assumes you are using Passenger | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" | |
end | |
task :finalize_update, :except => { :no_release => true } do | |
run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true) | |
# mkdir -p is making sure that the directories are there for some SCM's that don't save empty folders | |
run <<-CMD | |
rm -rf #{latest_release}/log && | |
mkdir -p #{latest_release}/public && | |
mkdir -p #{latest_release}/tmp && | |
ln -s #{shared_path}/log #{latest_release}/log | |
CMD | |
if fetch(:normalize_asset_timestamps, true) | |
stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S") | |
asset_paths = %w(images css).map { |p| "#{latest_release}/public/#{p}" }.join(" ") | |
run "find #{asset_paths} -exec touch -t #{stamp} {} ';'; true", :env => { "TZ" => "UTC" } | |
end | |
end | |
end |
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
cap deploy:setup | |
cap deploy |
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
mkdir vendor | |
cd vendor | |
gem unpack sinatra | |
mv sinatra-* sinatra |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment