47 lines
1.9 KiB
Markdown
47 lines
1.9 KiB
Markdown
# Habland Admin Panel
|
||
|
||
Next.js 16 control surface for managing the multi-emulator stack (Arcturus, Havana, Kepler, Roseau) from one UI. Ships with container controls, live stats, config editing, and log viewing.
|
||
|
||
## Prerequisites
|
||
- Node.js 20+
|
||
- Docker running locally (the app talks to the Docker socket when containerized)
|
||
- `.env` with admin credentials (see below)
|
||
|
||
## Quickstart (local dev)
|
||
```bash
|
||
cd admin-panel
|
||
npm install
|
||
cp ../.env.example .env # reuse root values; add admin credentials
|
||
npm run dev # http://localhost:3000
|
||
```
|
||
|
||
## Production (Docker Compose)
|
||
The root `docker-compose.yml` builds this app as `admin-panel` on port `3000` and mounts `/var/run/docker.sock` so it can manage other containers. Update `.env` before `docker compose up -d`.
|
||
|
||
## Key Features
|
||
- Container manager: start/stop/restart per service or per emulator group
|
||
- Live stats cards: online counts per emulator (polls `/api/stats`)
|
||
- Config editor: edit mounted emulator configs directly from the UI
|
||
- Log viewer: tail per-container logs with filtering
|
||
- Global search and quick actions (keyboard shortcuts supported)
|
||
|
||
## Scripts
|
||
- `npm run dev` – start Next dev server
|
||
- `npm run build` – production build
|
||
- `npm start` – serve built app
|
||
- `npm run lint` – lint the codebase
|
||
|
||
## Environment Variables
|
||
Define in `.env` (or the root `.env` that gets baked into Docker):
|
||
- `ADMIN_USER` / `ADMIN_PASSWORD` – required. Basic credential pair used by the credentials auth provider in `src/auth.ts`.
|
||
|
||
## Useful Paths
|
||
- UI entry: `src/app/page.tsx`
|
||
- Dashboard: `src/components/Dashboard.tsx`
|
||
- API routes: `src/app/api/*`
|
||
- Auth config: `src/auth.ts`, `src/auth.config.ts`
|
||
|
||
## Notes
|
||
- The dashboard polls `/api/containers` and `/api/stats` every few seconds; ensure the emulator containers and the unified DB are up for meaningful data.
|
||
- When running via Docker, the app needs access to the Docker socket for container control.
|