Deployment
HealthGuard is designed for self-hosting. All data stays on your own infrastructure.
Prerequisites
- Docker >= 24
- Docker Compose >= 2.20
Option 1: Docker Compose (Recommended)
1. Download the deployment template
bash
git clone https://github.com/Claud-Lu/healthguard.git
cd healthguard/deploy2. Configure environment variables
Copy and modify the example config:
bash
cp .env.example .envKey variables:
| Variable | Description | Default |
|---|---|---|
COLLECTOR_PORT | Collector service port | 3100 |
DASHBOARD_PORT | Dashboard service port | 5175 |
DATABASE_URL | Database connection string | sqlite://./data/healthguard.db |
JWT_SECRET | Auth secret | Required — change to a random string |
3. Start services
bash
docker compose up -dAfter starting:
| Service | URL |
|---|---|
| Dashboard | http://localhost:5175 |
| Collector API | http://localhost:3100 |
4. Update & Restart
bash
docker compose pull
docker compose up -dOption 2: Run from Source
For development or debugging:
bash
git clone https://github.com/Claud-Lu/healthguard.git
cd healthguard
yarn install
yarn dev:localSee Getting Started for detailed steps.
Database Configuration
SQLite (Default, single-node)
No extra configuration needed. Data is stored at ./data/healthguard.db inside the container.
Mount a volume for persistence:
yaml
volumes:
- ./data:/app/dataPostgreSQL (Production Recommended)
Update .env:
bash
DATABASE_URL=postgresql://user:password@postgres:5432/healthguardAdd PostgreSQL to docker-compose.yml:
yaml
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: healthguard
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:HTTPS Configuration
Using Nginx Reverse Proxy
nginx
server {
listen 443 ssl http2;
server_name healthguard.your-domain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:5175;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /api/ {
proxy_pass http://localhost:3100;
proxy_set_header Host $host;
}
}Using Cloudflare Tunnel (Zero-config HTTPS)
bash
cloudflared tunnel --no-autoupdate run --token <YOUR_TOKEN>Backup Strategy
- SQLite: Regularly back up the
.dbfile - PostgreSQL: Use
pg_dumpor configure WAL archiving
FAQ
Q: How do I view logs?
bash
docker compose logs -f collector
docker compose logs -f dashboardQ: How do I reset data?
bash
docker compose down -v
rm -rf ./dataQ: Port conflict for Collector? Change COLLECTOR_PORT in .env, then docker compose up -d.