-
Notifications
You must be signed in to change notification settings - Fork 82
Feature/gzip support #158
base: master
Are you sure you want to change the base?
Feature/gzip support #158
Changes from 2 commits
261663d
ab45b41
509308f
17e44b4
39a50fd
b91c7c6
be800ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,11 @@ | |
end | ||
|
||
end | ||
|
||
describe file('/etc/nginx/sites-available/intercity_sample_app.conf') do | ||
it { should be_file } | ||
|
||
its(:content) 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. Trailing whitespace detected. |
||
should match /location ~ \^\/\(assets\)\/.*gzip_static on;/m | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
location ~ ^/(assets)/ { | ||
root <%= @server_root_public_path %>; | ||
gzip_static on; | ||
expires max; | ||
add_header Cache-Control public; | ||
} | ||
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. Nitpicking here, but the } is not placed correctly yet ;) 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. yeah, I've got some issues with rendering partials, the first line is always shifted 2 spaces right |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
<% server_root_public_path = "#{node['rails']['applications_root']}/#{@name}/current/public" %> | ||
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. Would it be possible to set this from the recipe instead of in the template? Somehow this feels a little hacky |
||
|
||
<%= @custom_configuration["before_server"] %> | ||
|
||
server { | ||
listen <%= node['nginx']['port'] || '80' %>; | ||
server_name <%= @domain_names.join(' ') %>; | ||
root <%= node['rails']['applications_root'] %>/<%= @name %>/current/public; | ||
root <%= server_root_public_path %>; | ||
|
||
passenger_enabled on; | ||
passenger_app_env <%= @rails_env %>; | ||
|
||
<%= render '_app_nginx_location_assets.erb', variables: { server_root_public_path: server_root_public_path } %> | ||
|
||
<%= @custom_configuration["server_main"] %> | ||
} | ||
|
||
|
@@ -23,7 +28,10 @@ server { | |
|
||
server_name <%= @domain_names.join(' ') %>; | ||
|
||
root <%= node['rails']['applications_root'] %>/<%= @name %>/current/public; | ||
root <%= server_root_public_path %>; | ||
|
||
<%= render '_app_nginx_location_assets.erb', variables: { server_root_public_path: server_root_public_path } %> | ||
|
||
<%= @custom_configuration["ssl_main"] %> | ||
} | ||
|
||
|
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.