Sha256: 659daf483c9ec4744319590524a6ed5ad98b8b3aaccdd6bf9ad9994f9fb8961b

Contents?: true

Size: 1.5 KB

Versions: 27

Compression:

Stored size: 1.5 KB

Contents

# encoding: utf-8
module MagicRecipes
  # = RVM - Deploy-Recipes
  # 
  # == unused for now
  # 
  # [Tasks:]
  #   
  # 
  # [Callbacks:]
  #   
  # 
  module Unicorn
    def self.load_into(configuration)
      configuration.load do
        
        # code is taken from railscast #337
        
        set_default(:unicorn_user) { user }
        set_default(:unicorn_pid) { "#{current_path}/tmp/pids/unicorn.pid" }
        set_default(:unicorn_config) { "#{shared_path}/config/unicorn.rb" }
        set_default(:unicorn_log) { "#{shared_path}/log/unicorn.log" }
        set_default(:unicorn_workers, 2)

        namespace :unicorn do
          desc "Setup Unicorn initializer and app configuration"
          task :setup, roles: :app do
            run "mkdir -p #{shared_path}/config"
            template "unicorn.rb.erb", unicorn_config
            template "unicorn_init.erb", "/tmp/unicorn_init"
            run "chmod +x /tmp/unicorn_init"
            run "#{sudo} mv /tmp/unicorn_init /etc/init.d/unicorn_#{application}"
            run "#{sudo} update-rc.d -f unicorn_#{application} defaults"
          end
          after "deploy:setup", "unicorn:setup"

          %w[start stop restart].each do |command|
            desc "#{command} unicorn"
            task command, roles: :app do
              run "service unicorn_#{application} #{command}"
            end
            after "deploy:#{command}", "unicorn:#{command}"
          end
          
        end
        
        # eof
        
      end
    end
  end
end

        

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
magic_recipes-0.1.17 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.16 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.15 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.14 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.13 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.11 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.10 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.9 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.8 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.7 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.6 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.5 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.4 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.3 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.2 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.1 lib/magic_recipes/unicorn.rb
magic_recipes-0.1.0 lib/magic_recipes/unicorn.rb
magic_recipes-0.0.29 lib/magic_recipes/unicorn.rb
magic_recipes-0.0.28 lib/magic_recipes/unicorn.rb
magic_recipes-0.0.27 lib/magic_recipes/unicorn.rb