# Configuration for romm setup

# Name of the big-bear-romm application
name: big-bear-romm
# Service definitions for the big-bear-romm application
services:
  # Service name: big-bear-romm
  # The `big-bear-romm` service definition
  big-bear-romm:
    image: rommapp/romm:4.9.2 # Docker image for the application
    container_name: big-bear-romm
    environment:
      - DB_HOST=big-bear-rommdb # Hostname of the MariaDB container
      - DB_PORT=3306 # Port used for MariaDB
      - DB_USER=romm-user # Database user for MariaDB
      - DB_NAME=romm # Name of the database (Should match the MYSQL_DATABASE value in the mariadb container)
      - DB_PASSWD=casaos # Database password (Should match the MYSQL_PASSWORD value in the mariadb container)
      - ROMM_AUTH_SECRET_KEY=<secret key> # Authentication secret key (Generate a key with `openssl rand -hex 32`)
      # [Optional] Enable metadata providers (all disabled by default)
      - IGDB_CLIENT_ID=<igdb client id> # Generate an ID and SECRET in IGDB
      - IGDB_CLIENT_SECRET=<igdb client secret> # https://api-docs.igdb.com/#account-creation
      - MOBYGAMES_API_KEY=<moby api key> # https://www.mobygames.com/info/api/
      - STEAMGRIDDB_API_KEY=<sgdb api key> # https://github.com/rommapp/romm/wiki/Generate-API-Keys#steamgriddb
      - SCREENSCRAPER_USER=<screenscraper user> # [Optional] ScreenScraper user
      - SCREENSCRAPER_PASSWORD=<screenscraper password> # [Optional] ScreenScraper password
      - RETROACHIEVEMENTS_API_KEY=<retroachievements api key> # [Optional] RetroAchievements API key
      - HASHEOUS_API_ENABLED=true # [Optional] Enable Hasheous API
      # [Optional] Enable asynchronous tasks (all disabled by default)
      - ENABLE_RESCAN_ON_FILESYSTEM_CHANGE=true # Enable rescan on filesystem change
      - ENABLE_SCHEDULED_RESCAN=true # Enable scheduled rescan
      - ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB=true # Enable scheduled update of Switch TitleDB database
    volumes:
      - "/DATA/AppData/$AppID/resources:/romm/resources" # [Optional] Path where roms metadata (covers) are stored
      - "/DATA/AppData/$AppID/redis-data:/redis-data" # Cached data for background tasks
      - "/DATA/AppData/$AppID/library:/romm/library" # Path to the roms library
      - "/DATA/AppData/$AppID/assets:/romm/assets" # Uploaded saves, states, etc.
      - "/DATA/AppData/$AppID/config:/romm/config" # [Optional] Path where config is stored
      - "/DATA/AppData/$AppID/logs:/romm/logs" # [Optional] Path where logs are stored
    ports:
      - 1080:8080 # Map host port 1080 to container port 8080
    depends_on:
      - big-bear-rommdb # Make sure the romm_db service is started before the app service
    restart: "unless-stopped"
    networks:
      - big-bear-romm-network # Use the big-bear-romm-network network
    x-casaos:
      envs:
        - container: DB_HOST
          description:
            en_us: 'Container Variable: DB_HOST'
        - container: DB_PORT
          description:
            en_us: 'Container Variable: DB_PORT'
        - container: DB_USER
          description:
            en_us: 'Container Variable: DB_USER'
        - container: DB_NAME
          description:
            en_us: 'Container Variable: DB_NAME'
        - container: DB_PASSWD
          description:
            en_us: 'Container Variable: DB_PASSWD'
        - container: ROMM_AUTH_SECRET_KEY
          description:
            en_us: 'Container Variable: ROMM_AUTH_SECRET_KEY'
        - container: IGDB_CLIENT_ID
          description:
            en_us: 'Container Variable: IGDB_CLIENT_ID'
        - container: IGDB_CLIENT_SECRET
          description:
            en_us: 'Container Variable: IGDB_CLIENT_SECRET'
        - container: MOBYGAMES_API_KEY
          description:
            en_us: 'Container Variable: MOBYGAMES_API_KEY'
        - container: STEAMGRIDDB_API_KEY
          description:
            en_us: 'Container Variable: STEAMGRIDDB_API_KEY'
        - container: SCREENSCRAPER_USER
          description:
            en_us: 'Container Variable: SCREENSCRAPER_USER'
        - container: SCREENSCRAPER_PASSWORD
          description:
            en_us: 'Container Variable: SCREENSCRAPER_PASSWORD'
        - container: RETROACHIEVEMENTS_API_KEY
          description:
            en_us: 'Container Variable: RETROACHIEVEMENTS_API_KEY'
        - container: HASHEOUS_API_ENABLED
          description:
            en_us: 'Container Variable: HASHEOUS_API_ENABLED'
        - container: ENABLE_RESCAN_ON_FILESYSTEM_CHANGE
          description:
            en_us: 'Container Variable: ENABLE_RESCAN_ON_FILESYSTEM_CHANGE'
        - container: ENABLE_SCHEDULED_RESCAN
          description:
            en_us: 'Container Variable: ENABLE_SCHEDULED_RESCAN'
        - container: ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB
          description:
            en_us: 'Container Variable: ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB'
      volumes:
        - container: /romm/resources
          description:
            en_us: 'Container Path: /romm/resources'
        - container: /redis-data
          description:
            en_us: 'Container Path: /redis-data'
        - container: /romm/library
          description:
            en_us: 'Container Path: /romm/library'
        - container: /romm/assets
          description:
            en_us: 'Container Path: /romm/assets'
        - container: /romm/config
          description:
            en_us: 'Container Path: /romm/config'
        - container: /romm/logs
          description:
            en_us: 'Container Path: /romm/logs'
      ports:
        - container: "8080"
          description:
            en_us: 'Container Port: 8080'
  # MariaDB service for rommdb
  big-bear-rommdb:
    image: mariadb:latest
    container_name: big-bear-rommdb
    environment:
      - MYSQL_ROOT_PASSWORD=casaos # MariaDB root password
      - MYSQL_DATABASE=romm # MariaDB database name
      - MYSQL_USER=romm-user # MariaDB user
      - MYSQL_PASSWORD=casaos # MariaDB password
    volumes:
      - /DATA/AppData/$AppID/mysql:/var/lib/mysql # MariaDB data volume (can also be mounted locally)
    ports:
      - 3306:3306 # Map host port 3306 to container port 3306
    restart: "unless-stopped"
    networks:
      - big-bear-romm-network # Use the big-bear-romm-network network
    x-casaos:
      envs:
        - container: MYSQL_ROOT_PASSWORD
          description:
            en_us: 'Container Variable: MYSQL_ROOT_PASSWORD'
        - container: MYSQL_DATABASE
          description:
            en_us: 'Container Variable: MYSQL_DATABASE'
        - container: MYSQL_USER
          description:
            en_us: 'Container Variable: MYSQL_USER'
        - container: MYSQL_PASSWORD
          description:
            en_us: 'Container Variable: MYSQL_PASSWORD'
      volumes:
        - container: /var/lib/mysql
          description:
            en_us: 'Container Path: /var/lib/mysql'
      ports:
        - container: "3306"
          description:
            en_us: 'Container Port: 3306'
# Network definitions for the big-bear-romm application
networks:
  big-bear-romm-network:
    driver: bridge
x-casaos:
  # Supported CPU architectures for this application
  architectures:
    - amd64
    - arm64
  # Main service for this application
  main: big-bear-romm
  # Detailed description for the application
  description:
    en_us: ROM manager for organizing, enriching, and playing retro games, with support for 400+ platforms.
  # Brief tagline for the application
  tagline:
    en_us: RomM
  # Developer's information
  developer: RomM Team
  # Author of this particular configuration
  author: BigBearTechWorld
  # Icon URL for the application
  icon: https://cdn.jsdelivr.net/gh/selfhst/icons/png/romm.png
  # Thumbnail image for the application (if any)
  thumbnail: ""
  # Installation tips
  tips:
    before_install:
      en_us: |
        Run this script before installing the big-bear-romm application:

        ```
        bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/generate-romm-config/run.sh)"
        ```

        After running this script, you need to restart the container.
  # Title for the application
  title:
    en_us: RomM
  # Category under which the application falls
  category: BigBearCasaOS
  # Default port mapping for the application
  port_map: "1080"
