mirror of
https://github.com/rommapp/romm.git
synced 2026-12-04 21:02:21 +01:00
* perf(gunicorn): preload the app so web workers share its memory Each gunicorn worker imported the whole app on its own, ~160 MB private per worker. Preloading imports it once in the master; gc.freeze keeps the shared pages from being copied when workers collect garbage. - gunicorn.conf.py: GC off during import, OpenAPI schema built and all objects frozen before fork, inherited SQL pool dropped in each worker - Socket.IO managers renew their pub/sub host ID after fork, otherwise preloaded workers drop each other's emits as their own - WEB_SERVER_CONCURRENCY defaults to 2 - Page limit capped at 1,000 (was 10,000): a worker keeps the memory of its largest response until recycled; select-all pages by 1,000 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(gunicorn): address Greptile review on the preload change - Shorten the renew_host_id docstring and the gunicorn.conf.py comment - Close the fork test's pipe in a finally block - Test that when_ready builds the schema before freezing and re-enabling the GC, and that post_fork disposes the pool with close=False Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(gunicorn): WEB_SERVER_PRELOAD switch and an import fork-safety test - WEB_SERVER_PRELOAD (default true) sets preload_app from the gunicorn config; false restores per-worker imports and skips every hook - tests/test_api_import_is_fork_safe.py imports main in a fresh interpreter with the database on a closed port and fails if the import opens a connection or starts a thread (adapted from #5735) - BACKEND_ARCHITECTURE notes the preload and what it requires of imports Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(coherence): record the invariant run for the preload change Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: drop trunk-ignore comments bandit never needed in tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
2.3 KiB
YAML
56 lines
2.3 KiB
YAML
volumes:
|
|
mysql_data:
|
|
romm_resources:
|
|
romm_redis_data:
|
|
|
|
services:
|
|
romm:
|
|
image: rommapp/romm:latest
|
|
container_name: romm
|
|
restart: unless-stopped
|
|
environment:
|
|
- DB_HOST=romm-db
|
|
- DB_NAME=romm # Should match MARIADB_DATABASE in mariadb
|
|
- DB_USER=romm-user # Should match MARIADB_USER in mariadb
|
|
- DB_PASSWD= # Should match MARIADB_PASSWORD in mariadb
|
|
- ROMM_AUTH_SECRET_KEY= # Generate a key with `openssl rand -hex 32`
|
|
- SCREENSCRAPER_USER= # These are the recommended metadata providers
|
|
- SCREENSCRAPER_PASSWORD= # https://docs.romm.app/latest/Getting-Started/Metadata-Providers/#screenscraper
|
|
- RETROACHIEVEMENTS_API_KEY= # https://docs.romm.app/latest/Getting-Started/Metadata-Providers/#retroachievements
|
|
- STEAMGRIDDB_API_KEY= # https://docs.romm.app/latest/Getting-Started/Metadata-Providers/#steamgriddb
|
|
- HASHEOUS_API_ENABLED=true # https://docs.romm.app/latest/Getting-Started/Metadata-Providers/#hasheous
|
|
- SCAN_WORKERS=4 # How many ROMs to scan at once
|
|
- WEB_SERVER_CONCURRENCY=2 # Workers for API calls, raise for several concurrent users
|
|
volumes:
|
|
- romm_resources:/romm/resources # Resources fetched from IGDB (covers, screenshots, etc.)
|
|
- romm_redis_data:/redis-data # Cached data for background tasks
|
|
- /path/to/library:/romm/library # Your game library. Check https://docs.romm.app/latest/Getting-Started/Folder-Structure/ for more details.
|
|
- /path/to/assets:/romm/assets # Uploaded saves, states, etc.
|
|
- /path/to/config:/romm/config # (Optional) Path where config.yml is stored
|
|
# - /path/to/sync:/romm/sync # Required for ENABLE_SYNC_FOLDER_WATCHER, and holds the SSH keys for ENABLE_SYNC_PUSH_PULL
|
|
ports:
|
|
- 80:8080
|
|
depends_on:
|
|
romm-db:
|
|
condition: service_healthy
|
|
restart: true
|
|
|
|
romm-db:
|
|
image: mariadb:latest
|
|
container_name: romm-db
|
|
restart: unless-stopped
|
|
environment:
|
|
- MARIADB_ROOT_PASSWORD= # Use a unique, secure password
|
|
- MARIADB_DATABASE=romm
|
|
- MARIADB_USER=romm-user
|
|
- MARIADB_PASSWORD=
|
|
volumes:
|
|
- mysql_data:/var/lib/mysql
|
|
healthcheck:
|
|
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
|
start_period: 30s
|
|
start_interval: 10s
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|