41 lines
1.2 KiB
Markdown
41 lines
1.2 KiB
Markdown
# Swarm Demo
|
|
|
|
A minimal demo app built with **Bun**, **Hono**, **React**, and **Tailwind CSS**.
|
|
|
|
Displays the container hostname and a live updating date/time — useful for verifying load balancing across a swarm of containers.
|
|
|
|
## Stack
|
|
|
|
- [Bun](https://bun.sh/) — runtime, package manager, bundler, and dev server
|
|
- [Hono](https://hono.dev/) — lightweight web server
|
|
- [React](https://react.dev/) — UI
|
|
- [Tailwind CSS](https://tailwindcss.com/) — styling
|
|
|
|
## Scripts
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `bun install` | Install dependencies |
|
|
| `bun run dev` | Start Bun dev server with HMR + Tailwind watch |
|
|
| `bun run build` | Build CSS + bundle for production |
|
|
| `bun run preview` | Build and start production server |
|
|
| `bun run serve` | Start production server (requires `dist/`) |
|
|
|
|
## Docker
|
|
|
|
```bash
|
|
# Build and run locally
|
|
docker build -t swarm-demo .
|
|
docker run -p 5786:5786 swarm-demo
|
|
|
|
# Or use Docker Compose with 3 replicas
|
|
docker compose up --build
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
| Variable | Default | Description |
|
|
|----------|---------|-------------|
|
|
| `PORT` | `5786` | Server port |
|
|
| `HOSTNAME` | `localhost` | Container name (set automatically by Docker) |
|