Last active
December 24, 2015 00:19
-
-
Save ZenCocoon/6716001 to your computer and use it in GitHub Desktop.
Extension to https://github.com/engineyard/ey-cloud-recipes/tree/master/cookbooks/env_vars to enable custom unicorn config file as per https://support.cloud.engineyard.com/entries/20996656-Customize-Unicorn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: env_vars | |
# Recipe:: default | |
# | |
if ['solo', 'app', 'app_master', 'util'].include?(node[:instance_role]) | |
execute "reload-nginx" do | |
action :nothing | |
command "/etc/init.d/nginx reload" | |
end | |
node[:applications].each do |app_name, data| | |
template "/data/#{app_name}/shared/config/env.custom" do | |
source "env.custom.erb" | |
owner node[:users].first[:username] | |
group node[:users].first[:username] | |
mode 0744 | |
variables({ | |
:app_name => app_name, | |
:env_vars => node[:env_vars] | |
}) | |
end | |
case node[:environment][:stack] | |
when /nginx_passenger/i | |
template "/data/#{app_name}/shared/bin/ruby_wrapper" do | |
source "ruby_wrapper.erb" | |
owner node[:users].first[:username] | |
group node[:users].first[:username] | |
mode 0755 | |
variables({ | |
:app_name => app_name | |
}) | |
end | |
execute "update-nginx-passenger-ruby" do | |
command "echo 'passenger_ruby /data/#{app_name}/shared/bin/ruby_wrapper;' >> /etc/nginx/stack.conf" | |
not_if "grep passenger_ruby /etc/nginx/stack.conf" | |
notifies :run, resources(:execute => "reload-nginx") | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Specify environment variables for Unicorn or Passenger here | |
default[:env_vars] = { | |
:UNICORN_CONF => "/data/#{@app_name}/shared/config/custom_unicorn.rb" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment