diff --git a/HISTORY/2026-08-28-obdai-receipt.md b/HISTORY/2026-08-28-obdai-receipt.md index e3e21bb..1ccd29e 100644 --- a/HISTORY/2026-08-28-obdai-receipt.md +++ b/HISTORY/2026-08-28-obdai-receipt.md @@ -529,3 +529,34 @@ Gemini-native (`candidates`/`usageMetadata`), хотя proxy возвращае разрешённого ключа невозможно. Nginx на ВМ 213 уже содержит отдельные location для `/recipe` и `/recipe/`; их изменение без новой подтверждённой проблемы не выполнялось. + +## Настройка SSH-туннеля и проверка фактического конфига + +По команде пользователя ключ доступа к немецкой ВМ передан на ВМ 213 с +правами `0600` в `/home/naeel/.ssh/gemini_proxy_key`; успешный SSH-вход на +немецкую ВМ подтверждён без вывода ключа. На ВМ 213 создан и запущен +`gemini-tunnel.service`, перенаправляющий `127.0.0.1:8768` на немецкий +`127.0.0.1:8768`; health через туннель вернул HTTP 200. + +Проверка показала, что фактический `/etc/nginx/sites-enabled/elmer` не +подключает локальный nginx-фрагмент, а `/etc/recipe/recipe.env` всё ещё +содержал внешний `GEMINI_PROXY_URL`, несмотря на работающий туннель. Поэтому +предыдущий end-to-end запрос дал 503, а `/recipe/` дал 404. Эти фактические +конфигурации требуют точечной синхронизации с workspace и повторной проверки. + +SSH-ключ с локальной машины передан на ВМ 213 в +`/home/naeel/.ssh/gemini_proxy_key` с правами `0600`; вход на немецкую ВМ +подтверждён. Создан `gemini-tunnel.service`, через который локальный +`127.0.0.1:8768` на ВМ 213 направляется к немецкому proxy. Gemini key на ВМ 213 +не используется. + +Исправлен разбор ответа proxy в `recipe_service/app.py` (`text`/`usage`), а +также добавлен Flask route для `/recipe/`. Фактический nginx-конфиг на ВМ 213 +синхронизирован с рабочими prefix locations; regex location с URI в +`proxy_pass` отклонён nginx и заменён допустимой конфигурацией. + +Итоговые проверки: health HTTP 200; POST без токена HTTP 401; POST с неверным +токеном HTTP 401; авторизованный POST `/recipe` HTTP 200 с непустыми `text` и +`usage`; авторизованный POST `/recipe/` HTTP 200 с непустыми `text` и `usage`; +redirect отсутствует. `gemini-tunnel.service`, `recipe.service` и +`elmer.service` имеют статус active. `elmer.service` не перезапускался. diff --git a/recipe_service/.env.example b/recipe_service/.env.example index a3518ab..3148b45 100644 --- a/recipe_service/.env.example +++ b/recipe_service/.env.example @@ -1,3 +1,3 @@ -GEMINI_PROXY_URL=http://95.179.252.111:8768/gemini +GEMINI_PROXY_URL=http://127.0.0.1:8768/gemini GEMINI_GENERATION_CONFIG={"temperature":0,"maxOutputTokens":300,"thinkingConfig":{"thinkingLevel":"minimal"}} RECIPE_API_TOKEN=replace-with-random-token \ No newline at end of file diff --git a/recipe_service/app.py b/recipe_service/app.py index 15027bf..4b70c9e 100644 --- a/recipe_service/app.py +++ b/recipe_service/app.py @@ -8,7 +8,7 @@ from flask import Flask, jsonify, request app = Flask(__name__) MAX_IMAGE_BYTES = 10 * 1024 * 1024 ALLOWED_TYPES = {"image/jpeg", "image/png", "image/webp"} -PROXY_URL = "http://95.179.252.111:8768/gemini" +PROXY_URL = "http://127.0.0.1:8768/gemini" def settings() -> dict: @@ -33,6 +33,7 @@ def health(): @app.post("/recipe") +@app.post("/recipe/") def recipe(): if not authorized(): return jsonify(error="unauthorized"), 401 diff --git a/recipe_service/nginx-recipe.conf b/recipe_service/nginx-recipe.conf index 432c7b2..16aca62 100644 --- a/recipe_service/nginx-recipe.conf +++ b/recipe_service/nginx-recipe.conf @@ -12,7 +12,7 @@ location = /recipe { } location /recipe/ { - proxy_pass http://127.0.0.1:8770/; + proxy_pass http://127.0.0.1:8770/recipe/; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; diff --git a/recipe_service/recipe.service b/recipe_service/recipe.service index 35d272d..c150623 100644 --- a/recipe_service/recipe.service +++ b/recipe_service/recipe.service @@ -2,6 +2,8 @@ Description=Minimal recipe Gemini proxy After=network-online.target Wants=network-online.target +Requires=gemini-tunnel.service +After=gemini-tunnel.service [Service] User=recipe