---
description:
globs:
alwaysApply: false
---
# Deployment and Configuration

## Environment Variables (Minimal)

Only three infrastructure-level settings are read from environment variables. Everything else is managed through the Admin Dashboard Web UI:

- `PORT`: Server port (default: `5174`)
- `DATABASE_PATH`: SQLite database file path (optional, default: `./data/assistant.db`)
- `MASTER_KEY_PATH`: Encryption master key file path (optional, default: `./data/master.key`)

## First-Boot Seeding

On first startup with an empty `system_settings` table, `configManager.seedDefaults()` automatically:
- Generates `JWT_SECRET` and `WEBHOOK_SECRET` (64-char hex via `crypto.randomBytes(32)`)
- Seeds all config fields with their default values
- Sets `ADMIN_PASSWORD` to `password` (must be changed via Web UI)

## Web UI Configuration

All runtime settings are managed through the Admin Dashboard at `http://your-server:PORT`:
- Gitea connection (API URL, access token, admin token)
- Security settings (webhook secret, admin password, JWT secret)
- Review engine settings (engine mode, parallelism, file limits, confidence)
- Feishu integration (webhook URL and secret)
- Memory/learning features (Qdrant URL, enable flags)
## Deployment Options

### Local Development

```bash
# Development mode with hot reload
bun run dev

# Production mode
bun run build
bun run start
```

### Docker Deployment

The [Dockerfile](mdc:Dockerfile) provides containerization support:

```bash
# Build the Docker image
docker build -t gitea-assistant:latest .

# Run the container
docker run -p 3000:3000 -v ./data:/app/data -e PORT=3000 gitea-assistant:latest
```

### Kubernetes Deployment

The [kubernetes.yaml](mdc:k8s/gitea-assistant.yaml) file provides Kubernetes deployment configuration. Persistent storage is required for the `/app/data` directory.

Deployment can be managed using:
```bash
# Apply configuration
kubectl apply -k k8s/
```

### Webhook Setup

Configure Gitea webhooks to point to the `/webhook/gitea` endpoint with:
- Content type: application/json
- Secret: matching the Webhook Secret configured in the Admin Dashboard
- Events: Pull Request and Status events
