Initial commit: Scala/Thorium task manager demo app

This commit is contained in:
davidtio
2026-02-28 12:56:14 +08:00
commit 93e8401ed3
12 changed files with 430 additions and 0 deletions

110
README.md Normal file
View File

@@ -0,0 +1,110 @@
# demoapp — Clouderized Demo App
A task manager built with Scala 3 + Thorium, used to demo the full Clouderized deployment cycle: edit config, push, rebuild, see changes live.
## Prerequisites
- Access to `git.clouderized.com` (Gitea)
- The app deployed at `demoapp.clouderized.com`
## Running the Demo
### 1. Show the live app
Open `https://demoapp.clouderized.com` in a browser. Point out:
- The **teal header** with app name and version (v1.0.0)
- CRUD functionality — add, complete, and delete tasks
- The `/health` endpoint returning `{"status":"ok"}`
### 2. Make a visible change
Edit `src/main/resources/site.conf`:
```diff
app {
- name = "DemoCust Tasks"
- version = "1.0.0"
+ name = "Clouderized Tasks"
+ version = "1.1.0"
theme {
- background = "#0F766E"
+ background = "#1E40AF"
font = "DM Sans"
- fontSize = "16px"
+ fontSize = "18px"
}
}
```
This changes the header from **teal to blue**, bumps the version, and increases font size.
### 3. Push the change
```bash
git add src/main/resources/site.conf
git commit -m "Update theme to blue, bump to v1.1.0"
git push
```
### 4. Watch the rebuild
Go to Gitea Actions at `git.clouderized.com/cldrzd/demoapp/actions` and watch the pipeline:
1. `sbt assembly` builds the fat JAR
2. Docker builds the container image
3. The old container is replaced with the new one
### 5. See the result
Refresh the browser. The page now shows:
- **Blue header** instead of teal
- Version **v1.1.0** in the top-right
- Larger font size
### 6. Reset for the next demo
```bash
git revert HEAD --no-edit
git push
```
The app rebuilds and returns to its original teal theme at v1.0.0.
## Config Reference
All visual changes are driven by `src/main/resources/site.conf`:
| Key | Default | What it controls |
|-----|---------|-----------------|
| `app.name` | `"DemoCust Tasks"` | Header title |
| `app.version` | `"1.0.0"` | Version badge in header |
| `app.theme.background` | `"#0F766E"` (teal) | Header and button color |
| `app.theme.font` | `"DM Sans"` | Body font family |
| `app.theme.fontSize` | `"16px"` | Base font size |
## Suggested color swaps for demos
| Color | Hex | Effect |
|-------|-----|--------|
| Teal (default) | `#0F766E` | Clouderized brand color |
| Blue | `#1E40AF` | Obvious visual change |
| Purple | `#7C3AED` | Another clear contrast |
| Red | `#DC2626` | High-contrast demo |
## Endpoints
| Method | Path | Description |
|--------|------|-------------|
| GET | `/` | Task list (HTML) |
| GET | `/health` | Health check (JSON) |
| POST | `/tasks` | Create task (form) |
| POST | `/tasks/:id/toggle` | Toggle completion |
| POST | `/tasks/:id/delete` | Delete task |
## Notes
- Task storage is **in-memory** — it resets on every redeploy, which keeps the demo clean.
- The app runs on the **Pro tier** (2GB RAM, 2 vCPU) since JVM needs the headroom.
- Three sample tasks are pre-seeded on startup.