Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f450ddf
feat: add metrics and metrics-exporter-prometheus dependencies for en…
nxdun May 11, 2026
81ec305
feat: integrate telemetry for enhanced observability and metrics trac…
nxdun May 11, 2026
41c12c2
feat: enhance Caddyfile configuration for improved routing and access…
nxdun May 11, 2026
1cdf52d
feat: update Dockerfile and docker-compose for improved service confi…
nxdun May 11, 2026
d6939bc
feat: add Prometheus and Grafana configuration files to S3 in Terrafo…
nxdun May 11, 2026
9e364cd
feat: add Prometheus and Grafana configuration variables for enhanced…
nxdun May 11, 2026
e94dd25
feat: add Grafana dashboard and Prometheus configuration for monitori…
nxdun May 11, 2026
d28fa0a
feat: add Prometheus and Grafana services with configuration for obse…
nxdun May 11, 2026
0d3dc0a
feat: add Grafana admin user and password variables for enhanced secu…
nxdun May 12, 2026
667071c
feat: update Docker Compose and cloud-init template for improved conf…
nxdun May 12, 2026
1a8eb73
feat: update environment variable for CAPTCHA secret key and modify P…
nxdun May 12, 2026
af71da8
feat: update redirection status code in Caddyfile and improve success…
nxdun May 12, 2026
b4791c6
feat: enhance telemetry with structured logging and metrics tracking …
nxdun May 12, 2026
55ee69c
docs: update 'Things I Learned' section in README.md for clarity and …
nxdun May 12, 2026
a1c5b46
feat: add CAPTCHA security dashboard URL variable for improved telemetry
nxdun May 12, 2026
55cb301
feat: add HTTPS redirection for nadzu.localhost and update Grafana an…
nxdun May 12, 2026
36afb34
feat: add captcha security dashboard and update related configurations
nxdun May 12, 2026
bdcb37f
fix: correct typo in WARP Proxy description in docker-compose.yml
nxdun May 12, 2026
538fdd8
feat: update nadzu version to 0.4.0 in Cargo.toml and Cargo.lock
nxdun May 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ TF_VAR_YTDLP_PATH=REPLACE_WITH_TF_VAR_YTDLP_PATH
TF_VAR_DOWNLOAD_DIR=REPLACE_WITH_TF_VAR_DOWNLOAD_DIR
TF_VAR_MASTER_API_KEY=REPLACE_WITH_TF_VAR_MASTER_API_KEY
TF_VAR_WARP_LICENSE_KEY=REPLACE_WITH_TF_VAR_WARP_LICENSE_KEY
TF_VAR_GRAFANA_ADMIN_USER=REPLACE_WITH_GRAFANA_ADMIN_USER
TF_VAR_GRAFANA_ADMIN_PASSWORD=REPLACE_WITH_GRAFANA_ADMIN_PASSWORD
14 changes: 14 additions & 0 deletions .gemini/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"mcpServers": {
"grafana": {
"command": "uvx",
"args": [
"mcp-grafana"
],
"env": {
"GRAFANA_URL": "http://localhost:3000/",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": ""
}
}
}
}
88 changes: 58 additions & 30 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,62 @@
# Production Caddyfile.
{
servers {
protocols h1
trusted_proxies static ${CADDY_CLOUDFLARE_TRUSTED_PROXIES}
trusted_proxies_strict
client_ip_headers CF-Connecting-IP X-Forwarded-For
}
}

:80 {
# note: Redirect all HTTP traffic to HTTPS
redir https://api.nadzu.me{uri}
redir https://${PRODUCTION_DOMAIN}{uri}
}

api.nadzu.me:443 {
tls /etc/caddy/certs/api.nadzu.me.pem /etc/caddy/certs/api.nadzu.me.key

@notallowed {
path /nadun/fs/*
not remote_ip <allowed_ip_address>
}
# note: Only Allow MY Personal VPN IP
abort @notallowed

route /nadun/fs/* {
uri strip_prefix /nadun/fs

@mp4 path *.mp4
header @mp4 {
Content-Type "video/mp4"
Content-Disposition "inline"
Access-Control-Allow-Origin "*"
}

file_server browse {
root /home/app/downloads
hide lost+found
}
}
# note: DockerCompose Native
reverse_proxy app:${APP_PORT}
${PRODUCTION_DOMAIN}:443 {
tls /etc/caddy/certs/${PRODUCTION_DOMAIN}.pem /etc/caddy/certs/${PRODUCTION_DOMAIN}.key

# Global Matcher: Only your SSH/VPN IPs can pass
@internal_only {
not client_ip ${SSH_ALLOWED_IPS}
}

# 1. Protected File System
handle /nadun/fs/* {
respond @internal_only "Forbidden" 403

uri strip_prefix /nadun/fs
@mp4 path *.mp4
header @mp4 {
Content-Type "video/mp4"
Content-Disposition "inline"
Access-Control-Allow-Origin "*"
}

file_server {
browse /etc/caddy/browse.html
root /home/app/downloads
hide lost+found
}
}

# 2. Protected Grafana Dashboard
handle /nadun/grafana/* {
respond @internal_only "Forbidden" 403
reverse_proxy grafana:3000
}

# 3. Protected Metrics (Internal Telemetry)
handle /metrics {
respond @internal_only "Forbidden" 403
reverse_proxy app:8080
}
Comment thread
nxdun marked this conversation as resolved.

# 4. Public API
handle {
reverse_proxy app:${APP_PORT} {
header_up Host {host}
transport http {
versions 1.1
}
}
}
}
32 changes: 22 additions & 10 deletions Caddyfile.local
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
{
debug
admin :2026
email admin@nadzu.me
auto_https disable_redirects
}

# HTTP Protocol
# HTTP Protocol - Direct API Access
http://:8080 {
handle {
reverse_proxy app:8080
}
reverse_proxy app:8080
}

# HTTPS Protocol
# dev only: Redirect plain HTTP for nadzu.localhost to HTTPS permanently
http://nadzu.localhost {
redir https://{host}{uri} 301
}

# HTTPS Protocol - Full Stack Access
nadzu.localhost {
tls internal

handle_path /downloads/* {
# 1. File System Access
handle_path /nadun/fs/* {
root * /var/www/downloads

file_server {
browse /etc/caddy/browse.html
hide lost+found
}
}

# Proxy everything else to the Rust backend
# 2. Local Grafana Access
handle /nadun/grafana/* {
reverse_proxy nadzu-grafana:3000
}

# 3. Local Metrics Access
handle /metrics {
reverse_proxy app:8080
}

# 4. Default API Proxy
handle {
reverse_proxy app:8080
}
}
}
Loading
Loading