Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi cluster support #2

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7c3c736
initial commit to move data to datamanager
tusharmndr Nov 25, 2024
278b937
bug fix in lastKnowHosts
tusharmndr Nov 25, 2024
15a0d5f
bug fix in lastKnowHosts
tusharmndr Nov 25, 2024
7842cab
added drove client
tusharmndr Nov 25, 2024
627044f
added refersh elaspe time
tusharmndr Nov 25, 2024
ef17979
fixed template for 2 drove controller read
tusharmndr Nov 25, 2024
36b374d
added stats per namespace
tusharmndr Nov 25, 2024
c424351
fixed http client
tusharmndr Nov 25, 2024
4453f92
code review fix: log fix
tusharmndr Nov 25, 2024
f648fd2
fixed reload logic
tusharmndr Nov 26, 2024
0d86623
change templates for docker
tusharmndr Nov 26, 2024
0dfeca8
added name in enviornment variable for docekr
tusharmndr Nov 27, 2024
5ed4a16
fixed logging
tusharmndr Nov 27, 2024
dbabd3a
code review fixes
tusharmndr Dec 5, 2024
8e43c8f
merging app if vhostname matches across differetn drove cluster
tusharmndr Dec 5, 2024
2679c76
nil check in merging apps
tusharmndr Dec 6, 2024
2894a4e
code review fix
tusharmndr Dec 6, 2024
7d58fb1
nginx-plus: use upstream client as-is and add version check
vishnunaini Dec 24, 2024
5785966
Merge branch 'master' into multi_cluster
vishnunaini Dec 26, 2024
61782ab
merge fix
vishnunaini Dec 26, 2024
427773e
fix merge comment
vishnunaini Dec 27, 2024
f4f8ecc
Merge pull request #1 from vishnunaini/multi_cluster
tusharmndr Dec 27, 2024
afa0080
fix merge comment
vishnunaini Dec 27, 2024
6a51036
Merge pull request #2 from vishnunaini/multi_cluster
tusharmndr Dec 27, 2024
a65fc96
added fix for nixy plus
tusharmndr Dec 27, 2024
f9ee13c
Merge pull request #3 from tusharmndr/multi_cluster_v2
tusharmndr Dec 27, 2024
1715cfa
bug fix
tusharmndr Dec 27, 2024
cb54967
reduce log verbosity level
vishnunaini Dec 27, 2024
4264dcb
rename symbols for clarity on reloads as it is not universal,log verb…
vishnunaini Dec 27, 2024
4b6e763
Merge remote-tracking branch 'tushar/multi_cluster' into multi_cluster
vishnunaini Dec 27, 2024
c2cfcab
nginx-plus: reduce log verbosity
vishnunaini Dec 27, 2024
1d9e724
further logging changes
vishnunaini Dec 27, 2024
62e4317
symbol fixes
vishnunaini Dec 27, 2024
993ced9
Merge pull request #4 from vishnunaini/multi_cluster
tusharmndr Dec 30, 2024
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
22 changes: 13 additions & 9 deletions docker/docker-nginx.tmpl.subst
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,32 @@ http {
return 503;
}
}
{{if and .LeaderVHost .Leader.Endpoint}}
upstream {{.LeaderVHost}} {
server {{.Leader.Host}}:{{.Leader.Port}}
{{- range $nid, $namespace := .Namespaces}}
{{if and $namespace.LeaderVHost $namespace.Leader.Endpoint}}
upstream {{$namespace.LeaderVHost}} {
server {{$namespace.Leader.Host}}:{{$namespace.Leader.Port}};
}
server {
listen 7000;
server_name {{.LeaderVHost}};
server_name {{$namespace.LeaderVHost}};
location / {
proxy_set_header HOST {{.Leader.Host}};
proxy_set_header HOST {{$namespace.Leader.Host}};
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_connect_timeout 30;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://{{.LeaderVHost}}
proxy_pass http://{{$namespace.LeaderVHost}};
}
}
{{end}}
{{- range $id, $app := .Apps}}
{{end}}
{{- range $nid, $namespace := .Namespaces}}
{{- range $id, $app := $namespace.Apps}}
upstream {{$app.Vhost}} {
{{- range $app.Hosts}}
server {{ .Host }}:{{ .Port }};
{{- end}}
{{end}}
}
server {
listen 7000;
Expand All @@ -76,5 +79,6 @@ http {
proxy_pass http://{{$app.Vhost}};
}
}
{{- end}}
{{end}}
{{end}}
}
13 changes: 6 additions & 7 deletions docker/docker-nixy.toml.subst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ port = "6000"
# X-Proxy header, defaults to hostname
xproxy = ""

# Drove API
drove = [${DROVE_CONTROLLER_LIST}] # add all HA cluster nodes in priority order.
event_refresh_interval_sec = 5
user = "${DROVE_USERNAME}" # leave empty if no auth is required.
pass = "${DROVE_PASSWORD}"

# Nginx
nginx_config = "/etc/nginx/nginx.conf"
nginx_template = "${TEMPLATE_PATH}"
Expand All @@ -22,5 +16,10 @@ maxfailsupstream = 0
failtimeoutupstream = "1s"
slowstartupstream = "0s"

# Drove API
[[namespaces]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added name

drove = [${DROVE_CONTROLLER_LIST}] # add all HA cluster nodes in priority order.
user = "${DROVE_USERNAME}" # leave empty if no auth is required.
pass = "${DROVE_PASSWORD}"
leader_vhost = "${NGINX_DROVE_VHOST}"

event_refresh_interval_sec = 5
20 changes: 12 additions & 8 deletions docker/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,27 @@ http {
return 503;
}
}
{{if and .LeaderVHost .Leader.Endpoint}}
upstream {{.LeaderVHost}} {
server {{.Leader.Host}}:{{.Leader.Port}};
{{- range $nid, $namespace := .Namespaces}}
{{if and $namespace.LeaderVHost $namespace.Leader.Endpoint}}
upstream {{$namespace.LeaderVHost}} {
server {{$namespace.Leader.Host}}:{{$namespace.Leader.Port}};
}
server {
listen 7000;
server_name {{.LeaderVHost}};
server_name {{$namespace.LeaderVHost}};
location / {
proxy_set_header HOST {{.Leader.Host}};
proxy_set_header HOST {{$namespace.Leader.Host}};
proxy_connect_timeout 30;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://{{.LeaderVHost}};
proxy_pass http://{{$namespace.LeaderVHost}};
}
}
{{end}}
{{- range $id, $app := .Apps}}
{{end}}
{{- range $nid, $namespace := .Namespaces}}
{{- range $id, $app := $namespace.Apps}}
upstream {{$app.Vhost}} {
{{- range $app.Hosts}}
server {{ .Host }}:{{ .Port }};
Expand All @@ -73,5 +76,6 @@ http {
proxy_pass http://{{$app.Vhost}};
}
}
{{- end}}
{{end}}
{{end}}
}
22 changes: 13 additions & 9 deletions examples/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,31 @@ http {
return 503;
}
}
{{if and .LeaderVHost .Leader.Endpoint}}
upstream {{.LeaderVHost}} {
server {{.Leader.Host}}:{{.Leader.Port}};
{{- range $nid, $namespace := .Namespaces}}
{{if and $namespace.LeaderVHost $namespace.Leader.Endpoint}}
upstream {{$namespace.LeaderVHost}} {
server {{$namespace.Leader.Host}}:{{$namespace.Leader.Port}};
}
server {
listen 7000;
server_name {{.LeaderVHost}};
server_name {{$namespace.LeaderVHost}};
location / {
proxy_set_header HOST {{.Leader.Host}};
proxy_set_header HOST {{$namespace.Leader.Host}};
proxy_connect_timeout 30;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://{{.LeaderVHost}};
proxy_pass http://{{$namespace.LeaderVHost}};
}
}
{{end}}
{{- range $id, $app := .Apps}}
{{end}}
{{- range $nid, $namespace := .Namespaces}}
{{- range $id, $app := $namespace.Apps}}
upstream {{$app.Vhost}} {
{{- range $app.Hosts}}
server {{ .Host }}:{{ .Port }};
{{- end}}
{{end}}
}
server {
listen 7000;
Expand All @@ -73,5 +76,6 @@ http {
proxy_pass http://{{$app.Vhost}};
}
}
{{- end}}
{{end}}
{{end}}
}
28 changes: 14 additions & 14 deletions examples/nixy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ port = "6000"
# X-Proxy header, defaults to hostname
xproxy = ""

# Drove API
drove = ["http://localhost:10000"] # add all HA cluster nodes in priority order.
#drove = ["http://localhost:4000", "http://localhost:5000"] # add all HA cluster nodes in priority order.
#drove = ["https://stg-nb6.drove.phonepe.com:443"] # add all HA cluster nodes in priority order.
event_refresh_interval_sec = 5
user = "" # leave empty if no auth is required.
pass = ""
access_token = "O-Bearer OLYMPUS_TOKEN"
# Nixy realm, set this if you want to be able to filter your apps (e.g. when you have different loadbalancers which should expose different apps)
# Put your subdomain here. It will be used to match the subdomain of the exposed apps
#realm = "api.nixy.stg-drove.phonepe.nb6"

# Nginx
#nginxplusapiaddr="127.0.0.1"
Expand All @@ -29,8 +18,6 @@ nginx_template = "./nginx-header.tmpl"
nginx_cmd = "nginx" # optionally "openresty" or "docker exec nginx nginx"
nginx_ignore_check = true # optionally disable nginx config test. Health check will always show OK.

traefiklabel = "traefik.backend"
traefikbackend = ["nixy-demo"]
#nginxplusapiaddr = "10.57.11.218:2222"
maxfailsupstream = 0
failtimeoutupstream = "1s"
Expand All @@ -41,5 +28,18 @@ slowstartupstream = "0s"
#addr = "10.57.8.171:8125" # optional for statistics
#namespace = "nixy.my_mesos_cluster"
#sample_rate = 100
leader_vhost = "drove.ssdev.test"


# Drove API
[[namespaces]]
drove = ["http://localhost:10000"] # add all HA cluster nodes in priority order.
#drove = ["http://localhost:4000", "http://localhost:5000"] # add all HA cluster nodes in priority order.
#drove = ["https://stg-nb6.drove.phonepe.com:443"] # add all HA cluster nodes in priority order.
event_refresh_interval_sec = 5
user = "" # leave empty if no auth is required.
pass = ""
access_token = "O-Bearer OLYMPUS_TOKEN"
# Nixy realm, set this if you want to be able to filter your apps (e.g. when you have different loadbalancers which should expose different apps)
# Put your subdomain here. It will be used to match the subdomain of the exposed apps
#realm = "api.nixy.stg-drove.phonepe.nb6"
leader_vhost = "drove.ssdev.test"
Loading