Sha256: d7a02f872841f21074d8bb317055c31725ae21508789b8b19f22d1aec905fa9c

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

set :unicorn_user, ->{ fetch(:user) }
set :unicorn_pid, ->{ "#{current_path}/tmp/pids/unicorn.pid" }
set :unicorn_config, ->{ "#{shared_path}/config/unicorn.rb" }
set :unicorn_log, ->{ "#{shared_path}/log/unicorn.log" }
set :unicorn_workers, 8
set :unicorn_timeout, 30
set :unicorn_force_ssl, false

namespace :unicorn do
  desc "Setup unicorn initializer and app configuration"
  task :setup do
    on roles :app do
      execute :mkdir, "-p #{shared_path}/config"

      template "unicorn_init.erb", "/tmp/unicorn_init"
      template 'unicorn.erb', "#{fetch(:unicorn_config)}"

      execute :chmod, "+x /tmp/unicorn_init"
      as(:root) do
        execute :mv, "/tmp/unicorn_init /etc/init.d/unicorn_#{fetch(:application)}"
        execute :'update-rc.d', "-f unicorn_#{fetch(:application)} defaults"
      end
    end
  end

  %w[start stop restart].each do |command|
    desc "#{command} unicorn"
    task command do
      on roles(:app), in: :sequence, wait: 5 do
        command_string = "unicorn_#{fetch(:application)} #{command}"
        execute :service, command_string
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capistrano-devops-0.0.15 lib/capistrano/tasks/unicorn.rake
capistrano-devops-0.0.14 lib/capistrano/tasks/unicorn.rake
capistrano-devops-0.0.13 lib/capistrano/tasks/unicorn.rake
capistrano-devops-0.0.12 lib/capistrano/tasks/unicorn.rake