Files
romm/examples/docker-compose.example.yml
Michael Manganiello 7e64a02e08 misc: Add MariaDB healthcheck recommendation to Docker Compose config
This commit adds a healthcheck configuration to the MariaDB service in the
Docker Compose example configuration. The healthcheck script is a simple
shell script that checks if the MariaDB server is ready to accept connections.

The application will wait for the MariaDB service to be healthy before
starting the application service. This should solve issues where the
database takes longer to start than the application, and logs some
`Something went horribly wrong with our database` errors.

This change also stops recommending the `linuxserver/mariadb` image as
an alternative. We have had users that change the image because of the
first time run triggering those errors, but the `linuxserver/mariadb`
image requires a different configuration that could be confusing for new
users (e.g. volume mountpoint needs to be `/config` instead of
`/var/lib/mysql`).
2024-11-06 15:00:59 -03:00

54 lines
1.7 KiB
YAML

version: "3"
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`
- IGDB_CLIENT_ID= # Generate an ID and SECRET in IGDB
- IGDB_CLIENT_SECRET= # https://api-docs.igdb.com/#account-creation
- MOBYGAMES_API_KEY= # https://www.mobygames.com/info/api/
- STEAMGRIDDB_API_KEY= # https://github.com/rommapp/romm/wiki/Generate-API-Keys#steamgriddb
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
- /path/to/assets:/romm/assets # Uploaded saves, states, etc.
- /path/to/config:/romm/config # Path where config.yml is stored
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