|
Download DEPLOY.md from princessamygdala/TreasureHuntForTwo: direct link, hf CLI and curl.
- Browser
- Download file 2.36 kB
-
https://huggingface.co/spaces/princessamygdala/TreasureHuntForTwo/resolve/main/DEPLOY.md
- Command line
-
hf download hf://spaces/princessamygdala/TreasureHuntForTwo/DEPLOY.md
-
curl -L -o DEPLOY.md https://huggingface.co/spaces/princessamygdala/TreasureHuntForTwo/resolve/main/DEPLOY.md
2.36 kB
| # Deploying the task (free, hands-off) + saving data to GitLab | |
| This task is a Python server app, so it must run *somewhere*. The cheapest hands-off | |
| option is **Hugging Face Spaces** (free CPU, no credit card, your computer can be off). | |
| Data is pushed to your **gitlab.pavlovia.org** repo on each finish. | |
| ## 1. Make a GitLab data repo (one time) | |
| 1. On https://gitlab.pavlovia.org create a **new project**, e.g. `task_sl-cu-data` | |
| (Private). Initialize it with a README so the `master` branch exists. | |
| 2. Create an access token: the project → **Settings → Access Tokens** → role `Maintainer`, | |
| scope **`write_repository`**. Copy the token (starts with `glpat-`). | |
| ## 2. Test the GitLab push locally (optional) | |
| ```bash | |
| cp .env.example .env # then edit .env with your token + project path | |
| uv run python web_app.py # play to the end; finished data should appear in the repo | |
| ``` | |
| Each session's files land under `data/<seed>/` in the repo: | |
| `*_trials.csv`, `*_ratings.csv`, `*_quiz.csv`, the raw `.msgpack`, and a `.json`. | |
| ## 3. Host on Hugging Face Spaces (free) | |
| 1. Make a free account at https://huggingface.co. | |
| 2. **New Space** → Owner = you → **SDK: Docker** → blank → Create. | |
| 3. Push this folder to the Space's git repo (HF shows the exact `git remote add` / | |
| `git push` commands). The included `Dockerfile` builds it automatically. | |
| 4. Prepend this YAML block to the **top of `README.md`** in the Space (HF needs it): | |
| ``` | |
| --- | |
| title: Treasure Hunt | |
| sdk: docker | |
| app_port: 7860 | |
| --- | |
| ``` | |
| 5. In the Space → **Settings → Variables and secrets**, add **secrets**: | |
| `GITLAB_TOKEN`, `GITLAB_PROJECT`, `GITLAB_URL`, `GITLAB_BRANCH`, `STORAGE_SECRET`. | |
| 6. The Space builds (a few minutes) and gives you a public URL like | |
| `https://<you>-treasure-hunt.hf.space`, **that's the link you send participants.** | |
| The Space sleeps after long inactivity and wakes on the next visit, so it costs nothing | |
| and needs no machine of yours running. Data keeps flowing into your GitLab repo. | |
| ## Participant requirements | |
| A modern **desktop/laptop browser** (Chrome/Safari/Firefox/Edge) with a **keyboard**. | |
| Not suitable for phones/tablets (it's keyboard-driven). | |
| ## Other hosts | |
| The same `Dockerfile` deploys to **Google Cloud Run** (free tier, scales to zero) or | |
| **Fly.io** (paid, ~few $/mo) if you ever outgrow the free Space. | |