add notes on labels setup for nginx/pihole sautomation
All checks were successful
deploy-docs / build-and-deploy (push) Successful in 1m32s
All checks were successful
deploy-docs / build-and-deploy (push) Successful in 1m32s
This commit is contained in:
@@ -32,6 +32,32 @@ configurations.
|
||||
{{% include "/srv/configs/docker_compose/nginx-proxy-manager/docker-compose.yaml" %}}
|
||||
```
|
||||
|
||||
## Automation (Docker Labels)
|
||||
|
||||
To avoid manually configuring Proxy Hosts in the UI (and to keep configuration tightly coupled with the services themselves), I use the `npm-sync` sidecar container.
|
||||
|
||||
This sidecar monitors the Docker socket. When a container spins up with specific labels, `npm-sync` automatically talks to the Nginx Proxy Manager API and creates the Proxy Host. When the container is destroyed, the route is cleaned up.
|
||||
|
||||
### How to Auto-Configure a Service
|
||||
To expose a new container, simply add the following labels to its `docker-compose.yaml`. You do not need to touch the NPM UI.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
my-app:
|
||||
image: my-app:latest
|
||||
labels:
|
||||
- "npm.proxy.domains=myapp.wompmacho.com" # The URL
|
||||
- "npm.proxy.port=8080" # Internal port the app listens on
|
||||
- "npm.proxy.scheme=http" # Usually http or https
|
||||
- "npm.proxy.ssl.force=true" # Force HTTPS
|
||||
- "npm.proxy.ssl.letsencrypt=true" # Auto-provision SSL certificate
|
||||
```
|
||||
|
||||
> [!important] Direct Edits
|
||||
> Avoid making direct edits to NPM `.conf` files on the host, as it will desync the database and the Web UI. Always use the Web UI or API-driven automation like `npm-sync`.
|
||||
|
||||
## Nginx routing
|
||||
|
||||
Nginx gives you that great routing to your internal networked servers. Also
|
||||
helps you set up your DNS both inside and outside the network. Can be a little
|
||||
confusing at first.
|
||||
|
||||
Reference in New Issue
Block a user