Deployment
Docker
Docker Deployment
ChatterMate can be deployed using Docker in both development and production environments.
Development Setup
For local development, we use docker-compose.yml
which sets up:
- Frontend (Vue.js) with hot-reloading
- Backend (FastAPI) with auto-reload
- PostgreSQL with pgvector extension
- Redis for caching and rate limiting
Prerequisites
- Docker
- Docker Compose
- Git
Quick Start
- Clone the repository:
- Create environment files:
- Start the development environment:
Services will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- Backend Docs: http://localhost:8000/docs
- PostgreSQL: localhost:5432
- Redis: localhost:6379
Development Features
- Hot-reloading for frontend changes
- Auto-reload for backend changes
- Volume mounts for live code updates
- Development-mode Firebase credentials
- Automatic database migrations
- Health checks for all services
Production Deployment
For production deployment, we use docker-compose.prod.yml
which provides:
- Optimized multi-stage builds
- Nginx for frontend serving
- Gunicorn for backend serving
- Production-grade configurations
- Health monitoring
- Automatic restarts
Production Setup
- Set up environment files:
- Configure Firebase (Optional):
- Start production services:
Production Features
- Multi-stage builds for smaller images
- Nginx configuration for frontend
- Gunicorn with multiple workers
- Redis persistence
- Database backups
- Automatic health checks
- Container restart policies
Docker Images
Frontend Images
-
Development:
Dockerfile.frontend
- Node.js development server
- Hot-reloading enabled
- Volume mounts for live updates
-
Production:
Dockerfile.frontend.prod
- Multi-stage build
- Nginx for static file serving
- Optimized build size
- Health monitoring
Backend Images
-
Development:
Dockerfile
- Python development server
- Auto-reload enabled
- Debug mode
-
Production:
Dockerfile.backend.prod
- Multi-stage build
- Gunicorn server
- Optimized dependencies
- Worker configuration
Database Image
- Custom PostgreSQL image with pgvector
- Vector similarity search support
- Automatic initialization
- Health checks
Environment Variables
Frontend Variables
Backend Variables
Production Additional Variables
Health Checks
All services include health checks:
- Frontend: Checks HTTP endpoint
- Backend: Monitors API health
- PostgreSQL: Verifies database connection
- Redis: Ensures cache availability
Volumes
Persistent data is managed through Docker volumes:
postgres_data
: Database filesredis_data
: Cache databackend_data
: Uploaded filesfrontend_node_modules
: NPM packages
Networks
Services communicate through Docker networks:
- Development:
app-network
- Production:
chattermate-network
Monitoring
Monitor your deployment using Docker commands:
Troubleshooting
Common issues and solutions:
- Frontend not starting:
- Backend migrations failing:
- Database connection issues:
- Redis connection issues: