mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 17:26:23 +02:00
2.6 KiB
2.6 KiB
SurfSense Deployment Guide
Overview
SurfSense uses Docker and Docker Compose as its primary mechanism for deployment, scaling, and infrastructure orchestration. CI/CD is fully managed via GitHub Actions mapping to GitHub Container Registry (GHCR).
Docker Compose Production Stack
Located at docker/docker-compose.yml, the production stack orchestrates:
- db:
pgvector/pgvector:pg17(Postgres 17 with vector search). - redis:
redis:8-alpine(Task queuing and caching). - searxng: Private metasearch instance (
searxng/searxng). - backend: The FastAPI application serving REST endpoints (
ghcr.io/modsetter/surfsense-backend:latest). - celery_worker: Background processing worker.
- celery_beat: Background cron/recurring tasks scheduler.
- zero-cache:
rocicorp/zero:0.26.2(Sync engine connecting Postgres and Next.js). - frontend: Next.js App Router Web Interface (
ghcr.io/modsetter/surfsense-web:latest).
CI/CD Pipeline (GitHub Actions)
The workflow is defined at .github/workflows/docker-build.yml.
Triggers
- Automatic on pushes to
mainanddevbranches for paths insidesurfsense_backend/**andsurfsense_web/**. - Manual via
workflow_dispatch.
Stages
- Tag Release (
tag_release):- Calculates the App Version from the
VERSIONfile. - Automatically increments build numbers and creates Git Tags.
- Calculates the App Version from the
- Build (
build):- Compiles independent Docker images for
backendandweb. - Utilizes a matrix to build multi-architecture images (
linux/amd64andlinux/arm64). - Caches layers using GitHub Actions cache (
type=gha). - Exports the docker image digest into temporary artifacts.
- Compiles independent Docker images for
- Manifest Creation (
create_manifest):- Takes the isolated
amd64andarm64images and merges them into a single manifest list. - Pushes to
ghcr.io/modsetter/surfsense-backendandghcr.io/modsetter/surfsense-web.
- Takes the isolated
Environment Handling
- Frontend Build args: Next.js requires environment constants baked at build time (e.g.
NEXT_PUBLIC_FASTAPI_BACKEND_URL). The GH Action pipes dummy values__NEXT_PUBLIC_FASTAPI_BACKEND_URL__which are presumably swapped viadocker-entrypoint.shat runtime execution. - Backend Configuration: Read exclusively via Docker Compose
env_filemapping to.envdynamically.
Update & Maintenance
- Images pushed to GHCR automatically tag with the repository commit and 'latest'.
- Watchtower (
com.centurylinklabs.watchtower.enable=truelabel on containers) can be used alongside this stack to enable automatic Rolling Updates when GHCR provides a new version.