Skip to content

Instantly share code, notes, and snippets.

@ozgg
Created August 19, 2013 12:11
Show Gist options
  • Select an option

  • Save ozgg/6268460 to your computer and use it in GitHub Desktop.

Select an option

Save ozgg/6268460 to your computer and use it in GitHub Desktop.
Deployment settings
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)
# branch - Branch name to deploy. (needed by mina/git)
set :domain, 'example.com'
set :deploy_to, '/var/www/example.com'
set :repository, 'example.com:/opt/git/example.git'
set :branch, 'master'
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, %w(config/database.yml log tmp)
# Optional settings:
# set :user, 'foobar' # Username in the server to SSH to.
# set :port, '30000' # SSH port number.
task :environment do
invoke :'rbenv:load'
end
task :setup => :environment do
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! %[mkdir -p "#{deploy_to}/shared/tmp"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/tmp"]
queue! %[touch "#{deploy_to}/shared/config/database.yml"]
queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
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
queue! "bundle exec pumactl -S #{deploy_to}/shared/tmp/puma.state restart"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment