Skip to content

Instantly share code, notes, and snippets.

@franciscomxs
Created May 4, 2015 13:45
Show Gist options
  • Save franciscomxs/de1445ff85831d453713 to your computer and use it in GitHub Desktop.
Save franciscomxs/de1445ff85831d453713 to your computer and use it in GitHub Desktop.
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
set :user, 'w2b'
set :forward_agent, true
set :domain, 'w2b.co'
set :port, '22'
set :path, '$HOME/ruby/bin'
set :bundle_bin, 'ruby -S bundle'
set :deploy_to, '/home/w2b/app'
set :repository, 'git@github.com:franciscomxs/sinatra-app.git'
set :branch, 'master'
set :shared_paths, ['log', '.env', 'tmp']
task :environment do
queue! %[#{echo_cmd %{export PATH="#{path}:$PATH"}}]
end
task :setup => :environment do
queue! %[#{echo_cmd %{ssh-keyscan -H github.com > ~/.ssh/known_hosts}}]
queue! %[mkdir -p "#{deploy_to}/shared/tmp"]
queue! %[chmod g+rwx,u+rwx "#{deploy_to}/shared/tmp"]
queue! %[mkdir -p "#{deploy_to}/shared/log"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]
queue! %[mkdir -p "#{deploy_to}/shared/config"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]
queue! %[touch "#{deploy_to}/shared/.env"]
queue %[echo "-----> Be sure to edit 'shared/.env'."]
end
desc "Deploys the current version to the server."
task :deploy => :environment do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
end
end
desc 'Restart app'
task :restart => :environment do
queue! 'kill -USR1 /var/run/w2b/web.pid'
end
to :launch do
invoke :restart
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment