Introduce embedded HTTP server for HAProxy monitoring dashboard
- Added a Python-based HTTP server to serve `dashboard.html` at `/` or `/dashboard.html` paths. - Updated HAProxy configuration to integrate backend for the dashboard. - Enhanced handling of index paths with conditional redirects to the dashboard page. - Modified tests and updated expected outputs to reflect these changes.
This commit is contained in:
parent
67cfcf3aff
commit
7e3134155a
16 changed files with 153 additions and 70 deletions
|
|
@ -21,7 +21,7 @@ Automatically generates HAProxy `fcgi-app` configuration that defines required C
|
|||
| Option | Description | Default |
|
||||
|-------------------|-----------------------------------------|------------------------------------|
|
||||
| `enabled` | Enable/disable plugin | `true` |
|
||||
| `document_root` | Document root path | `/etc/easyhaproxy/www` |
|
||||
| `document_root` | Document root path | `/var/www/html` |
|
||||
| `script_filename` | Custom pattern for SCRIPT_FILENAME | `%[path]` (uses HAProxy's default) |
|
||||
| `index_file` | Default index file | `index.php` |
|
||||
| `path_info` | Enable PATH_INFO support | `true` |
|
||||
|
|
@ -41,10 +41,10 @@ services:
|
|||
easyhaproxy.http.localport: 9000
|
||||
easyhaproxy.http.proto: fcgi
|
||||
easyhaproxy.http.plugins: fastcgi
|
||||
easyhaproxy.http.plugin.fastcgi.document_root: /etc/easyhaproxy/www
|
||||
easyhaproxy.http.plugin.fastcgi.document_root: /var/www/html
|
||||
easyhaproxy.http.plugin.fastcgi.index_file: index.php
|
||||
volumes:
|
||||
- ./app:/etc/easyhaproxy/www
|
||||
- ./app:/var/www/html
|
||||
```
|
||||
|
||||
### Docker/Docker Compose (Unix socket)
|
||||
|
|
@ -58,10 +58,10 @@ services:
|
|||
easyhaproxy.http.socket: /run/php/php-fpm.sock
|
||||
easyhaproxy.http.proto: fcgi
|
||||
easyhaproxy.http.plugins: fastcgi
|
||||
easyhaproxy.http.plugin.fastcgi.document_root: /etc/easyhaproxy/www
|
||||
easyhaproxy.http.plugin.fastcgi.document_root: /var/www/html
|
||||
easyhaproxy.http.plugin.fastcgi.index_file: index.php
|
||||
volumes:
|
||||
- ./app:/etc/easyhaproxy/www
|
||||
- ./app:/var/www/html
|
||||
- /run/php:/run/php
|
||||
```
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ kind: Ingress
|
|||
metadata:
|
||||
annotations:
|
||||
easyhaproxy.plugins: "fastcgi"
|
||||
easyhaproxy.plugin.fastcgi.document_root: "/etc/easyhaproxy/www"
|
||||
easyhaproxy.plugin.fastcgi.document_root: "/var/www/html"
|
||||
easyhaproxy.plugin.fastcgi.index_file: "index.php"
|
||||
spec:
|
||||
rules:
|
||||
|
|
@ -101,7 +101,7 @@ easymapping:
|
|||
- fastcgi
|
||||
plugin_config:
|
||||
fastcgi:
|
||||
document_root: /etc/easyhaproxy/www
|
||||
document_root: /var/www/html
|
||||
index_file: index.php
|
||||
path_info: true
|
||||
```
|
||||
|
|
@ -111,7 +111,7 @@ easymapping:
|
|||
| Environment Variable | Config Key | Type | Default | Description |
|
||||
|----------------------------------------------|-------------------|----------|------------------------|---------------------------------------|
|
||||
| `EASYHAPROXY_PLUGIN_FASTCGI_ENABLED` | `enabled` | boolean | `true` | Enable/disable plugin for all domains |
|
||||
| `EASYHAPROXY_PLUGIN_FASTCGI_DOCUMENT_ROOT` | `document_root` | string | `/etc/easyhaproxy/www` | Document root path |
|
||||
| `EASYHAPROXY_PLUGIN_FASTCGI_DOCUMENT_ROOT` | `document_root` | string | `/var/www/html` | Document root path |
|
||||
| `EASYHAPROXY_PLUGIN_FASTCGI_SCRIPT_FILENAME` | `script_filename` | string | `%[path]` | Custom pattern for SCRIPT_FILENAME |
|
||||
| `EASYHAPROXY_PLUGIN_FASTCGI_INDEX_FILE` | `index_file` | string | `index.php` | Default index file |
|
||||
| `EASYHAPROXY_PLUGIN_FASTCGI_PATH_INFO` | `path_info` | boolean | `true` | Enable PATH_INFO support |
|
||||
|
|
@ -121,7 +121,7 @@ easymapping:
|
|||
```haproxy
|
||||
# Top-level fcgi-app definition (added after defaults, before frontends/backends)
|
||||
fcgi-app fcgi_phpapp_local
|
||||
docroot /etc/easyhaproxy/www
|
||||
docroot /var/www/html
|
||||
index index.php
|
||||
path-info ^(/.+\.php)(/.*)?$
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ All EasyHAProxy files are organized under `/etc/easyhaproxy/`. This can be custo
|
|||
│
|
||||
├── cloudflare_ips.lst # Optional - Cloudflare plugin
|
||||
│
|
||||
└── www/ # Optional - FastCGI document root
|
||||
└── index.php
|
||||
└── www/ # 📦 Base image - Stats dashboard
|
||||
└── dashboard.html # 📦 Base image - Stats dashboard UI
|
||||
```
|
||||
|
||||
:::tip Legend
|
||||
|
|
@ -88,7 +88,7 @@ The most commonly mapped volumes for persistence and customization:
|
|||
| `/etc/easyhaproxy/haproxy/errors-custom/` | [Custom error pages](other.md) - custom HTTP error pages (400, 403, 500, etc.) | Optional |
|
||||
| `/etc/easyhaproxy/plugins/` | [Custom plugins](../guides/plugins.md) - Python plugin files | Optional |
|
||||
| `/etc/easyhaproxy/jwt_keys/` | [JWT public keys](plugins/jwt-validator.md) - RSA public keys for JWT validation | Optional |
|
||||
| `/etc/easyhaproxy/www/` | [FastCGI document root](plugins/fastcgi.md) - PHP/FastCGI application files | Optional |
|
||||
| `/etc/easyhaproxy/www/` | Stats dashboard UI - served on port `stats_port + 10000` (default `11936`) | Optional |
|
||||
|
||||
## Directory Details
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue