diff --git a/.gitignore b/.gitignore index fc08492..e76278e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ git-bridge/state/ litellm/.env mem0/.env mem0/history/ +python-worker/runtime.env +python-worker/.migration-state diff --git a/docker-compose.yaml b/docker-compose.yaml index d4275b2..f2a8efc 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -195,6 +195,38 @@ services: networks: - git_forge + python_worker: + container_name: python_worker + image: n8n-python_worker + pull_policy: never + restart: unless-stopped + stop_grace_period: 60s + working_dir: /app + env_file: + - ./python-worker/runtime.env + volumes: + - /volume2/docker/n8n/python_worker:/app + - /volume2/docker/n8n/files:/files + ports: + - "8000:8000" + command: + - /bin/sh + - -lc + - . /app/.venv/bin/activate && exec python -m uvicorn fastapi_app:app --host 0.0.0.0 --port 8000 --log-level debug + dns: + - 223.5.5.5 + - 114.114.114.114 + healthcheck: + test: ["CMD", "/app/.venv/bin/python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3).read()"] + interval: 10s + timeout: 5s + retries: 18 + start_period: 30s + networks: + n8n_backbone: + aliases: + - python_worker + networks: git_forge: name: git_forge @@ -202,6 +234,10 @@ networks: external: true name: n8n_default + n8n_backbone: + external: true + name: n8n_default + secrets: postgres_superuser_password: file: ./postgres/secrets/postgres_superuser_password diff --git a/python-worker/README.md b/python-worker/README.md new file mode 100644 index 0000000..ca9228e --- /dev/null +++ b/python-worker/README.md @@ -0,0 +1,19 @@ +# Python Worker + +This is the first, compatibility-preserving ownership migration of the shared +FastAPI worker from the n8n Compose project into Infra. + +The service deliberately keeps the existing container name, port, local image, +source/state mounts, files mount, and `n8n_default` network. Therefore n8n and +the OGame Agent continue to use `http://python_worker:8000` without workflow +changes. The absent `playwright_chrome` runtime is not migrated; current OGame +automation uses the existing CDP browser endpoint. + +Host-specific, non-secret runtime values are captured during cutover in the +ignored `python-worker/runtime.env` file with mode `0600`. The 921 MB source and +state directory remains at `/volume2/docker/n8n/python_worker` for this phase so +rollback does not require a data copy. + +The local `n8n-python_worker` image is transitional. A later reviewed change +must add a pinned production Dockerfile and remove boot-time package installs +before the old image can be considered reproducible.