Skip to main content

Overview

Docker Compose provides the easiest way to deploy OpenSight with all required services. This guide covers both production deployment and development setup.

Prerequisites

1

Install Docker

Install Docker Engine 24.0 or later:
2

Install Docker Compose

Docker Compose is included with Docker Desktop. For Linux servers:
Expected output: Docker Compose version v2.20.0 or later
3

Clone the repository

Production Deployment

Full Stack Configuration

The production docker-compose.yml deploys all services:
docker/docker-compose.yml

Deploy Production Stack

1

Configure environment variables

Create your .env file from the example:
Edit the .env file with your production settings. At minimum, update:
.env
See Environment Variables for complete reference.
2

Build and start services

Expected output:
3

Run database migrations

After the API container starts, run migrations:
4

Verify deployment

Check that all services are running:
All services should show Up status with healthy checks passing:
5

Access the application

Open your browser and navigate to:

Development Setup

Development Configuration

For local development, use docker-compose.dev.yml which runs only PostgreSQL and Redis:
docker/docker-compose.dev.yml

Start Development Environment

1

Start database services

2

Install dependencies

3

Set up database

This runs migrations and seeds the database.
4

Start development servers

This starts:

Docker Commands Reference

Production Commands

Development Commands

Service Configuration

Port Mappings

In production, you may want to avoid exposing PostgreSQL and Redis ports to the host. Remove the ports mapping for these services to keep them internal to the Docker network.

Volume Mounts

Health Checks

Each service includes health checks for monitoring:

Troubleshooting

Services Won’t Start

Ensure your .env file is properly configured:
Ensure ports 3000, 4000, 5432, and 6379 are not in use:
Stop all services and remove containers:

Database Connection Issues

When running services in Docker, use the service name (e.g., postgres) instead of localhost in DATABASE_URL:

View Container Resource Usage

Production Best Practices

Use External Database

For production, consider using a managed PostgreSQL service (AWS RDS, Google Cloud SQL, etc.) instead of the containerized database.

Secure Secrets

Use Docker secrets or environment variable management services instead of plain .env files.

Enable HTTPS

Use a reverse proxy like Nginx or Traefik to handle SSL/TLS termination.

Monitor Resources

Set up monitoring with Prometheus, Grafana, or similar tools to track container health.

Remove Exposed Ports

For production security, modify docker-compose.yml to remove port mappings for internal services:

Set Resource Limits

Add resource constraints to prevent services from consuming excessive resources:

Backup and Restore

Backup Database

Restore Database

Backup Volumes

Next Steps

Environment Variables

Configure all environment variables for your deployment

Self-Hosting Guide

Learn about architecture and deployment options