Skip to content

Deployment

TreeQuest uses a straightforward deployment process to a DigitalOcean Droplet using Docker Compose. The deployment is automated via the deploy.sh script.

Deployment Flow

sequenceDiagram
    participant Dev as Developer / Local
    participant Server as Target Server (Droplet)
    participant Docker as Docker Engine

    Dev->>Server: Creates target directory (/app/treequest)
    Dev->>Server: Rsyncs files (excludes .git, node_modules, etc.)
    Dev->>Server: SSH into server to execute commands
    Server->>Docker: docker compose up -d --build
    Docker-->>Server: Rebuilds and restarts containers
    Server->>Docker: Cleans up old dangling images
    Server->>Docker: Runs species import script
    Server-->>Dev: Deployment successful!

Steps

  1. Configuration: The deployment targets a DigitalOcean droplet (e.g., 165.227.147.212) as root to /app/treequest.
  2. File Transfer: We use rsync to sync our local directory to the server, excluding cached files, virtual environments, large model weights (backend/ml/model), and the frontend/dist directory.
  3. Container Orchestration: The docker compose up -d --build command is run on the server to apply any code changes and restart the background services.
  4. Post-Deployment: Old docker images are pruned and an idempotent species import script (scripts/import_wikipedia_species.py) is run in the backend container to ensure database species consistency.