Files
Synapsis/docker-compose.yml
T
cyph3rasi ae2c34df6c Add installer, CI, ARM build and test updates
Introduce a one‑line Docker installer and environment examples, add CI and docker validation workflows, and update docs and tests.

Key changes:
- Add docker/install.sh installer that bootstraps /opt/synapsis, downloads compose files, optionally installs Docker, and generates secrets.
- Add top-level .env.example and docker/.env.example entries for shared storage and local development.
- Add GitHub Actions CI (ci.yml) with type checks, targeted vitest runs, build and docker-compose validation.
- Update existing docker workflow to set up QEMU and build multi‑arch images (amd64, arm64).
- Update README and docker/README to use the installer, point to the new repo, adjust local setup instructions, and note shared S3 env vars.
- Update docker-compose comments and include shared S3 env variables and defaults.
- Update .gitignore to ignore site-work mirrors.
- Tests: expand supported bot source types (add brave_news, youtube), increase POST_MAX_LENGTH from 400 to 600, add minimal user handle in mention handler tests, and add mocks & test adjustments in scheduler tests to keep them unit-scoped.

These changes simplify installation, add CI coverage (including Docker config validation), enable multi‑arch builds, and align tests with expanded bot source/validation behavior.
2026-03-07 16:11:37 -08:00

155 lines
4.5 KiB
YAML

# Synapsis - Docker Compose (Production)
# Uses pre-built image from GitHub Container Registry
#
# Quick Start:
# 1. Bootstrap the deployment directory:
# curl -fsSL https://synapsis.social/install.sh | bash
# 2. Configure (edit with your domain and admin email): nano /opt/synapsis/.env
# 3. Start your node: cd /opt/synapsis && docker compose up -d
#
# Services:
# - Synapsis Next.js application (from GHCR)
# - PostgreSQL database (persistent storage)
# - Caddy reverse proxy with automatic SSL
services:
# ============================================
# PostgreSQL Database
# ============================================
postgres:
image: postgres:16-alpine
container_name: synapsis-db
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER:-synapsis}
POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme}
POSTGRES_DB: ${DB_NAME:-synapsis}
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- synapsis-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-synapsis} -d ${DB_NAME:-synapsis}"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 256M
# ============================================
# Synapsis Application (from GHCR)
# ============================================
app:
image: ghcr.io/cyph3rasi/synapsis:latest
container_name: synapsis-app
restart: unless-stopped
environment:
# Database connection
DATABASE_URL: postgresql://${DB_USER:-synapsis}:${DB_PASSWORD:-changeme}@postgres:5432/${DB_NAME:-synapsis}
# Authentication
AUTH_SECRET: ${AUTH_SECRET}
# Domain configuration
DOMAIN: ${DOMAIN:-localhost}
NEXT_PUBLIC_NODE_DOMAIN: ${NEXT_PUBLIC_NODE_DOMAIN:-}
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-}
ALLOW_LOCALHOST: ${ALLOW_LOCALHOST:-}
# Admin emails
ADMIN_EMAILS: ${ADMIN_EMAILS}
# Optional settings
BOT_MAX_PER_USER: ${BOT_MAX_PER_USER:-5}
# Port configuration (auto or specific port)
PORT: ${PORT:-3000}
# Shared S3 storage configuration
STORAGE_ENDPOINT: ${STORAGE_ENDPOINT:-}
STORAGE_REGION: ${STORAGE_REGION:-us-east-1}
STORAGE_BUCKET: ${STORAGE_BUCKET:-}
STORAGE_ACCESS_KEY: ${STORAGE_ACCESS_KEY:-}
STORAGE_SECRET_KEY: ${STORAGE_SECRET_KEY:-}
STORAGE_PUBLIC_BASE_URL: ${STORAGE_PUBLIC_BASE_URL:-}
# Node environment
NODE_ENV: production
volumes:
# Uploads directory (if using local file storage)
- uploads_data:/app/uploads
# Shared volume for port coordination with Caddy
- port_data:/var/run/synapsis
networks:
- synapsis-network
depends_on:
postgres:
condition: service_healthy
# Increased start period to allow migrations to run
healthcheck:
test: ["CMD-SHELL", "PORT=$(cat /var/run/synapsis/port 2>/dev/null || echo 3000); case \"$PORT\" in ''|*[!0-9]*) PORT=3000;; esac; wget -q --spider http://127.0.0.1:${PORT}/api/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 256M
# ============================================
# Caddy Reverse Proxy (Automatic SSL)
# ============================================
caddy:
image: caddy:2-alpine
container_name: synapsis-caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- ./caddy-entrypoint.sh:/usr/local/bin/caddy-entrypoint.sh:ro
- caddy_data:/data
- caddy_config:/config
# Shared volume for port coordination with app
- port_data:/var/run/synapsis
networks:
- synapsis-network
depends_on:
app:
condition: service_healthy
environment:
- DOMAIN=${DOMAIN:-localhost}
# Use custom entrypoint to read dynamic port from app
entrypoint: ["/usr/local/bin/caddy-entrypoint.sh"]
# ============================================
# Persistent Volumes
# ============================================
volumes:
postgres_data:
driver: local
uploads_data:
driver: local
caddy_data:
driver: local
caddy_config:
driver: local
port_data:
driver: local
# ============================================
# Networks
# ============================================
networks:
synapsis-network:
driver: bridge