Files
bincio-activity/docs/deployment/single-user.md
T
2026-04-09 08:59:40 +02:00

118 lines
2.9 KiB
Markdown

# Single-user deployment
One person, one machine, all your data stays with you. No login, no server process.
## Data layout
All data lives under your instance root in a per-user subdirectory:
```
~/bincio_data/ ← instance root (output.dir in config)
index.json ← shard manifest (generated by bincio render/dev)
yourname/
index.json ← your BAS feed
_merged/ ← sidecar-merged output (served to browser)
activities/
edits/
athlete.json
```
`bincio extract` writes into `yourname/` automatically — pass the instance root to `--output`, not the user directory.
## Local development
```bash
uv run bincio dev --data-dir ~/bincio_data
# → http://localhost:4321/u/yourname/
```
`bincio dev` without an `instance.db` runs in single-user mode: no login, no API server, just `astro dev`.
## GitHub Pages (free, automated)
```bash
uv run bincio render --data-dir ~/bincio_data --deploy github
```
Builds `site/dist/` and pushes it to the `gh-pages` branch. Requires `npx gh-pages` (`npm install -g gh-pages`).
Set the repository to serve from the `gh-pages` branch in GitHub → Settings → Pages.
## Static hosting (Netlify, Vercel, Cloudflare Pages, etc.)
Build locally and deploy `site/dist/`:
```bash
uv run bincio render --data-dir ~/bincio_data
# upload site/dist/ to your host
```
Or set up CI:
```yaml
# .github/workflows/deploy.yml (example)
- run: uv run bincio render --data-dir ~/bincio_data
- uses: actions/upload-pages-artifact@v3
with:
path: site/dist
```
## VPS with nginx (read-only)
Serve `site/dist/` as a static directory:
```nginx
server {
listen 80;
server_name example.com;
root /var/www/bincio/dist;
index index.html;
location / { try_files $uri $uri/ $uri.html =404; }
}
```
### Enable the edit UI on a VPS
To edit activities from the browser on your VPS, run `bincio edit` and proxy `/api/*` to it:
```nginx
server {
listen 443 ssl;
server_name example.com;
root /var/www/bincio/dist;
location / {
try_files $uri $uri/ $uri.html =404;
}
location /api/ {
proxy_pass http://127.0.0.1:4041;
proxy_set_header Host $host;
}
}
```
```bash
uv sync --extra edit
uv run bincio edit --data-dir ~/bincio_data
```
Set `PUBLIC_EDIT_URL=` (empty — the proxy makes `/api/` same-origin) in your environment before building.
## Keeping the site up to date
After extracting new activities or editing sidecars:
```bash
uv run bincio extract --data-dir ~/bincio_data # process new files
uv run bincio render --data-dir ~/bincio_data # rebuild site/dist/
rsync -av site/dist/ user@server:/var/www/bincio/dist/
```
Or automate with a cron job or GitHub Action.
## Privacy note
Single-user mode has no authentication. The site is public to anyone with the URL. Use `privacy: private` in sidecar files to hide specific activities, or restrict access at the nginx level (HTTP basic auth, IP allowlist, etc.).