Spaces:
Sleeping
Download docs/deployment.md from JoeTach/cdpr-simulator: direct link, hf CLI and curl.
- Browser
- Download file 6.42 kB
-
https://huggingface.co/spaces/JoeTach/cdpr-simulator/resolve/main/docs/deployment.md
- Command line
-
hf download hf://spaces/JoeTach/cdpr-simulator/docs/deployment.md
-
curl -L -o deployment.md https://huggingface.co/spaces/JoeTach/cdpr-simulator/resolve/main/docs/deployment.md
A newer version of the Gradio SDK is available: 6.32.0
Deployment guide
Connection map for the cdpr framework. The local checkout is the development workspace; GitHub is the source of truth; each external service redeploys from a single watched branch.
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Local dev machine β
β ββ editor + pytest + smoke_phase*.py + git ββ β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββ
β git push
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GitHub: Tachia/cdpr_simulator (branch: main) β
β CI: .github/workflows/ci.yml (lint + pytest) β
ββββ¬βββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββ¬βββββ
β β β β
webhook β webhook β webhook β webhook β
βΌ βΌ βΌ βΌ
ββββββββββββββββββββ ββββββββββββββββ ββββββββββββββββββ ββββββββββββββββ
β Render β β Streamlit β β Cloudflare β β Supabase β
β cdpr-api β β Community β β Pages β β (optional) β
β FastAPI β β Cloud β β docs/ β β metadata β
β Dockerfile β β streamlit_ β β index.html β β + uploads β
β render.yaml β β app.py β β β β β
ββββββββββββββββββββ ββββββββββββββββ ββββββββββββββββββ ββββββββββββββββ
β β β²
β /simulate /workspace /plot /robots /health β
ββββββββββββββββββββββΊββββββββββββββββββββββββββββββββββββ
(HTTP, JSON)
What lives where
| Layer | Hosting | What's needed |
|---|---|---|
| FastAPI backend | Render (Docker web service) | Render account; connect to the GitHub repo; first deploy uses render.yaml |
| Streamlit console | Streamlit Community Cloud | Streamlit account (free); point at streamlit_app.py, set CDPR_BACKEND_URL to the Render URL |
| Static docs | Cloudflare Pages | Cloudflare account; connect the repo; set the output directory to docs/; no build command |
| Storage | Supabase (optional) | Supabase project; copy URL + service-role key into Render env |
| Local physics | MuJoCo on the dev machine | pip install mujoco; runs identically to local |
| CI | GitHub Actions | Free, configured in .github/workflows/ci.yml |
Render β backend service (FastAPI)
- Sign in at dashboard.render.com.
- New + β Blueprint β connect this repo.
- Render reads
render.yamland proposes thecdpr-apiweb service. - Confirm the build (Docker) and the
/healthhealth-check. - Once green, copy the public URL (e.g.
https://cdpr-api.onrender.com) and set it asCDPR_BACKEND_URLin the Streamlit deployment env.
Render's free plan sleeps after inactivity; the /health endpoint is
fast and cheap, which keeps cold-starts < 30 s.
Streamlit Community Cloud β research console
Sign in at share.streamlit.io with the GitHub account that owns the repo.
New app β choose this repo /
mainbranch / filestreamlit_app.py.Under Advanced settings β Secrets, add:
CDPR_BACKEND_URL = "https://cdpr-api.onrender.com"Deploy. The first build takes a few minutes (PyTorch and SciPy are chunky); subsequent pushes redeploy in seconds.
Cloudflare Pages β documentation
- Sign in at dash.cloudflare.com β Workers & Pages.
- Create application β Pages β Connect to Git β select this repo.
- Build configuration:
- Framework preset: None
- Build command: leave empty
- Build output directory:
docs
- Save and deploy. The site lives at
https://<project>.pages.dev.
Supabase β persistent storage (optional)
- Sign in at supabase.com β New project.
- SQL editor β run
supabase/schema.sqlto create the tables. - Copy the project URL and the service-role key into Render's env
under
SUPABASE_URLandSUPABASE_SERVICE_ROLE_KEY. - The FastAPI service reads them when present; with no Supabase credentials configured, all storage endpoints fall back to local in-memory operation and the rest of the API works unchanged.
GitHub Actions β CI
.github/workflows/ci.yml runs ruff + pytest on every push and PR
against main. It uses the lean [dev,viz,data,api] install β heavy
extras (torch, sb3, mujoco) are exercised locally via the smoke scripts.
Development loop
edit src/cdpr/... # local change
pytest tests/ # local validation (~52 s)
git add ... && git commit
git push # triggers GitHub Actions + Render + Streamlit
Render and Streamlit Community Cloud both watch main by default;
Cloudflare Pages does the same with its automatic-deploy setting. A
single git push cascades to every connected service within a couple of
minutes.
Required env vars
See .env.example at the repo root for the full annotated list. The
backend reads everything from the environment β there are no hardcoded
secrets in the source.