#!/bin/bash set -e # 1. Start LibreTranslate internally (env vars LT_HOST/LT_PORT are already set) /app/venv/bin/libretranslate & LT_PID=$! # 2. Wait until it responds echo "Waiting for LibreTranslate on 127.0.0.1:5000..." for i in {1..30}; do if curl -s http://127.0.0.1:5000/ >/dev/null 2>&1; then echo "LibreTranslate ready" break fi echo " ... retry $i/30" sleep 2 done # 3. Keep your suggestion uploader running in the background ( while true; do /app/venv/bin/python3 /app/upload_suggestions.py sleep 60 done ) & # 4. Start the public-facing proxy (this is the foreground process) cd /app exec /app/venv/bin/uvicorn proxy:app --host 0.0.0.0 --port 7860