Sha256: bc330813ca142b4e5c81991e951cdb921c513552d8f9d229460e7efab46b1a86

Contents?: true

Size: 1.18 KB

Versions: 46

Compression:

Stored size: 1.18 KB

Contents

require 'daddy/itamae'

template 'config/unicorn.rb' do
  variables :timeout => 300
end

case os_version
when /rhel-6\.(.*?)/
  template "/etc/init.d/#{ENV['APP_NAME']}" do
    source File.join(File.dirname(__FILE__), 'templates/init.d/app.erb')
    user 'root'
    owner 'root'
    group 'root'
    mode '755'
    variables :app_name => ENV['APP_NAME'],
        :rails_env => ENV['RAILS_ENV'],
        :rails_root => ENV['RAILS_ROOT'],
        :worker_processes => ENV['RAILS_ENV'] == 'production' ? 2 : 1
  end
when /rhel-7\.(.*?)/
  template "/etc/systemd/system/#{ENV['APP_NAME']}.service" do
    source File.join(File.dirname(__FILE__), 'templates/systemd/app.service.erb')
    user 'root'
    owner 'root'
    group 'root'
    mode '644'
    variables :app_name => ENV['APP_NAME'],
        :rails_env => ENV['RAILS_ENV'],
        :rails_root => ENV['RAILS_ROOT'],
        :user => ENV['USER'],
        :worker_processes => ENV['RAILS_ENV'] == 'production' ? 2 : 1
  end

  execute 'systemctl daemon-reload' do
    user 'root'
    subscribes :run, "template[/etc/systemd/system/#{ENV['APP_NAME']}.service]"
    action :nothing
  end
end

service "#{ENV['APP_NAME']}" do
  user 'root'
  action :enable
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
daddy-0.9.9 itamae/cookbooks/unicorn/install.rb
daddy-0.9.8 itamae/cookbooks/unicorn/install.rb
daddy-0.9.7 itamae/cookbooks/unicorn/install.rb
daddy-0.9.6 itamae/cookbooks/unicorn/install.rb
daddy-0.9.5 itamae/cookbooks/unicorn/install.rb
daddy-0.9.4 itamae/cookbooks/unicorn/install.rb
daddy-0.9.3 itamae/cookbooks/unicorn/install.rb
daddy-0.9.2 itamae/cookbooks/unicorn/install.rb
daddy-0.9.1 itamae/cookbooks/unicorn/install.rb
daddy-0.9.0 itamae/cookbooks/unicorn/install.rb
daddy-0.8.1 itamae/cookbooks/unicorn/install.rb
daddy-0.8.0 itamae/cookbooks/unicorn/install.rb
daddy-0.7.9 itamae/cookbooks/unicorn/install.rb
daddy-0.7.8 itamae/cookbooks/unicorn/install.rb
daddy-0.7.7 itamae/cookbooks/unicorn/install.rb
daddy-0.7.6 itamae/cookbooks/unicorn/install.rb
daddy-0.7.5 itamae/cookbooks/unicorn/install.rb
daddy-0.7.4 itamae/cookbooks/unicorn/install.rb
daddy-0.7.3 itamae/cookbooks/unicorn/install.rb
daddy-0.7.2 itamae/cookbooks/unicorn/install.rb