Skip to content

Deployment

HealthGuard is designed for self-hosting. All data stays on your own infrastructure.

Prerequisites

1. Download the deployment template

bash
git clone https://github.com/Claud-Lu/healthguard.git
cd healthguard/deploy

2. Configure environment variables

Copy and modify the example config:

bash
cp .env.example .env

Key variables:

VariableDescriptionDefault
COLLECTOR_PORTCollector service port3100
DASHBOARD_PORTDashboard service port5175
DATABASE_URLDatabase connection stringsqlite://./data/healthguard.db
JWT_SECRETAuth secretRequired — change to a random string

3. Start services

bash
docker compose up -d

After starting:

ServiceURL
Dashboardhttp://localhost:5175
Collector APIhttp://localhost:3100

4. Update & Restart

bash
docker compose pull
docker compose up -d

Option 2: Run from Source

For development or debugging:

bash
git clone https://github.com/Claud-Lu/healthguard.git
cd healthguard
yarn install
yarn dev:local

See 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/data

Update .env:

bash
DATABASE_URL=postgresql://user:password@postgres:5432/healthguard

Add 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 .db file
  • PostgreSQL: Use pg_dump or configure WAL archiving

FAQ

Q: How do I view logs?

bash
docker compose logs -f collector
docker compose logs -f dashboard

Q: How do I reset data?

bash
docker compose down -v
rm -rf ./data

Q: Port conflict for Collector? Change COLLECTOR_PORT in .env, then docker compose up -d.

Released under the MIT License.