coredns-web-ui deployment
This commit is contained in:
commit
07d2e544dd
5 files changed
+126
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Bryan Joshua Pedini
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# coredns-web-ui Deployment
|
||||||
|
Web UI for the zones and records CoreDNS serves through the `mysql` plugin: [source/coredns-web-ui](https://git.bjphoster.com/source/coredns-web-ui).
|
||||||
|
|
||||||
|
It reads and writes the plugin's records table directly and keeps its own tables (users, sessions, delegations, audit) in the same database with the `<prefix>webui_` prefix, created by its migrations at startup. It never talks to CoreDNS. It keeps no local state and needs no volume. `/health` is an unauthenticated liveness check; HSTS is left to Træfik.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
- MySQL 8 (the connection uses the `utf8mb4_0900_ai_ci` collation) holding the plugin's `<prefix>records` table. The application never creates or alters it.
|
||||||
|
- A dedicated database user with the least-privilege grants listed in the [source README](https://git.bjphoster.com/source/coredns-web-ui#mysql-grants). `DB_TABLE_PREFIX` must match the plugin's `table_prefix`.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```sh
|
||||||
|
cp env.example .env
|
||||||
|
# edit .env
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
`TRUSTED_PROXIES` must cover the Træfik network, otherwise sessions and audit rows record Træfik's address as the client origin.
|
||||||
|
|
||||||
|
Create the first admin from the running container, then manage the other users from the web UI:
|
||||||
|
```sh
|
||||||
|
printf '%s\n' "$PASSWORD" | docker compose exec -T coredns-web-ui /app user add <username> admin
|
||||||
|
```
|
||||||
|
|
||||||
|
Other CLI commands (`user`, `check`, `audit`, `version`) run the same way:
|
||||||
|
```sh
|
||||||
|
docker compose exec coredns-web-ui /app help
|
||||||
|
```
|
||||||
|
|
||||||
|
## Update
|
||||||
|
Set `COREDNS_WEBUI_VERSION` in `.env`, then:
|
||||||
|
```sh
|
||||||
|
docker compose pull
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
coredns-web-ui:
|
||||||
|
image: git.bjphoster.com/source/coredns-web-ui:${COREDNS_WEBUI_VERSION}
|
||||||
|
restart: unless-stopped
|
||||||
|
stop_grace_period: 30s
|
||||||
|
environment:
|
||||||
|
- DB_HOST=${DB_HOST}
|
||||||
|
- DB_PORT=${DB_PORT}
|
||||||
|
- DB_USER=${DB_USER}
|
||||||
|
- DB_PASSWORD=${DB_PASSWORD}
|
||||||
|
- DB_NAME=${DB_NAME}
|
||||||
|
- DB_TLS=${DB_TLS}
|
||||||
|
- DB_TABLE_PREFIX=${DB_TABLE_PREFIX}
|
||||||
|
- HTTP_ADDR=0.0.0.0
|
||||||
|
- HTTP_PORT=${TRAEFIK_SERVICE_PORT}
|
||||||
|
- LOG_LEVEL=${LOG_LEVEL}
|
||||||
|
- APP_NAME=${APP_NAME}
|
||||||
|
- COOKIE_SECURE=${COOKIE_SECURE}
|
||||||
|
- SESSION_IDLE_TIMEOUT=${SESSION_IDLE_TIMEOUT}
|
||||||
|
- SESSION_MAX_AGE=${SESSION_MAX_AGE}
|
||||||
|
- TRUSTED_PROXIES=${TRUSTED_PROXIES}
|
||||||
|
labels:
|
||||||
|
### Section Træfik
|
||||||
|
- traefik.enable=${TRAEFIK_ENABLED}
|
||||||
|
- traefik.docker.network=${TRAEFIK_NETWORK}
|
||||||
|
# HTTPS
|
||||||
|
- traefik.http.routers.https-${TRAEFIK_ROUTER}.entrypoints=https
|
||||||
|
# configure the exposed service
|
||||||
|
- traefik.http.routers.https-${TRAEFIK_ROUTER}.middlewares=${TRAEFIK_MIDDLEWARES}
|
||||||
|
- traefik.http.routers.https-${TRAEFIK_ROUTER}.rule=${TRAEFIK_MATCHRULE}
|
||||||
|
# enable TLS and its certificate provider
|
||||||
|
- traefik.http.routers.https-${TRAEFIK_ROUTER}.tls=${TRAEFIK_TLSENABLED}
|
||||||
|
- traefik.http.routers.https-${TRAEFIK_ROUTER}.tls.certresolver=${TRAEFIK_CERTRESOLVER}
|
||||||
|
# specify a service so a custom port can be used
|
||||||
|
- traefik.http.services.${TRAEFIK_SERVICE}.loadbalancer.server.port=${TRAEFIK_SERVICE_PORT}
|
||||||
|
networks:
|
||||||
|
- traefik
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
name: ${TRAEFIK_NETWORK}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
# Træfik
|
||||||
|
TRAEFIK_ENABLED=true
|
||||||
|
TRAEFIK_NETWORK=traefik
|
||||||
|
TRAEFIK_ROUTER=coredns_example_com
|
||||||
|
TRAEFIK_SERVICE=coredns_example_com
|
||||||
|
TRAEFIK_SERVICE_PORT=8080
|
||||||
|
TRAEFIK_MATCHRULE=Host(`coredns.example.com`)
|
||||||
|
TRAEFIK_TLSENABLED=true
|
||||||
|
TRAEFIK_CERTRESOLVER=letsencrypt
|
||||||
|
TRAEFIK_MIDDLEWARES=hsts
|
||||||
|
|
||||||
|
# coredns-web-ui
|
||||||
|
COREDNS_WEBUI_VERSION=0.0.1-alpha1
|
||||||
|
DB_HOST=mysql.example.com
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_USER=coredns_webui
|
||||||
|
DB_PASSWORD=changeme
|
||||||
|
DB_NAME=coredns
|
||||||
|
DB_TLS=false
|
||||||
|
DB_TABLE_PREFIX=coredns_
|
||||||
|
LOG_LEVEL=INFO
|
||||||
|
APP_NAME=CoreDNS Web UI
|
||||||
|
COOKIE_SECURE=true
|
||||||
|
SESSION_IDLE_TIMEOUT=1h
|
||||||
|
SESSION_MAX_AGE=12h
|
||||||
|
# CIDR of the Træfik network, so the client address comes from X-Forwarded-For
|
||||||
|
TRUSTED_PROXIES=172.16.0.0/12
|
||||||
Reference in new issue
Block a user