Skip to main content

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

  1. Clone the repository:
  1. Create environment files:
  1. Start the development environment:
Services will be available at:

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

  1. Set up environment files:
  1. Configure Firebase (Optional):
  1. 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 files
  • redis_data: Cache data
  • backend_data: Uploaded files
  • frontend_node_modules: NPM packages

Networks

Services communicate through Docker networks:
  • Development: app-network
  • Production: chattermate-network

Monitoring

Monitor your deployment using Docker commands:

Help Center custom domains (self-hosted)

The Help Center can be served on your customers’ own domains with automatic HTTPS. The chattermate-deploy CLI bundles a Caddy edge proxy that terminates TLS and issues certificates automatically — no manual certbot or nginx.
1

Deploy with a domain

Run chattermate-deploy init and answer yes to the domain prompt. Enter your app domain (e.g. app.example.com) and, optionally, a Help Center base domain (e.g. help.example.com) for org subdomains. Then chattermate-deploy start.
2

Point DNS at your server

Add an A/AAAA record for your app domain to the server’s IP. For Help Center org subdomains, add a wildcard *.help.example.com A/AAAA record too. Certificates are issued automatically on the first HTTPS request.
3

Add a customer's custom domain

In Customization → Custom domain, add the domain and create the TXT record shown. Add a CNAME from the customer’s domain to your app domain (which already resolves to your server), then click Verify.
Under the hood the edge only requests a certificate for a hostname the backend confirms it serves (a verified custom domain or an org subdomain), so a random domain pointed at your server cannot trigger certificate issuance.

TLS options

When you give init a domain, it asks how HTTPS should be handled:
  • Automatic (default) — Caddy obtains and renews free Let’s Encrypt certificates, and issues Help Center custom-domain certs on demand.
  • Bring your own certificate — provide a cert + key (PEM); they’re copied into ./certs and served by Caddy, with no calls to Let’s Encrypt. For Help Center domains, add a block per domain (or a wildcard) — the generated Caddyfile includes a commented example.
  • Terminated upstream — your own reverse proxy / load balancer handles TLS and forwards plain HTTP to the stack. It must preserve the Host header so the backend can dispatch Help Center domains.
Renewal is automatic — Caddy renews certificates well before expiry with no cron or certbot. Certificates and the ACME account are stored in the caddy_data Docker volume, so keep it across restarts and upgrades — deleting it forces re-issuance and can hit Let’s Encrypt rate limits. If a custom domain sits behind Cloudflare, set the record to DNS only (grey cloud) for verification, or the CNAME check fails.

Troubleshooting

Common issues and solutions:
  1. Frontend not starting:
  1. Backend migrations failing:
  1. Database connection issues:
  1. Redis connection issues:
  1. Backend build fails with No space left on device or pip ReadTimeoutError:
The backend image pulls several GB of ML wheels (torch, opencv, onnxruntime), and the amd64/x86_64 wheels are noticeably larger than the arm64 ones. On a small root volume the build overflows with No space left on device.
  • Give the host at least ~15 GB free disk when building from source.
  • This only affects building the image yourself — the prebuilt Docker Hub images (chattermate/backend, chattermate/frontend) avoid it entirely.
  • Slow-link download timeouts are already handled in the Dockerfiles (PIP_DEFAULT_TIMEOUT=120 and pip --retries 10).
  1. Help Center custom domain stuck on “SSL Provisioning” / returns 404:
The domain never reached the edge, so no certificate was issued.
  • Deploy with the chattermate-deploy CLI and a domain (see Help Center custom domains) — a plain localhost deploy has no TLS edge and can’t serve custom domains.
  • Check the domain resolves to your server (CNAME to your app domain) and that ports 80 and 443 are open — Let’s Encrypt validates over both.
  • The certificate is issued on the first HTTPS request; give it a few seconds, then re-check Verify. Inspect the edge with docker compose logs caddy.