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

HAProxy admin page access via nginx #12

Closed
Vonng opened this issue Feb 18, 2021 · 1 comment
Closed

HAProxy admin page access via nginx #12

Vonng opened this issue Feb 18, 2021 · 1 comment
Assignees
Labels
ENHANCEMENT New feature or request
Milestone

Comments

@Vonng
Copy link
Owner

Vonng commented Feb 18, 2021

Scenario

HAProxy provides a handy admin web UI. And we already have a nginx server on meta node.
So why don't we build an index page for all haproxy instance and make nginx proxy for them?

Proposal

  • Add a new domain name h.pigsty for haproxy index pages
  • Add new default entry in nginx_upstream
    - { name: haproxy,       host: h.pigsty, url: "127.0.0.1:9091" }
  • Setup upstream and proxy in /etc/nginx/conf.d/haproxy.conf
# haproxy instance definition
upstream pg-meta-1 {
    server 10.10.10.10:9101 max_fails=0;
}
upstream pg-test-1 {
    server 10.10.10.11:9101 max_fails=0;
}
upstream pg-test-2 {
    server 10.10.10.12:9101 max_fails=0;
}
upstream pg-test-3 {
    server 10.10.10.13:9101 max_fails=0;
}


# nginx proxy for haproxy admin
server {
    listen       80;
    server_name  h.pigsty;

    location ^~/pg-meta-1/ {
        proxy_pass http://pg-meta-1;
        proxy_connect_timeout 2;
    }
    location ^~/pg-test-1/ {
        proxy_pass http://pg-test-1;
        proxy_connect_timeout 2;
    }
    location ^~/pg-test-2/ {
        proxy_pass http://pg-test-2;
        proxy_connect_timeout 2;
    }
    location ^~/pg-test-3/ {
        proxy_pass http://pg-test-3;
        proxy_connect_timeout 2;
    }

    location / {
        root        //www/;
        index       haproxy.html;
    }
}
  • Add index page for all haproxy pages: haproxy.html
  • Add auth for haproxy admin web UI: haproxy_admin_auth_enabled
@Vonng Vonng added the ENHANCEMENT New feature or request label Feb 18, 2021
@Vonng Vonng added this to the v0.6 milestone Feb 18, 2021
@Vonng Vonng self-assigned this Feb 18, 2021
@Vonng
Copy link
Owner Author

Vonng commented Feb 19, 2021

Resolved

@Vonng Vonng closed this as completed Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ENHANCEMENT New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant