SurfSense/DOCKER_SETUP.md
2025-04-08 14:05:52 -07:00

1.9 KiB

Docker Setup for SurfSense

This document explains how to run the SurfSense project using Docker Compose.

Prerequisites

  • Docker and Docker Compose installed on your machine
  • Git (to clone the repository)

Setup

  1. Make sure you have all the necessary environment variables set up:

    • Copy surfsense_backend/.env.example to surfsense_backend/.env and fill in the required values
    • Copy surfsense_web/.env.example to surfsense_web/.env and fill in the required values
  2. Build and start the containers:

    docker-compose up --build
    
  3. To run in detached mode (in the background):

    docker-compose up -d
    
  4. Access the applications:

Useful Commands

  • Stop the containers:

    docker-compose down
    
  • View logs:

    # All services
    docker-compose logs -f
    
    # Specific service
    docker-compose logs -f backend
    docker-compose logs -f frontend
    docker-compose logs -f db
    
  • Restart a specific service:

    docker-compose restart backend
    
  • Execute commands in a running container:

    # Backend
    docker-compose exec backend python -m pytest
    
    # Frontend
    docker-compose exec frontend pnpm lint
    

Database

The PostgreSQL database with pgvector extensions is available at:

  • Host: localhost
  • Port: 5432
  • Username: postgres
  • Password: postgres
  • Database: surfsense

You can connect to it using any PostgreSQL client.

Troubleshooting

  • If you encounter permission errors, you may need to run the docker commands with sudo.
  • If ports are already in use, modify the port mappings in the docker-compose.yml file.
  • For backend dependency issues, you may need to modify the Dockerfile in the backend directory.
  • For frontend dependency issues, you may need to modify the Dockerfile in the frontend directory.