Files
archived-gitea-ai-assistant/.cursor/rules/05-deployment-and-configuration.mdc
jeffusion 7ef35fa8ee chore(deploy): remove obsolete env vars from deployment configs
- docker-compose.e2e.yml: remove WEBHOOK_SECRET, REVIEW_* env vars
  (now configured via assistant API in seed.sh)
- e2e/seed.sh: add step to configure assistant via Admin API after boot
  (login with default password, set webhook secret + review settings)
- k8s/gitea-assistant.yaml: Secret now only contains GITEA_ACCESS_TOKEN;
  ConfigMap reduced to GITEA_API_URL, PORT, QDRANT_URL
- cursor rules updated to document DB-first config architecture
2026-03-24 12:30:13 +08:00

72 lines
2.1 KiB
Plaintext

---
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