public
Last active

My mina deploy setup

  • Download Gist
deploy.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv'
 
# Basic settings:
# domain - The hostname to SSH to
# deploy_to - Path to deploy into
# repository - Git repo to clone from (needed by mina/git)
# user - Username in the server to SSH to (optional)
 
set :domain, 'youhype.tk'
set :deploy_to, '/var/www/youhype.tk'
set :repository, 'youhype@git.youhype.tk:youhype.git'
set :user, 'joerg'
set :port, '404'
 
desc "Load gem enviroment"
task :gem_path do
queue %{
#{echo_cmd %{export PATH="$PATH:$HOME/.gems/bin" GEM_HOME="$HOME/.gems"}}
}
end
 
# database config (with password) remains this way on the server
desc "Symlink shared configs"
task :symlink_shared do
queue %{
#{echo_cmd %{ln -nfs #{deploy_to}/#{shared_path}/config/database.yml ./config/database.yml}}
}
end
 
task :enviroment => :gem_path do
invoke :'rbenv:load'
invoke :gem_path
end
desc "Deploys the current version to the server."
task :deploy => :enviroment do
deploy do
# Put things that will set up an empty directory into a fully set-up
# instance of your project.
invoke :'git:clone'
invoke :'bundle:install'
invoke :'symlink_shared'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
 
to :launch do
queue 'bundle exec thin restart -C config/thin.yml'
queue 'sudo /etc/init.d/nginx reload' # allow nopasswd in visudo for nginx' init script.
end
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.