This repository has been archived by the owner on Apr 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
Added SSL certificates uploading. #164
Open
ghost
wants to merge
6
commits into
intercity:master
Choose a base branch
from
unknown repository
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
edc2990
Added SSL certificates uploading.
oiuzikov 43e9580
Houndci fixes
oiuzikov 988da51
Changed ssl config options
oiuzikov b662d03
Houndci fixes
oiuzikov cd36011
Houndci fixes
oiuzikov b522bf7
Updated method's docs
oiuzikov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Empty file.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
|
||
# Include library helpers | ||
::Chef::Resource.send(:include, Rails::Helpers) | ||
::Chef::Recipe.send(:include, Rails::Helpers) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for my curiosity: what does this do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. without this line, the following wouldn't work, method missing:
since it's a level of recipe, not resource such as:
|
||
|
||
node[:active_applications].each do |app, app_info| | ||
rails_env = app_info['rails_env'] || "production" | ||
|
@@ -93,33 +94,42 @@ | |
|
||
end | ||
|
||
if app_info['ssl_info'] | ||
template "#{applications_root}/#{app}/shared/config/certificate.crt" do | ||
owner "deploy" | ||
group "deploy" | ||
mode 0644 | ||
source "app_cert.crt.erb" | ||
variables :app_crt=> app_info['ssl_info']['crt'] | ||
if ssl_enabled?(app_info) | ||
ssl_certificate_path = ssl_certificate(applications_root, app, app_info) | ||
ssl_certificate_key_path = ssl_certificate_key(applications_root, app, app_info) | ||
|
||
[ssl_certificate_path, ssl_certificate_key_path].each do |pathname| | ||
cookbook_file pathname.to_s do | ||
source "certificates/#{pathname.basename}" | ||
owner "deploy" | ||
group "deploy" | ||
mode 0644 | ||
end | ||
end | ||
|
||
template "#{applications_root}/#{app}/shared/config/certificate.key" do | ||
owner "deploy" | ||
group "deploy" | ||
mode 0644 | ||
source "app_cert.key.erb" | ||
variables :app_key=> app_info['ssl_info']['key'] | ||
template "/etc/nginx/sites-available/#{app}.conf" do | ||
source "app_nginx.conf.erb" | ||
variables( | ||
name: app, | ||
domain_names: app_info["domain_names"], | ||
redirect_domain_names: app_info["redirect_domain_names"], | ||
ssl_enabled: true, | ||
ssl_certificate: ssl_certificate_path, | ||
ssl_certificate_key: ssl_certificate_key_path, | ||
custom_configuration: nginx_custom_configuration(app_info)) | ||
notifies :reload, resources(service: "nginx") | ||
end | ||
else | ||
template "/etc/nginx/sites-available/#{app}.conf" do | ||
source "app_nginx.conf.erb" | ||
variables( | ||
name: app, | ||
domain_names: app_info["domain_names"], | ||
redirect_domain_names: app_info["redirect_domain_names"], | ||
ssl_enabled: false, | ||
custom_configuration: nginx_custom_configuration(app_info)) | ||
notifies :reload, resources(service: "nginx") | ||
end | ||
end | ||
|
||
template "/etc/nginx/sites-available/#{app}.conf" do | ||
source "app_nginx.conf.erb" | ||
variables( | ||
name: app, | ||
domain_names: app_info["domain_names"], | ||
redirect_domain_names: app_info["redirect_domain_names"], | ||
enable_ssl: File.exists?("#{applications_root}/#{app}/shared/config/certificate.crt"), | ||
custom_configuration: nginx_custom_configuration(app_info)) | ||
notifies :reload, resources(service: "nginx") | ||
end | ||
|
||
template "#{applications_root}/#{app}/shared/config/unicorn.rb" do | ||
|
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe communicate more clearly that it should be a path for a file (and not the content):
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, but this is not the full path to cert files but a cert file name only. These files should be copied to
vendor/cookbook/rails/files/default/certificates
before uploading. For example:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. In that case I'd communicate that, indeed.
Unfortunately one cannot add comments to a JSON file...
(After all, even when reading the code I was confused as how to use it. But that might just say about my Monday State Of Mind too :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly were you confused with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry; I was merely a bit confused as to what I should have to place in the value of "certificate" and "certificate_key". I assumed it had to the abslute path on my local machine.
I was merely thinking out loud how we could improve the wording so it becomes immediate apparent what we are expecting as values there.