Skip to content

Instantly share code, notes, and snippets.

@chriskottom
Created September 10, 2013 09:23

Revisions

  1. chriskottom created this gist Sep 10, 2013.
    49 changes: 49 additions & 0 deletions deploy.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    set :application, 'Example' # the name of your app
    set :location, 'example.com' # server address
    set :user, 'deploy' # remote user (unprivileged deployment user)
    set :group, 'www-data' # remote group (should be the group your web server runs as)
    set :use_sudo, false

    set :scm, 'none'
    set :deploy_via, :copy
    set :repository, '.'
    set :deploy_to, '/var/www/example'
    set :group_writable, true

    # Any files or directories that shouldn't be copied. Modify as needed.
    set :copy_exclude, %w( *~ .bundle Capfile config/ Gemfile Gemfile.lock bin/ deploy.rb vendor/ .git/ .gitignore )

    # Single server deployment
    server location, :web, :app, :db

    namespace :deploy do
    task :default do
    update
    end

    task :finalize_update do
    escaped_release = latest_release.to_s.shellescape
    commands = []
    commands << "chgrp -R #{group} #{escaped_release}"
    commands << "chmod -R -- g+w #{escaped_release}" if fetch(:group_writable, true)
    run commands.join(' && ') if commands.any?
    end

    task :migrate do
    puts 'deploy:migrate not implemented'
    end

    task :start do
    puts 'deploy:start not implemented'
    end

    task :stop do
    puts 'deploy:stop not implemented'
    end

    task :restart do
    puts 'deploy:restart not implemented'
    end
    end

    after "deploy", "deploy:cleanup"