Skip to content

Instantly share code, notes, and snippets.

@Mic92
Created September 5, 2012 20:15
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Mic92/3643909 to your computer and use it in GitHub Desktop.
Save Mic92/3643909 to your computer and use it in GitHub Desktop.
My mina deploy setup
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment