Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
4 changes: 2 additions & 2 deletions recipes/restart_command.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node[:deploy].each do |application, deploy|

execute "restart Rails app #{application} for custom env" do
cwd deploy[:current_path]
if node[:opsworks][:rails_stack][:name].eql? "apache_passenger"
Expand All @@ -10,6 +9,7 @@
user deploy[:user]

action :nothing
end

only_if { node[:opsworks][:instance][:layers].include?('rails-app') }
end
end
9 changes: 6 additions & 3 deletions recipes/write_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
# See https://forums.aws.amazon.com/thread.jspa?threadID=118107

node[:deploy].each do |application, deploy|

# rails apps only
next unless deploy[:application_type].eql?('rails')
# and only if custom_env JSON is present
next unless node[:custom_env].present? && node[:custom_env][application].present?

custom_env_template do
application application
deploy deploy
env node[:custom_env][application]
env node[:custom_env][application] || {}
end

end