Compose and supporting code for four services that had been running or prototyped without their config tracked here, per the repo convention that agap_git holds the compose + config while application source lives in each service's own Gitea repo. Only placeholder credentials are included: mood/.env.example and moodtracker/.env.example ship dummy values, and overleaf/variables.env carries app name and feature flags only. Real values stay in Vaultwarden. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4.7 KiB
4.7 KiB
Overleaf Service
Overleaf is an open-source online LaTeX editor. This directory contains the Docker Compose configuration for running Overleaf on Agap.
Configuration Files
.env- Docker Compose environment variables (image versions, ports, data paths)docker-compose.yml- Service definitions (Overleaf, MongoDB, Redis)overleaf.rc- Overleaf toolkit configuration (compatibility layer)variables.env- Overleaf application environment variablesversion- Overleaf image version (6.1.2)
Data Directories
The following directories must exist on the host and have appropriate permissions:
/mnt/ssd/dbs/overleaf/
├── data/ # Overleaf application data
├── mongo/ # MongoDB database files
└── redis/ # Redis persistence files
Create them if they don't exist:
mkdir -p /mnt/ssd/dbs/overleaf/{data,mongo}
mkdir -p /mnt/ssd/dbs/overleaf/redis
chmod 755 /mnt/ssd/dbs/overleaf/*
Quick Start
From the agap_git/overleaf/ directory:
# Start all services (compose reads .env automatically)
docker compose up -d
# Check status
docker compose ps
# View logs
docker compose logs -f sharelatex
# Stop all services
docker compose down
Services
sharelatex
- Image:
sharelatex/sharelatex:6.1.2 - Port:
127.0.0.1:8089(localhost only) - Data:
/mnt/ssd/dbs/overleaf/data:/var/lib/overleaf - Features:
- Sandboxed compiles via Docker sibling containers
- Email disabled by default (see
variables.env) - Templates and project files enabled (see
variables.env)
mongo
- Image:
mongo:8.0 - Port:
27017(internal, exposed only to sharelatex) - Data:
/mnt/ssd/dbs/overleaf/mongo:/data/db - Replica Set: Initialized automatically on first run with
--replSet overleaf
redis
- Image:
redis:7.4 - Port:
6379(internal, exposed only to sharelatex) - Data:
/mnt/ssd/dbs/overleaf/redis:/data - Persistence: AOF (Append-Only File) enabled
Configuration
Environment Variables
Edit variables.env to customize Overleaf behavior:
OVERLEAF_APP_NAME- Display name for the instanceENABLE_CONVERSIONS- Enable PDF thumbnail generationEMAIL_CONFIRMATION_DISABLED- Disable email confirmation requirementOVERLEAF_SITE_URL- Public URL (if behind proxy)OVERLEAF_BEHIND_PROXY- Set to true if behind reverse proxyOVERLEAF_SECURE_COOKIE- Use secure cookies when behind TLS proxy
Port Binding
The OVERLEAF_LISTEN_IP in .env controls which interface Overleaf listens on:
127.0.0.1- Localhost only (default, requires reverse proxy)0.0.0.0- All interfaces (not recommended without TLS)
Storage
All data is stored on /mnt/ssd/dbs/overleaf/:
- Application data (documents, projects)
- MongoDB replica set database
- Redis cache and session data
Maintenance
Backup
To back up Overleaf data:
# Stop services gracefully
docker compose stop
# Backup directories
tar czf overleaf-backup-$(date +%Y%m%d).tar.gz /mnt/ssd/dbs/overleaf/
# Restart
docker compose up -d
Upgrade Image Version
To upgrade the Overleaf image:
- Edit
.envand updateSHARELATEX_IMAGEversion tag - Pull the new image:
docker compose pull - Recreate the service:
docker compose up -d - MongoDB and Redis require no migration for patch/minor version bumps
Database Replica Set
MongoDB is configured with a single-node replica set (--replSet overleaf) which is required by Overleaf. If MongoDB fails to initialize:
docker compose exec mongo mongosh --eval "rs.initiate({ _id: 'overleaf', members: [ { _id: 0, host: 'mongo:27017' } ] })"
Troubleshooting
Overleaf won't start
# Check logs
docker compose logs sharelatex
# Common issues:
# - MongoDB not ready (check mongo logs)
# - Redis not ready (check redis logs)
# - Data volume permissions (check /mnt/ssd/dbs/overleaf/ permissions)
High memory usage
- Redis AOF file can grow; use
BGREWRITEAOFif needed - MongoDB maintenance: run
db.collection.reIndex()for indexed collections
Replica set errors in logs
Safe to ignore on first startup; it initializes automatically. If persistent:
docker compose restart mongo
Notes
- This is Overleaf Community Edition (SERVER_PRO=false in overleaf.rc)
- Sibling container sandboxing is enabled but uses single-node mode
- No TLS termination (nginx proxy is disabled); use Caddy or another reverse proxy
- Email is disabled by default; configure SMTP in variables.env to enable