Spaces:
No application file
No application file
Download docker-entrypoint.sh from AnthropicallyHuggingFaces/nginx-keyless-proxy: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/spaces/AnthropicallyHuggingFaces/nginx-keyless-proxy/resolve/main/docker-entrypoint.sh
- Command line
-
hf download hf://spaces/AnthropicallyHuggingFaces/nginx-keyless-proxy/docker-entrypoint.sh
-
curl -L -o docker-entrypoint.sh https://huggingface.co/spaces/AnthropicallyHuggingFaces/nginx-keyless-proxy/resolve/main/docker-entrypoint.sh
1.13 kB
| set -euo pipefail | |
| # --------------------------------------------------------------------------- | |
| # Process graph: | |
| # | |
| # client -> nginx (:7860) -> key agent (:5001) -> upstream (:5000) | |
| # | |
| # nginx holds no secret. The key agent resolves the key into memory at | |
| # startup and attaches it on the way through. Nothing is written to disk. | |
| # --------------------------------------------------------------------------- | |
| echo "[entrypoint] starting demo upstream on :5000" | |
| python3 /opt/demo_upstream.py & | |
| echo "[entrypoint] starting key agent on :5001" | |
| python3 /opt/key_agent.py & | |
| AGENT_PID=$! | |
| # Wait for the agent to accept connections before nginx starts proxying. | |
| for _ in $(seq 1 30); do | |
| if (exec 3<>/dev/tcp/127.0.0.1/5001) 2>/dev/null; then | |
| exec 3<&- 3>&- | |
| echo "[entrypoint] key agent is up" | |
| break | |
| fi | |
| sleep 0.5 | |
| done | |
| if ! kill -0 "$AGENT_PID" 2>/dev/null; then | |
| echo "[entrypoint][fatal] key agent exited" >&2 | |
| exit 1 | |
| fi | |
| echo "[entrypoint] validating nginx config" | |
| /usr/local/nginx/sbin/nginx -t | |
| echo "[entrypoint] starting nginx in foreground" | |
| exec /usr/local/nginx/sbin/nginx -g 'daemon off;' | |