77 lines
1.9 KiB
Markdown
77 lines
1.9 KiB
Markdown
# Phase 6: Backend Service Updates
|
|
|
|
## Agent Assignment
|
|
**Primary Agent:** backend-agent
|
|
**Duration:** 20 minutes
|
|
|
|
## Prerequisites
|
|
- Phase 2 (Remove Tenant) must be complete
|
|
|
|
## Objectives
|
|
1. Update database connection strings to use mvp-postgres
|
|
2. Update Redis connection strings to use mvp-redis
|
|
3. Update platform client URL to use mvp-platform
|
|
4. Remove API key authentication for platform service
|
|
|
|
## Step-by-Step Instructions
|
|
|
|
### Step 1: Update Config Loader
|
|
Modify `backend/src/core/config/config-loader.ts`:
|
|
|
|
```typescript
|
|
// Update database URL
|
|
const DATABASE_URL = process.env.DATABASE_URL ||
|
|
'postgresql://postgres:password@mvp-postgres:5432/motovaultpro';
|
|
|
|
// Update Redis URL
|
|
const REDIS_URL = process.env.REDIS_URL ||
|
|
'redis://mvp-redis:6379';
|
|
```
|
|
|
|
### Step 2: Update Platform Client
|
|
Modify `backend/src/features/vehicles/external/platform-vehicles/platform-vehicles.client.ts`:
|
|
|
|
```typescript
|
|
// Update base URL
|
|
private baseURL = process.env.PLATFORM_VEHICLES_API_URL ||
|
|
'http://mvp-platform:8000';
|
|
|
|
// REMOVE API key authentication (same network, no auth needed)
|
|
// DELETE:
|
|
// headers: { 'X-API-Key': this.apiKey }
|
|
```
|
|
|
|
### Step 3: Verify No Old Container Names
|
|
```bash
|
|
grep -r "admin-postgres" backend/src/
|
|
grep -r "admin-redis" backend/src/
|
|
grep -r "admin-backend" backend/src/
|
|
# Expected: 0 results for all
|
|
```
|
|
|
|
### Step 4: Rebuild and Test
|
|
```bash
|
|
cd backend
|
|
npm run build
|
|
docker compose restart mvp-backend
|
|
|
|
# Test platform connectivity
|
|
docker compose exec mvp-backend curl http://mvp-platform:8000/health
|
|
# Expected: 200 OK
|
|
```
|
|
|
|
## Validation Criteria
|
|
- [ ] All database URLs use mvp-postgres
|
|
- [ ] All Redis URLs use mvp-redis
|
|
- [ ] Platform client uses mvp-platform
|
|
- [ ] No API key for platform service
|
|
- [ ] Backend builds successfully
|
|
- [ ] Backend starts without errors
|
|
|
|
## Update EXECUTION-STATE.json
|
|
```json
|
|
{
|
|
"phases": {"6": {"status": "completed", "validation_passed": true}}
|
|
}
|
|
```
|