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
- Configuration:
The deployment targets a DigitalOcean droplet (e.g.,
165.227.147.212) as root to/app/treequest. - File Transfer:
We use
rsyncto sync our local directory to the server, excluding cached files, virtual environments, large model weights (backend/ml/model), and thefrontend/distdirectory. - Container Orchestration:
The
docker compose up -d --buildcommand is run on the server to apply any code changes and restart the background services. - 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.