6de2455917
- Added GLOBAL_MARKETS_TITLE to all translation files - Updated footer with 12 markets (4 active + 8 upcoming) - Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi - Built and deployed to production - CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
273 lines
5.0 KiB
Markdown
273 lines
5.0 KiB
Markdown
# VIMS Deployment Guide
|
|
|
|
## System Requirements
|
|
|
|
### Minimum
|
|
- CPU: 4 cores
|
|
- RAM: 8 GB
|
|
- Storage: 100 GB SSD
|
|
- Network: 100 Mbps
|
|
|
|
### Recommended
|
|
- CPU: 8+ cores
|
|
- RAM: 16 GB
|
|
- Storage: 500 GB SSD
|
|
- Network: 1 Gbps
|
|
- GPU: NVIDIA T4 or better (for AI inference)
|
|
|
|
## Deployment Options
|
|
|
|
### 1. Docker Compose (Recommended for single server)
|
|
|
|
```bash
|
|
# Clone repository
|
|
git clone https://github.com/landvex/vims-backend.git
|
|
cd vims-backend
|
|
|
|
# Create environment file
|
|
cp .env.example .env
|
|
nano .env
|
|
|
|
# Start services
|
|
docker-compose up -d
|
|
|
|
# Check status
|
|
docker-compose ps
|
|
docker-compose logs -f vims-api
|
|
```
|
|
|
|
### 2. Kubernetes (Production)
|
|
|
|
```bash
|
|
# Apply configurations
|
|
kubectl apply -f k8s/namespace.yaml
|
|
kubectl apply -f k8s/configmap.yaml
|
|
kubectl apply -f k8s/secret.yaml
|
|
kubectl apply -f k8s/postgres.yaml
|
|
kubectl apply -f k8s/redis.yaml
|
|
kubectl apply -f k8s/vims-api.yaml
|
|
kubectl apply -f k8s/vims-worker.yaml
|
|
kubectl apply -f k8s/ingress.yaml
|
|
|
|
# Check status
|
|
kubectl get pods -n vims
|
|
kubectl logs -f deployment/vims-api -n vims
|
|
```
|
|
|
|
### 3. AWS Deployment
|
|
|
|
#### Using ECS
|
|
```bash
|
|
# Create cluster
|
|
aws ecs create-cluster --cluster-name vims
|
|
|
|
# Register task definitions
|
|
aws ecs register-task-definition --cli-input-json file://ecs/api-task.json
|
|
aws ecs register-task-definition --cli-input-json file://ecs/worker-task.json
|
|
|
|
# Create service
|
|
aws ecs create-service \
|
|
--cluster vims \
|
|
--service-name vims-api \
|
|
--task-definition vims-api \
|
|
--desired-count 2
|
|
```
|
|
|
|
#### Using EKS
|
|
```bash
|
|
# Create EKS cluster
|
|
eksctl create cluster --name vims --region eu-north-1
|
|
|
|
# Deploy
|
|
kubectl apply -f k8s/
|
|
```
|
|
|
|
## Configuration
|
|
|
|
### Environment Variables
|
|
|
|
| Variable | Required | Default | Description |
|
|
|----------|----------|---------|-------------|
|
|
| `NODE_ENV` | Yes | development | Environment mode |
|
|
| `PORT` | No | 3450 | API port |
|
|
| `DB_HOST` | Yes | - | PostgreSQL host |
|
|
| `DB_PASSWORD` | Yes | - | Database password |
|
|
| `REDIS_HOST` | Yes | - | Redis host |
|
|
| `JWT_SECRET` | Yes | - | Secret for JWT tokens |
|
|
| `S3_BUCKET` | Yes | - | S3 bucket for images |
|
|
| `AWS_ACCESS_KEY_ID` | Yes | - | AWS access key |
|
|
| `AWS_SECRET_ACCESS_KEY` | Yes | - | AWS secret key |
|
|
|
|
### SSL/TLS
|
|
|
|
#### Using Let's Encrypt
|
|
```bash
|
|
# Install certbot
|
|
docker run -it --rm \
|
|
-v vims_certs:/etc/letsencrypt \
|
|
certbot/certbot certonly \
|
|
--standalone \
|
|
-d vims.landvex.com
|
|
```
|
|
|
|
#### Using AWS ACM
|
|
```bash
|
|
# Request certificate
|
|
aws acm request-certificate \
|
|
--domain-name vims.landvex.com \
|
|
--validation-method DNS
|
|
```
|
|
|
|
## Monitoring
|
|
|
|
### Prometheus Metrics
|
|
|
|
Endpoint: `/metrics`
|
|
|
|
Key metrics:
|
|
- `vims_observations_total` - Total observations processed
|
|
- `vims_alerts_total` - Total alerts generated
|
|
- `vims_detection_duration_seconds` - AI detection duration
|
|
- `vims_queue_size` - Current queue size
|
|
|
|
### Health Checks
|
|
|
|
- Liveness: `GET /health/live`
|
|
- Readiness: `GET /health/ready`
|
|
|
|
### Logging
|
|
|
|
Structured JSON logs to stdout. Configure aggregation with:
|
|
- ELK Stack
|
|
- Datadog
|
|
- CloudWatch
|
|
|
|
## Backup
|
|
|
|
### Database
|
|
```bash
|
|
# Automated backup script
|
|
#!/bin/bash
|
|
BACKUP_DIR="/backups/vims"
|
|
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
|
|
docker exec vims_postgres_1 pg_dump -U vims vims > \
|
|
$BACKUP_DIR/vims_$TIMESTAMP.sql
|
|
|
|
# Upload to S3
|
|
aws s3 cp $BACKUP_DIR/vims_$TIMESTAMP.sql \
|
|
s3://vims-backups/database/
|
|
|
|
# Keep last 30 days
|
|
find $BACKUP_DIR -name "vims_*.sql" -mtime +30 -delete
|
|
```
|
|
|
|
### Images
|
|
```bash
|
|
# Sync to S3
|
|
aws s3 sync /data/reference-images s3://vims-images/reference/
|
|
aws s3 sync /data/observations s3://vims-images/observations/
|
|
```
|
|
|
|
## Scaling
|
|
|
|
### Horizontal Scaling
|
|
|
|
```yaml
|
|
# docker-compose.yml
|
|
services:
|
|
vims-worker:
|
|
deploy:
|
|
replicas: 5
|
|
```
|
|
|
|
### Vertical Scaling
|
|
|
|
```yaml
|
|
# docker-compose.yml
|
|
services:
|
|
vims-api:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '4'
|
|
memory: 8G
|
|
```
|
|
|
|
## Security
|
|
|
|
### Network Security
|
|
- Use private subnets for database
|
|
- Security groups for API access
|
|
- WAF for DDoS protection
|
|
|
|
### Data Security
|
|
- Encrypt data at rest (S3, RDS)
|
|
- Encrypt data in transit (TLS 1.3)
|
|
- Regular security audits
|
|
|
|
### Access Control
|
|
- Role-based access control (RBAC)
|
|
- API key rotation every 90 days
|
|
- Audit logging
|
|
|
|
## Troubleshooting
|
|
|
|
### Common Issues
|
|
|
|
#### Database Connection Failed
|
|
```bash
|
|
# Check PostgreSQL
|
|
docker-compose logs postgres
|
|
|
|
# Verify credentials
|
|
docker exec -it vims_postgres_1 psql -U vims -c "\l"
|
|
```
|
|
|
|
#### Queue Not Processing
|
|
```bash
|
|
# Check Redis
|
|
docker-compose exec redis redis-cli ping
|
|
|
|
# Check workers
|
|
docker-compose logs -f vims-worker
|
|
```
|
|
|
|
#### AI Model Not Loading
|
|
```bash
|
|
# Verify model files
|
|
ls -la data/models/
|
|
|
|
# Check logs
|
|
docker-compose logs vims-worker | grep -i "model"
|
|
```
|
|
|
|
## Maintenance
|
|
|
|
### Updates
|
|
```bash
|
|
# Pull latest
|
|
git pull origin main
|
|
|
|
# Rebuild
|
|
docker-compose build
|
|
|
|
# Rolling update
|
|
docker-compose up -d
|
|
```
|
|
|
|
### Cleanup
|
|
```bash
|
|
# Remove old images
|
|
docker image prune -a
|
|
|
|
# Clean logs
|
|
docker-compose exec vims-api find /app/logs -name "*.log" -mtime +7 -delete
|
|
```
|
|
|
|
## Support
|
|
|
|
- Documentation: https://docs.landvex.com/vims
|
|
- Issues: https://github.com/landvex/vims/issues
|
|
- Email: support@landvex.com
|