-
Notifications
You must be signed in to change notification settings - Fork 0
[feat(infra)] Add Prometheus and Grafana observability stack #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 81ec305
feat: integrate telemetry for enhanced observability and metrics trac…
nxdun 41c12c2
feat: enhance Caddyfile configuration for improved routing and access…
nxdun 1cdf52d
feat: update Dockerfile and docker-compose for improved service confi…
nxdun d6939bc
feat: add Prometheus and Grafana configuration files to S3 in Terrafo…
nxdun 9e364cd
feat: add Prometheus and Grafana configuration variables for enhanced…
nxdun e94dd25
feat: add Grafana dashboard and Prometheus configuration for monitori…
nxdun d28fa0a
feat: add Prometheus and Grafana services with configuration for obse…
nxdun 0d3dc0a
feat: add Grafana admin user and password variables for enhanced secu…
nxdun 667071c
feat: update Docker Compose and cloud-init template for improved conf…
nxdun 1a8eb73
feat: update environment variable for CAPTCHA secret key and modify P…
nxdun af71da8
feat: update redirection status code in Caddyfile and improve success…
nxdun b4791c6
feat: enhance telemetry with structured logging and metrics tracking …
nxdun 55ee69c
docs: update 'Things I Learned' section in README.md for clarity and …
nxdun a1c5b46
feat: add CAPTCHA security dashboard URL variable for improved telemetry
nxdun 55cb301
feat: add HTTPS redirection for nadzu.localhost and update Grafana an…
nxdun 36afb34
feat: add captcha security dashboard and update related configurations
nxdun bdcb37f
fix: correct typo in WARP Proxy description in docker-compose.yml
nxdun 538fdd8
feat: update nadzu version to 0.4.0 in Cargo.toml and Cargo.lock
nxdun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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": "" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
|
|
||
| # 4. Public API | ||
| handle { | ||
| reverse_proxy app:${APP_PORT} { | ||
| header_up Host {host} | ||
| transport http { | ||
| versions 1.1 | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.