Preserve Flutter mirror-os codebase
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
# OTA Update Server
|
||||
|
||||
Static file server for hosting Mirror OS remote APK updates. Runs on the homelab alongside workout-player on port 9091.
|
||||
|
||||
## Endpoints
|
||||
|
||||
| Path | Description |
|
||||
|------|-------------|
|
||||
| `GET /api/mirror-os/version` | Version manifest (JSON) |
|
||||
| `GET /mirror-os-remote.apk` | APK download |
|
||||
| `GET /health` | Health check |
|
||||
|
||||
## Deploy on Homelab
|
||||
|
||||
```bash
|
||||
# Copy files to homelab
|
||||
rsync -avz deploy/ota-server/ homelab:~/ota-server/
|
||||
|
||||
# Start the server
|
||||
ssh homelab 'cd ~/ota-server && docker compose up -d'
|
||||
```
|
||||
|
||||
The server runs nginx on port 9091 serving static files from `public/`.
|
||||
|
||||
## Publish an Update
|
||||
|
||||
From the repo root:
|
||||
|
||||
```bash
|
||||
# Build APK, bump version, copy to public/
|
||||
./deploy/publish-apk.sh "Added new feature X"
|
||||
|
||||
# Then sync to homelab
|
||||
rsync -avz deploy/ota-server/public/ homelab:~/ota-server/public/
|
||||
```
|
||||
|
||||
The script:
|
||||
1. Builds the release APK via `flutter build apk --release`
|
||||
2. Copies the APK to `deploy/ota-server/public/mirror-os-remote.apk`
|
||||
3. Increments the version number in `version.json`
|
||||
4. Sets the changelog from the argument (or defaults to "Bug fixes and improvements")
|
||||
|
||||
## How the App Checks for Updates
|
||||
|
||||
The remote app (`apps/remote`) has an `update_provider.dart` that:
|
||||
1. Fetches `http://192.168.86.172:9091/api/mirror-os/version`
|
||||
2. Compares the returned `version` number against the locally installed version
|
||||
3. If newer, shows a prompt to download and install the APK from `downloadUrl`
|
||||
|
||||
## Version Manifest Format
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 1,
|
||||
"downloadUrl": "http://192.168.86.172:9091/mirror-os-remote.apk",
|
||||
"changelog": "Initial release"
|
||||
}
|
||||
```
|
||||
|
||||
The `version` field is a simple incrementing integer.
|
||||
Reference in New Issue
Block a user