feat: Extract hardcoded configs to environment variables
- Add environment variable configuration for backend and frontend - Backend: DB_POOL_SIZE, JWT_EXPIRE_HOURS, timeout configs, directory paths - Frontend: VITE_API_BASE_URL, VITE_UPLOAD_TIMEOUT, Whisper configs - Create deployment script (scripts/deploy-backend.sh) - Create 1Panel deployment guide (docs/1panel-deployment.md) - Update DEPLOYMENT.md with env var documentation - Create README.md with project overview - Remove obsolete PRD.md, SDD.md, TDD.md (replaced by OpenSpec) - Keep CORS allow_origins=["*"] for Electron EXE distribution 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,24 @@
|
||||
- MySQL 8.0+
|
||||
- Access to Dify LLM service
|
||||
|
||||
## Quick Start
|
||||
|
||||
Use the startup script to run all services locally:
|
||||
|
||||
```bash
|
||||
# Check environment
|
||||
./start.sh check
|
||||
|
||||
# Start all services
|
||||
./start.sh start
|
||||
|
||||
# Stop all services
|
||||
./start.sh stop
|
||||
|
||||
# View status
|
||||
./start.sh status
|
||||
```
|
||||
|
||||
## Backend Deployment
|
||||
|
||||
### 1. Setup Environment
|
||||
@@ -28,15 +46,33 @@ pip install -r requirements.txt
|
||||
```bash
|
||||
# Copy example and edit
|
||||
cp .env.example .env
|
||||
|
||||
# Edit .env with actual values:
|
||||
# - DB_HOST, DB_PORT, DB_USER, DB_PASS, DB_NAME
|
||||
# - AUTH_API_URL
|
||||
# - DIFY_API_URL, DIFY_API_KEY
|
||||
# - ADMIN_EMAIL
|
||||
# - JWT_SECRET (generate a secure random string)
|
||||
```
|
||||
|
||||
**Required Environment Variables:**
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `BACKEND_HOST` | Server bind address (default: 0.0.0.0) |
|
||||
| `BACKEND_PORT` | Server port (default: 8000) |
|
||||
| `DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASS`, `DB_NAME` | MySQL connection |
|
||||
| `AUTH_API_URL` | Company authentication API |
|
||||
| `DIFY_API_URL`, `DIFY_API_KEY`, `DIFY_STT_API_KEY` | Dify API settings |
|
||||
| `ADMIN_EMAIL` | Admin user email |
|
||||
| `JWT_SECRET` | JWT signing secret (generate secure random string) |
|
||||
|
||||
**Optional Environment Variables:**
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `DB_POOL_SIZE` | Database connection pool size | 5 |
|
||||
| `JWT_EXPIRE_HOURS` | JWT token expiration | 24 |
|
||||
| `UPLOAD_TIMEOUT` | File upload timeout (ms) | 600000 |
|
||||
| `DIFY_STT_TIMEOUT` | STT processing timeout (ms) | 300000 |
|
||||
| `LLM_TIMEOUT` | LLM request timeout (ms) | 120000 |
|
||||
| `MAX_FILE_SIZE` | Max upload size (bytes) | 524288000 |
|
||||
|
||||
See `backend/.env.example` for complete documentation.
|
||||
|
||||
### 3. Run Server
|
||||
|
||||
```bash
|
||||
@@ -54,6 +90,18 @@ curl http://localhost:8000/api/health
|
||||
# Should return: {"status":"healthy","service":"meeting-assistant"}
|
||||
```
|
||||
|
||||
### 5. Production Deployment (1Panel)
|
||||
|
||||
For detailed server deployment instructions including Nginx, systemd, and SSL configuration, see:
|
||||
|
||||
📖 **[docs/1panel-deployment.md](docs/1panel-deployment.md)**
|
||||
|
||||
Or use the deployment script:
|
||||
|
||||
```bash
|
||||
sudo ./scripts/deploy-backend.sh install --port 8000
|
||||
```
|
||||
|
||||
## Electron Client Deployment
|
||||
|
||||
### 1. Setup
|
||||
@@ -65,16 +113,34 @@ cd client
|
||||
npm install
|
||||
```
|
||||
|
||||
### 2. Development
|
||||
### 2. Configure Environment
|
||||
|
||||
```bash
|
||||
# Copy example and edit
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
**Environment Variables:**
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `VITE_API_BASE_URL` | Backend API URL | http://localhost:8000/api |
|
||||
| `VITE_UPLOAD_TIMEOUT` | Upload timeout (ms) | 600000 |
|
||||
| `WHISPER_MODEL` | Whisper model size | medium |
|
||||
| `WHISPER_DEVICE` | Execution device | cpu |
|
||||
| `WHISPER_COMPUTE` | Compute precision | int8 |
|
||||
|
||||
### 3. Development
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
### 3. Build for Distribution
|
||||
### 4. Build for Distribution
|
||||
|
||||
```bash
|
||||
# Build portable executable
|
||||
# Update VITE_API_BASE_URL to production server first
|
||||
# Then build portable executable
|
||||
npm run build
|
||||
```
|
||||
|
||||
@@ -102,7 +168,7 @@ The model will be downloaded automatically on first run. For faster startup, pre
|
||||
|
||||
```python
|
||||
from faster_whisper import WhisperModel
|
||||
model = WhisperModel("small", device="cpu", compute_type="int8")
|
||||
model = WhisperModel("medium", device="cpu", compute_type="int8")
|
||||
```
|
||||
|
||||
### 3. Build Executable
|
||||
@@ -122,7 +188,7 @@ Copy `sidecar/dist/` to `client/sidecar/` before building Electron app.
|
||||
The backend will automatically create tables on first startup. To manually verify:
|
||||
|
||||
```sql
|
||||
USE db_A060;
|
||||
USE your_database;
|
||||
SHOW TABLES LIKE 'meeting_%';
|
||||
```
|
||||
|
||||
@@ -154,24 +220,25 @@ On target hardware (i5/8GB):
|
||||
### Database Connection Issues
|
||||
|
||||
1. Verify MySQL is accessible from server
|
||||
2. Check firewall rules for port 33306
|
||||
2. Check firewall rules for database port
|
||||
3. Verify credentials in .env
|
||||
|
||||
### Dify API Issues
|
||||
|
||||
1. Verify API key is valid
|
||||
2. Check Dify service status
|
||||
3. Review timeout settings for long transcripts
|
||||
3. Review timeout settings for long transcripts (adjust `DIFY_STT_TIMEOUT`, `LLM_TIMEOUT`)
|
||||
|
||||
### Transcription Issues
|
||||
|
||||
1. Verify microphone permissions
|
||||
2. Check sidecar executable runs standalone
|
||||
3. Review audio format (16kHz, 16-bit, mono)
|
||||
4. Try different `WHISPER_MODEL` sizes (tiny, base, small, medium)
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Never commit `.env` files
|
||||
- Never commit `.env` files to version control
|
||||
- Keep JWT_SECRET secure and unique per deployment
|
||||
- Ensure HTTPS in production
|
||||
- Ensure HTTPS in production (see [1panel-deployment.md](docs/1panel-deployment.md))
|
||||
- Regular security updates for dependencies
|
||||
|
||||
Reference in New Issue
Block a user