Deploy production-hardening: security, reliability, account page, feature switches, metrics, docs
4545bb3 verified Download deploy/entrypoint.sh from EnergyVenom/patch-testing-coworker: direct link, hf CLI and curl.
- Browser
- Download file 1.64 kB
-
https://huggingface.co/spaces/EnergyVenom/patch-testing-coworker/resolve/main/deploy/entrypoint.sh
- Command line
-
hf download hf://spaces/EnergyVenom/patch-testing-coworker/deploy/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/EnergyVenom/patch-testing-coworker/resolve/main/deploy/entrypoint.sh
1.64 kB
| # Container start: prepare the data volume, start the practice pod (when the configured pod is the local one), | |
| # then run the API. With FPT_EMBEDDED_WORKER=1 the workflow worker runs inside the API process. | |
| set -e | |
| mkdir -p "$FPT_HOME/logs" | |
| # Bring back the saved data when this instance starts empty (hosts without a persistent disk). Off unless Supabase | |
| # storage is configured; a failure here must not stop the application from starting. | |
| python -m coworker state restore --soft || true | |
| # Creates the database (migrations), the secrets vault, the script library repository and the first admin from | |
| # FPT_BOOTSTRAP_ADMIN_USER / FPT_BOOTSTRAP_ADMIN_PASSWORD. Safe to run on every start. | |
| python -m coworker setup | |
| # The practice pod (mock app) lives in this container so the health checks and the test browser reach it on loopback. | |
| POD="${POD_BASE_URL:-http://127.0.0.1:3100}" | |
| case "$POD" in | |
| http://127.0.0.1:*|http://localhost:*) | |
| PLOG="$FPT_HOME/logs/practice-pod.log" | |
| # keep the practice pod's log bounded: start a new one when it passes 10 MB (one previous copy kept) | |
| if [ -f "$PLOG" ] && [ "$(wc -c < "$PLOG")" -gt 10485760 ]; then mv -f "$PLOG" "$PLOG.1"; fi | |
| PORT="${POD##*:}" node /app/mock-app/server.js >> "$PLOG" 2>&1 & | |
| ;; | |
| esac | |
| # Hosting platforms such as Render tell the container which port to listen on through PORT. It is cleared afterwards | |
| # so that helper processes the application starts (the practice pod) do not try to listen on the same port. | |
| LISTEN_PORT="${PORT:-${FPT_API_PORT:-8800}}" | |
| unset PORT | |
| exec python -m coworker api --host "${FPT_API_HOST:-0.0.0.0}" --port "$LISTEN_PORT" | |