1
0
Fork 0

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:
Joao Gilberto Magalhaes 2026-02-22 19:42:51 -05:00
parent 67cfcf3aff
commit 7e3134155a
16 changed files with 153 additions and 70 deletions

View file

@ -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)(/.*)?$