Skip to content

Instantly share code, notes, and snippets.

@nicolaracco
Last active December 16, 2015 09:49
Show Gist options
  • Save nicolaracco/5415612 to your computer and use it in GitHub Desktop.
Save nicolaracco/5415612 to your computer and use it in GitHub Desktop.
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
set :domain, 'server.ovofarm.com'
set :user, 'user'
set :forward_agent, true
set :deploy_to, '/var/apps/studioinnovo'
set :repository, 'ssh://[email protected]/gawaine/studioinnovo.git'
set :branch, 'master'
set :shared_paths, ['log', 'public/assets']
task :environment do
invoke :'rvm:use[ruby-2.0.0-p0@default]'
end
task setup: :environment do
%w(log config public/assets pids).each do |dir|
queue! %[mkdir -p "#{deploy_to}/shared/#{dir}"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/#{dir}"]
end
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'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
to :launch do
unicorn_pid = "#{deploy_to}/shared/pids/unicorn.pid"
queue %{
test -s "#{unicorn_pid}" && kill -USR2 `cat "#{unicorn_pid}"` && echo "Unicorn Restarted" && exit 0
echo >&2 "Unicorn not running"
}
end
end
end
ス mina deploy
-----> Using RVM environment 'ruby-2.0.0-p0@default'
Using /usr/local/rvm/gems/ruby-2.0.0-p0
-----> Creating a temporary build path
-----> Fetching new git commits
-----> Using git branch 'master'
Cloning into ....
done.
-----> Using this git commit
Nicola Racco (780ab96):
> completely removed capistrano
-----> Symlinking shared paths
-----> Installing gem dependencies using Bundler
Using sprockets (2.2.2)
Using ...
Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into ./vendor/bundle
-----> Migrating database
-----> Skipping asset precompilation
-----> Build finished
-----> Moving build to releases/4
-----> Updating the current symlink
-----> Launching
Unicorn Restarted
-----> Done. Deployed v4
Elapsed time: 8.00 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment