File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 11define nginx::loadbalancer (
22 $workers ,
3+ $caches ,
34 $backups = [],
45 $priority = 75,
56 $template = ' nginx/vhost-loadbalancing.conf.erb' ,
1415 $fail_timeout = 10,
1516 $proto = ' http' ,
1617 $magic = ' ' , # Accept arbitrary template data to append to the vhost
18+ $locations = ' ' ,
1719) {
1820
1921 include nginx
Original file line number Diff line number Diff line change @@ -10,12 +10,26 @@ upstream workers {
1010<% end -%>
1111<% end -%>
1212}
13- server {
1413
15- <%= scope.function_template(['nginx/vhost/_listen.conf.erb']) %>
14+ <% unless @caches.nil? or @caches.empty? -%>
15+ # Hack to add in additonal upstream for caching
16+ upstream vcache_workers {
17+ <% @caches.each do |cache| -%>
18+ server <%= cache %> ;
19+ <% end -%>
20+ }
21+ <% end -%>
1622
23+ server {
24+ <%= scope.function_template(['nginx/vhost/_listen.conf.erb']) %>
25+ # Define empty root dir for LB
1726 root /usr/share/empty;
27+ <% unless @locations.nil? or @locations.empty? -%>
28+
29+ # Add placeholder for additional nginx locations
30+ <%= locations %>
1831
32+ <% end -%>
1933 location / {
2034 proxy_pass <%= @proto %> ://workers;
2135 proxy_redirect off;
You can’t perform that action at this time.
0 commit comments