From 971996cec7a2c7fac0098fd7b4e57e642da6f9eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=BCmel=20Branko?= Date: Thu, 25 Dec 2025 16:37:39 +0100 Subject: [PATCH] Fix TTYD base path and App config --- .../nginx/crumbforest-locations.conf | 59 ++++++++++++++++++- native_crumbcore_v1/setup_missions.sh | 2 +- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/native_crumbcore_v1/nginx/crumbforest-locations.conf b/native_crumbcore_v1/nginx/crumbforest-locations.conf index 5543c66..2aee874 100644 --- a/native_crumbcore_v1/nginx/crumbforest-locations.conf +++ b/native_crumbcore_v1/nginx/crumbforest-locations.conf @@ -60,14 +60,67 @@ location /api/docs { # Terminal (TTYD) location /terminal/ { - proxy_pass http://127.0.0.1:7681; + # Basic-Auth (Uncomment if /etc/nginx/.htpasswd exists) + # auth_basic "Crumbforest Terminal"; + # auth_basic_user_file /etc/nginx/.htpasswd; + + proxy_pass http://127.0.0.1:7681/; # Trailing slash is important for TTYD base path proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; + proxy_read_timeout 86400; # Long timeout for terminal sessions + proxy_send_timeout 86400; } +# Gitea / Git +location /git/ { + proxy_pass http://127.0.0.1:3000/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + client_max_body_size 512M; # Allow large pushes +} + +# Qdrant Dashboard & API +location = /qdrant { return 301 /qdrant/; } + +location /qdrant/ { + proxy_pass http://127.0.0.1:6333/; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Prefix /qdrant; + proxy_read_timeout 300; + + # Body decompression for sub_filter + proxy_set_header Accept-Encoding ""; + + # Rewrites for Dashboard Assets (SPA) + sub_filter_once off; + sub_filter '="/dashboard/' '="/qdrant/dashboard/'; + sub_filter "='/dashboard/" "'=/qdrant/dashboard/"; + sub_filter '="/dashboard' '="/qdrant/dashboard'; + sub_filter "='/dashboard" "'=/qdrant/dashboard"; + + # OpenAPI & Telemetry + sub_filter '="/openapi.json' '="/qdrant/openapi.json'; + sub_filter "='/openapi.json" "'=/qdrant/openapi.json"; + sub_filter '="/telemetry' '="/qdrant/telemetry'; + sub_filter "='/telemetry" "'=/qdrant/telemetry"; +} + +# Qdrant Fallbacks (if dashboard requests root assets) +location = /openapi.json { proxy_pass http://127.0.0.1:6333/openapi.json; } +location /telemetry { proxy_pass http://127.0.0.1:6333/telemetry; } +location = /dashboard { return 301 /qdrant/dashboard/; } +location /dashboard/ { proxy_pass http://127.0.0.1:6333/dashboard/; } + # Health check (internal monitoring) location /health { proxy_pass http://crumbforest_backend; @@ -87,5 +140,5 @@ server_tokens off; access_log /var/log/nginx/crumbforest.access.log; error_log /var/log/nginx/crumbforest.error.log; -# File upload size limit (adjust if needed) -client_max_body_size 10M; +# File upload size limit +client_max_body_size 512M; # Increased for Git diff --git a/native_crumbcore_v1/setup_missions.sh b/native_crumbcore_v1/setup_missions.sh index 116d2b6..e300c9d 100755 --- a/native_crumbcore_v1/setup_missions.sh +++ b/native_crumbcore_v1/setup_missions.sh @@ -90,7 +90,7 @@ WorkingDirectory=$HOME_DIR # -W: writable (client can write to pty) - default true # -p 7681: port # bash: the command to run -ExecStart=/usr/local/bin/ttyd -p 7681 -u 1000 -g 1000 -W bash +ExecStart=/usr/local/bin/ttyd -p 7681 -b /terminal -u 1000 -g 1000 -W bash Restart=always RestartSec=3