auto-save 2026-07-13

This commit is contained in:
Ray
2026-07-13 02:00:15 -04:00
parent dab5a4ebc6
commit 473729267c
14 changed files with 579 additions and 38 deletions
@@ -200,6 +200,19 @@ curl -skL https://localhost:<SSL_PORT>/ | grep -o '<title>.*</title>' # follow
```
- Bluetooth errors (`AttributeError: 'NoneType' object has no attribute 'send'`) on servers without Bluetooth hardware are **harmless noise** — ignore them
- First access returns 302 to `/onboarding.html` — normal
### SparkyFitness
- **Self-hosted MyFitnessPal alternative** — Docker Compose at `/mnt/seagate8tb/Websites/SparkyFitness/docker-compose.yml`, `.env` in the same directory. Data lives under `/mnt/seagate8tb/Websites/SparkyFitness/` (NOT `/mnt/seagate8tb/docker/`).
- **Stack**: frontend (port 3004→container 80), server (internal 3010), Postgres (internal 5432)
- **`SPARKY_FITNESS_FRONTEND_URL` in `.env` must match the public HTTPS URL** — this is critical for CORS and OAuth callbacks. Set it to `https://sparkyfitness.graj-media.com` (or whatever subdomain you use). Without this, the mobile app will fail to connect.
- **`SPARKY_FITNESS_EXTRA_TRUSTED_ORIGINS`** should include the public domain plus any local access IPs (e.g., `http://localhost:3004,http://192.168.50.98:3004`).
- **HTTPS required for mobile app** — the Android/iOS app refuses to connect over HTTP. The frontend runs nginx internally on port 80 (mapped to host 3004), so nginx reverse proxy to port 3004 with SSL cert is the expected setup.
- **Mobile app `SparkyFitnessMobile.apk`** — download from GitHub releases: `https://github.com/CodeWithCJ/SparkyFitness/releases/latest` (asset `app-release.apk`, ~188MB). Also available as Google Play closed beta.
- **`NODE_ENV=production`** should be set in `.env` for optimal performance and security.
- **`SPARKY_FITNESS_DISABLE_SIGNUP=false`** by default — set to `true` after creating accounts if you want to lock down registration.
- **Backup**: server auto-backups go to `./backup` directory. Always backup before upgrading (schema changes can be breaking).
- **OIDC/Passkey support** — optional, configured via env vars. The failsafe `SPARKY_FITNESS_FORCE_EMAIL_LOGIN=true` prevents lockout when testing OIDC.
### Mealie
- **Internal port is 9000**, not 9925. Map like: `-p 127.0.0.1:9925:9000`
@@ -0,0 +1,93 @@
# SparkyFitness Setup (rayserver)
## Deployment
- Docker Compose: `/mnt/seagate8tb/Websites/SparkyFitness/docker-compose.yml`
- Env config: `/mnt/seagate8tb/Websites/SparkyFitness/.env`
- Backup dir: `/mnt/seagate8tb/Websites/SparkyFitness/backup/`
- Uploads dir: `/mnt/seagate8tb/Websites/SparkyFitness/uploads/`
## Architecture
```
[Internet] → nginx (home server, port 3451 SSL) → localhost:3004 → frontend container (nginx, port 80)
↕ (Docker network)
server container (port 3010)
Postgres container (port 5432)
```
The frontend container runs its own nginx that reverse-proxies API calls to the server container over the Docker internal network. The home server nginx just proxies HTTP to port 3004.
## Nginx Reverse Proxy Config
Home nginx (`/etc/nginx/sites-available/sparkyfitness`):
```nginx
server {
listen 3451 ssl;
server_name sparkyfitness.graj-media.com grajmedia.duckdns.org;
ssl_certificate /etc/letsencrypt/live/grajmedia.duckdns.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/grajmedia.duckdns.org/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 100M;
location / {
proxy_pass http://127.0.0.1:3004;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
}
```
Then symlink and reload:
```bash
sudo ln -sf /etc/nginx/sites-available/sparkyfitness /etc/nginx/sites-enabled/sparkyfitness
sudo nginx -t && sudo systemctl reload nginx
```
## Env Var Changes When Exposing Publicly
In `.env`, change these from the default:
```bash
SPARKY_FITNESS_FRONTEND_URL=https://sparkyfitness.graj-media.com
SPARKY_FITNESS_EXTRA_TRUSTED_ORIGINS=https://sparkyfitness.graj-media.com,http://localhost:3004,http://192.168.50.98:3004
```
After changing `.env`, restart the stack:
```bash
cd /mnt/seagate8tb/Websites/SparkyFitness
docker compose up -d --force-recreate
```
## Android Mobile App
- Download: `app-release.apk` from https://github.com/CodeWithCJ/SparkyFitness/releases/latest (v0.17.3, ~188MB)
- Sideload on Android phone
- Configure the app to point at `https://sparkyfitness.graj-media.com` (or whichever subdomain)
- **Requires HTTPS** — the app won't connect over plain HTTP
- Integrates with Android Health Connect for data sync
- Play Store beta: Join https://groups.google.com/g/sparkyfitness first, then https://play.google.com/store/apps/details?id=com.SparkyApps.SparkyFitnessMobile
## Verification
```bash
# Local access
curl -sk https://localhost:3451/
# Check response includes the SparkyFitness HTML
curl -sk https://localhost:3451/ | grep -o '<title>.*</title>'
# nginx logs
sudo tail -20 /var/log/nginx/access.log | grep 3451
```