blob: cbaf9636d45c1270af21c03d4aee9102a1222763 [file] [log] [blame]
# *****************************************************************************
#
# Copyright (c) 2016, EPAM SYSTEMS INC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ******************************************************************************
location /{{ CLUSTER_NAME }}/ {
rewrite ^/{{ CLUSTER_NAME }}/{{ CLUSTER_NAME }}/(.*)$ /$1 break;
rewrite ^/{{ CLUSTER_NAME }}/(.*)$ /$1 break;
proxy_pass http://{{ MASTER_IP }}:8088;
proxy_redirect http://{{ MASTER_IP }}:8088/ $scheme://$host/{{ CLUSTER_NAME }}/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
sub_filter_types *;
sub_filter_once off;
sub_filter '/static/' '/{{ CLUSTER_NAME }}/static/';
sub_filter '/cluster/' '/{{ CLUSTER_NAME }}/cluster/';
sub_filter '/conf' '/{{ CLUSTER_NAME }}/conf';
sub_filter '/logs' '/{{ CLUSTER_NAME }}/logs';
sub_filter '/stacks' '/{{ CLUSTER_NAME }}/stacks';
sub_filter '/jmx' '/{{ CLUSTER_NAME }}/jmx';
sub_filter '//{{ MASTER_DNS }}:20888' '//$host/{{ CLUSTER_NAME }}-application';
sub_filter '//{{ MASTER_DNS }}:8088' '//$host/{{ CLUSTER_NAME }}';
{% for item in slaves %}
sub_filter '//{{ item.dns }}:8042' '//$host/{{ CLUSTER_NAME }}-{{ item.name }}';
{% endfor %}
}
location /{{ CLUSTER_NAME }}-application/ {
rewrite ^/{{ CLUSTER_NAME }}-application/(.*)$ /$1 break;
proxy_pass http://{{ MASTER_IP }}:20888;
proxy_redirect http://{{ MASTER_IP }}:20888/ $scheme://$host/{{ CLUSTER_NAME }}-application/;
proxy_http_version 1.1;
proxy_set_header Accept-Encoding "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
sub_filter_types *;
sub_filter_once off;
sub_filter '/proxy/' '/{{ CLUSTER_NAME }}-application/proxy/';
}
{% for item in slaves %}
location /{{ CLUSTER_NAME }}-{{ item.name }}/ {
rewrite ^/{{ CLUSTER_NAME }}-{{ item.name }}/(.*)$ /$1 break;
proxy_pass http://{{ item.ip }}:8042;
proxy_redirect http://{{ item.ip }}:8042/ $scheme://$host/{{ CLUSTER_NAME }}-{{ item.name }}/;
proxy_http_version 1.1;
proxy_set_header Accept-Encoding "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
sub_filter_types *;
sub_filter_once off;
sub_filter '/static/' '/{{ CLUSTER_NAME }}-{{ item.name }}/static/';
sub_filter '/node/' '/{{ CLUSTER_NAME }}-{{ item.name }}/node/';
sub_filter '/conf' '/{{ CLUSTER_NAME }}-{{ item.name }}/conf';
sub_filter '/logs' '/{{ CLUSTER_NAME }}-{{ item.name }}/logs';
sub_filter '/stacks' '/{{ CLUSTER_NAME }}-{{ item.name }}/stacks';
sub_filter '/jmx' '/{{ CLUSTER_NAME }}-{{ item.name }}/jmx';
sub_filter '//{{ MASTER_DNS }}:8088' '//$host/{{ CLUSTER_NAME }}/';
}
{% endfor %}