services: add mood, moodtracker, overleaf, personal-sensing; update ollama

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>
This commit is contained in:
2026-07-30 04:42:58 +00:00
parent 41f3f15d27
commit d37801806d
31 changed files with 1848 additions and 0 deletions

16
overleaf/.gitignore vendored Normal file
View File

@@ -0,0 +1,16 @@
# Runtime data and temporary files
data/
*.bak*
# Docker compose overrides
docker-compose.override.yml
# Nginx configuration (only used with NGINX_ENABLED=true)
config/nginx/
# TLS certificates (only used with NGINX_ENABLED=true)
config/certs/
# Logs and temporary files
logs/
*.log

165
overleaf/README.md Normal file
View File

@@ -0,0 +1,165 @@
# 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 variables
- **`version`** - 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:
```bash
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:
```bash
# 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 instance
- `ENABLE_CONVERSIONS` - Enable PDF thumbnail generation
- `EMAIL_CONFIRMATION_DISABLED` - Disable email confirmation requirement
- `OVERLEAF_SITE_URL` - Public URL (if behind proxy)
- `OVERLEAF_BEHIND_PROXY` - Set to true if behind reverse proxy
- `OVERLEAF_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:
```bash
# 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:
1. Edit `.env` and update `SHARELATEX_IMAGE` version tag
2. Pull the new image: `docker compose pull`
3. Recreate the service: `docker compose up -d`
4. 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:
```bash
docker compose exec mongo mongosh --eval "rs.initiate({ _id: 'overleaf', members: [ { _id: 0, host: 'mongo:27017' } ] })"
```
## Troubleshooting
### Overleaf won't start
```bash
# 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 `BGREWRITEAOF` if 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:
```bash
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
## References
- [Overleaf Toolkit Documentation](https://github.com/overleaf/toolkit)
- [Overleaf GitHub Wiki](https://github.com/overleaf/overleaf/wiki)

View File

@@ -0,0 +1,79 @@
---
services:
# MongoDB for Overleaf data storage
mongo:
restart: always
image: "${MONGO_IMAGE}:${MONGO_VERSION}"
command: --replSet overleaf
container_name: mongo
volumes:
- "${MONGO_DATA_PATH}:/data/db"
expose:
- 27017
healthcheck:
test: echo 'db.stats().ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 10s
retries: 5
networks:
- overleaf
# Redis for caching and sessions
redis:
restart: always
image: "${REDIS_IMAGE}"
container_name: redis
command: redis-server --appendonly yes
volumes:
- "${REDIS_DATA_PATH}:/data"
expose:
- 6379
networks:
- overleaf
# Overleaf (ShareLaTeX) application
sharelatex:
restart: always
image: "${SHARELATEX_IMAGE}"
container_name: sharelatex
depends_on:
mongo:
condition: service_healthy
redis:
condition: service_started
ports:
- "${OVERLEAF_LISTEN_IP}:${OVERLEAF_PORT}:80"
volumes:
# Data volume
- "${OVERLEAF_DATA_PATH}:/var/lib/overleaf"
# Docker socket for sandboxed compiles
- "${DOCKER_SOCKET_PATH}:/var/run/docker.sock"
environment:
# Connectivity
OVERLEAF_MONGO_URL: "${MONGO_URL}"
OVERLEAF_REDIS_HOST: "${REDIS_HOST}"
OVERLEAF_REDIS_PORT: "${REDIS_PORT}"
# Docker and compilation settings
DOCKER_RUNNER: 'true'
SANDBOXED_COMPILES: 'true'
SANDBOXED_COMPILES_SIBLING_CONTAINERS: 'true'
SANDBOXED_COMPILES_HOST_DIR: "${OVERLEAF_DATA_PATH}/data/compiles"
SYNCTEX_BIN_HOST_PATH: "${OVERLEAF_DATA_PATH}/bin/synctex"
# Git bridge (disabled for Community Edition)
GIT_BRIDGE_ENABLED: 'false'
# Load additional environment variables
env_file:
- variables.env
links:
- mongo
- redis
networks:
- overleaf
networks:
overleaf:
driver: bridge

47
overleaf/overleaf.rc Normal file
View File

@@ -0,0 +1,47 @@
#### Overleaf RC ####
PROJECT_NAME=overleaf
# Sharelatex container
# Uncomment the OVERLEAF_IMAGE_NAME variable to use a user-defined image.
# OVERLEAF_IMAGE_NAME=sharelatex/sharelatex
OVERLEAF_DATA_PATH=/mnt/ssd/dbs/overleaf/data
SERVER_PRO=false
OVERLEAF_LISTEN_IP=127.0.0.1
OVERLEAF_PORT=8089
# Sibling Containers
SIBLING_CONTAINERS_ENABLED=true
DOCKER_SOCKET_PATH=/var/run/docker.sock
# Mongo configuration
MONGO_ENABLED=true
MONGO_DATA_PATH=/mnt/ssd/dbs/overleaf/mongo
MONGO_IMAGE=mongo
MONGO_VERSION=8.0
# Redis configuration
REDIS_ENABLED=true
REDIS_DATA_PATH=data/redis
REDIS_IMAGE=redis:7.4
REDIS_AOF_PERSISTENCE=true
# Git-bridge configuration (Server Pro only)
GIT_BRIDGE_ENABLED=false
GIT_BRIDGE_DATA_PATH=/mnt/ssd/dbs/overleaf/git-bridge
# TLS proxy configuration (optional)
# See documentation in doc/tls-proxy.md
NGINX_ENABLED=false
NGINX_CONFIG_PATH=config/nginx/nginx.conf
NGINX_HTTP_PORT=80
# Replace these IP addresses with the external IP address of your host
NGINX_HTTP_LISTEN_IP=127.0.1.1
NGINX_TLS_LISTEN_IP=127.0.1.1
TLS_PRIVATE_KEY_PATH=config/nginx/certs/overleaf_key.pem
TLS_CERTIFICATE_PATH=config/nginx/certs/overleaf_certificate.pem
TLS_PORT=443
# In Air-gapped setups, skip pulling images
# PULL_BEFORE_UPGRADE=false
# SIBLING_CONTAINERS_PULL=false

125
overleaf/variables.env Normal file
View File

@@ -0,0 +1,125 @@
OVERLEAF_APP_NAME="Our Overleaf Instance"
ENABLED_LINKED_FILE_TYPES=project_file,project_output_file
# Enables Thumbnail generation using an external converter (pdftocairo by default)
ENABLE_CONVERSIONS=true
# Disables email confirmation requirement
EMAIL_CONFIRMATION_DISABLED=true
## Nginx
# NGINX_WORKER_PROCESSES=4
# NGINX_WORKER_CONNECTIONS=768
## Set for TLS via nginx-proxy
# OVERLEAF_BEHIND_PROXY=true
# OVERLEAF_SECURE_COOKIE=true
# OVERLEAF_SITE_URL=http://overleaf.example.com
# OVERLEAF_NAV_TITLE=Our Overleaf Instance
# OVERLEAF_HEADER_IMAGE_URL=http://somewhere.com/mylogo.png
# OVERLEAF_ADMIN_EMAIL=support@example.com
# OVERLEAF_LEFT_FOOTER='[{"text": "Contact your support team", "url": "mailto:support@example.com"}]'
# OVERLEAF_RIGHT_FOOTER='[{"text": "Hello, I am on the Right"}]'
# OVERLEAF_EMAIL_FROM_ADDRESS=team@example.com
# OVERLEAF_EMAIL_AWS_SES_ACCESS_KEY_ID=
# OVERLEAF_EMAIL_AWS_SES_SECRET_KEY=
# OVERLEAF_EMAIL_SMTP_HOST=smtp.example.com
# OVERLEAF_EMAIL_SMTP_PORT=587
# OVERLEAF_EMAIL_SMTP_SECURE=false
# OVERLEAF_EMAIL_SMTP_USER=
# OVERLEAF_EMAIL_SMTP_PASS=
# OVERLEAF_EMAIL_SMTP_NAME=
# OVERLEAF_EMAIL_SMTP_LOGGER=false
# OVERLEAF_EMAIL_SMTP_TLS_REJECT_UNAUTH=true
# OVERLEAF_EMAIL_SMTP_IGNORE_TLS=false
# OVERLEAF_CUSTOM_EMAIL_FOOTER=This system is run by department x
################
## Server Pro ##
################
EXTERNAL_AUTH=none
# OVERLEAF_LDAP_URL=ldap://ldap:389
# OVERLEAF_LDAP_SEARCH_BASE=ou=people,dc=planetexpress,dc=com
# OVERLEAF_LDAP_SEARCH_FILTER=(uid={{username}})
# OVERLEAF_LDAP_BIND_DN=cn=admin,dc=planetexpress,dc=com
# OVERLEAF_LDAP_BIND_CREDENTIALS=GoodNewsEveryone
# OVERLEAF_LDAP_EMAIL_ATT=mail
# OVERLEAF_LDAP_NAME_ATT=cn
# OVERLEAF_LDAP_LAST_NAME_ATT=sn
# OVERLEAF_LDAP_UPDATE_USER_DETAILS_ON_LOGIN=true
# OVERLEAF_TEMPLATES_USER_ID=578773160210479700917ee5
# OVERLEAF_NEW_PROJECT_TEMPLATE_LINKS=[{"name":"All Templates","url":"/templates/all"}]
# TEX_LIVE_DOCKER_IMAGE=quay.io/sharelatex/texlive-full:2022.1
# ALL_TEX_LIVE_DOCKER_IMAGES=quay.io/sharelatex/texlive-full:2022.1,quay.io/sharelatex/texlive-full:2021.1,quay.io/sharelatex/texlive-full:2020.1
# OVERLEAF_PROXY_LEARN=true
# S3
# Docs: https://github.com/overleaf/overleaf/wiki/S3
# ## Enable the s3 backend for filestore
# OVERLEAF_FILESTORE_BACKEND=s3
# ## Enable S3 backend for history
# OVERLEAF_HISTORY_BACKEND=s3
# #
# # Pick one of the two sections "AWS S3" or "Self-hosted S3".
# #
# # AWS S3
# ## Bucket name for project files
# OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files
# ## Bucket name for template files
# OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files
# ## Key for filestore user
# OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID=...
# ## Secret for filestore user
# OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY=...
# ## Bucket region you picked when creating the buckets.
# OVERLEAF_FILESTORE_S3_REGION=""
# ## Bucket name for project history blobs
# OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs
# ## Bucket name for history chunks
# OVERLEAF_HISTORY_CHUNKS_BUCKET=overleaf-chunks
# ## Key for history user
# OVERLEAF_HISTORY_S3_ACCESS_KEY_ID=...
# ## Secret for history user
# OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY=...
# ## Bucket region you picked when creating the buckets.
# OVERLEAF_HISTORY_S3_REGION=""
#
# # Self-hosted S3
# ## Bucket name for project files
# OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files
# ## Bucket name for template files
# OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files
# ## Key for filestore user
# OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID=...
# ## Secret for filestore user
# OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY=...
# ## S3 provider endpoint
# OVERLEAF_FILESTORE_S3_ENDPOINT=http://10.10.10.10:9000
# ## Path style addressing of buckets. Most likely you need to set this to "true".
# OVERLEAF_FILESTORE_S3_PATH_STYLE="true"
# ## Bucket region. Most likely you do not need to configure this.
# OVERLEAF_FILESTORE_S3_REGION=""
# ## Bucket name for project history blobs
# OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs
# ## Bucket name for history chunks
# OVERLEAF_HISTORY_CHUNKS_BUCKET=overleaf-chunks
# ## Key for history user
# OVERLEAF_HISTORY_S3_ACCESS_KEY_ID=...
# ## Secret for history user
# OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY=...
# ## S3 provider endpoint
# OVERLEAF_HISTORY_S3_ENDPOINT=http://10.10.10.10:9000
# ## Path style addressing of buckets. Most likely you need to set this to "true".
# OVERLEAF_HISTORY_S3_PATH_STYLE="true"
# ## Bucket region. Most likely you do not need to configure this.
# OVERLEAF_HISTORY_S3_REGION=""

1
overleaf/version Normal file
View File

@@ -0,0 +1 @@
6.1.2