# Deployment Documentation

This section contains deployment guides, Docker configuration, and deployment automation scripts.

## 📚 Guides

### Getting Started
- **[DEPLOYMENT_GUIDE.md](./DEPLOYMENT_GUIDE.md)** - Complete deployment guide (7.8K)
- **[DEPLOY_README.md](./DEPLOY_README.md)** - Deployment quick reference
- **[QUICK_DEPLOYMENT_REFERENCE.md](./QUICK_DEPLOYMENT_REFERENCE.md)** - Quick command reference

### Docker Optimization
- **[DOCKER_DEPLOYMENT_IMPROVEMENTS.md](./DOCKER_DEPLOYMENT_IMPROVEMENTS.md)** - Docker optimization notes (15K)
- **[DOCKER_IMPROVEMENTS_SUMMARY.md](./DOCKER_IMPROVEMENTS_SUMMARY.md)** - Summary of improvements

## 🚀 Deployment Scripts

### General Deployment
- **[deploy-and-test.sh](./deploy-and-test.sh)** - Deploy and run tests
- **[deploy-local-build.sh](./deploy-local-build.sh)** - Local deployment build

### Solaria Deployment
- **[deploy-to-solaria.sh](./deploy-to-solaria.sh)** - Deploy to Solaria server
- **[deploy-and-test-solaria.sh](./deploy-and-test-solaria.sh)** - Deploy and test on Solaria
- **[deploy-to-solaria-manual.sh](./deploy-to-solaria-manual.sh)** - Manual Solaria deployment

## 🐳 Docker Deployment

### Quick Start
```bash
cd backend
docker compose up -d
```

### Environment Configuration
Required environment variables:
- `DATABASE_URI` - MongoDB connection string
- `DATABASE_NAME` - Database name
- `JWT_SECRET` - JWT signing secret (min 32 chars)
- `SERVER_HOST` - Server host (default: 0.0.0.0)
- `SERVER_PORT` - Server port (default: 8080)
- `RUST_LOG` - Log level (debug/info/warn)

### Health Check
```bash
curl http://localhost:8000/health
```

## 🌐 Deployment Environments

### Local Development
- Uses `docker-compose.dev.yml`
- Hot reloading enabled
- Debug logging
- Port 8000 → 8080

### Production (Solaria)
- Uses `docker-compose.yml`
- Optimized image
- Release logging
- Health checks configured
- Automatic restarts

## 🔧 Deployment Checklist

### Pre-Deployment
- [ ] Update `JWT_SECRET` in production
- [ ] Verify MongoDB connection string
- [ ] Check environment variables
- [ ] Run test suite
- [ ] Build Docker image

### Post-Deployment
- [ ] Verify health endpoint
- [ ] Check application logs
- [ ] Run API tests
- [ ] Monitor resource usage

## 📊 Deployment Status

**Current Deployment**: Solaria (homelab server)  
**Backend Port**: 8000 (external) → 8080 (internal)  
**MongoDB Port**: 27017  
**Status**: ✅ Operational  

---

*Last Updated: 2026-03-09*
