Skip to content
Open
8 changes: 2 additions & 6 deletions recipes/configure.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
if node[:opsworks][:instance][:layers].include?('rails-app')

include_recipe "opsworks_custom_env::restart_command"
include_recipe "opsworks_custom_env::write_config"

end
include_recipe "opsworks_custom_env::restart_command"
include_recipe "opsworks_custom_env::write_config"
7 changes: 5 additions & 2 deletions recipes/restart_command.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
node[:deploy].each do |application, deploy|
if deploy[:application_type] != 'rails'
Chef::Log.debug("Skipping opsworks_custom_env::restart_command for application #{application} as it is not a rails app")
next
end

execute "restart Rails app #{application} for custom env" do
cwd deploy[:current_path]
command "#{deploy[:deploy_to]}/shared/scripts/unicorn restart"
user deploy[:user]
command node[:opsworks][:rails_stack][:restart_command]

action :nothing
end
Expand Down
4 changes: 4 additions & 0 deletions recipes/write_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# See https://forums.aws.amazon.com/thread.jspa?threadID=118107

node[:deploy].each do |application, deploy|
if deploy[:application_type] != 'rails'
Chef::Log.debug("Skipping opsworks_custom_env::restart_command for application #{application} as it is not a rails app")
next
end

custom_env_template do
application application
Expand Down