Minimal deployment via rake, git and
Similar to github’s deployment strategy and others, but with rake and ssh. Works a treat for single-server deployments.
desc "Deploy the application"
task :deploy do
commands = [
"cd /sites/myapp.com/app",
"git fetch",
"git reset --hard origin/master",
"git submodule init",
"git submodule update",
"mkdir -p tmp",
"touch tmp/restart.txt"
]
exec "ssh myserver '#{commands.join(" && ")}'"
end
Bonus points for ensuring gem dependencies are installed on the deployment destination machine.