Add Romm 🎮

This commit is contained in:
David Stephens 2024-02-27 23:31:44 +00:00
parent 5ce9d06241
commit 12281ac620
10 changed files with 208 additions and 1 deletions

View file

@ -88,6 +88,7 @@ If you have a spare domain name you can configure applications to be accessible
* [pyLoad](https://pyload.net/) - A download manager with a friendly web-interface
* [PyTivo](http://pytivo.org) - An HMO and GoBack server for TiVos.
* [Radarr](https://radarr.video/) - for organising and downloading movies
* [Romm](https://github.com/zurdi15/romm) - A game library manager focused on retro gaming
* [Route53 DDNS](https://crazymax.dev/ddns-route53/) - Automatically update AWS Route53 with your IP address
* [RSS-Bridge](https://rss-bridge.github.io/rss-bridge/) - The RSS feed for websites missing it
* [Sabnzbd](https://sabnzbd.org/) - A powerful usenet downloader that FreeNAS provides

View file

@ -338,6 +338,10 @@
tags:
- radarr
- role: romm
tags:
- romm
- role: route53_ddns
tags:
- route53_ddns

View file

@ -0,0 +1,44 @@
---
romm_enabled: false
romm_available_externally: false
romm_database_username: romm_user
romm_database_password: top_secret
romm_database_root_password: top_top_secret
# directories
romm_home: "{{ docker_home }}/romm"
romm_data_directory: "{{ romm_home }}/romm"
romm_db_data_directory: "{{ romm_home }}/db"
romm_roms_directory: "{{ roms_root }}"
# network
romm_port: "8484"
romm_hostname: "romm"
# docker
romm_container_name: "romm"
romm_image_name: "zurdi15/romm"
romm_image_version: "latest"
romm_db_container_name: "romm-db"
romm_db_image_name: "mariadb"
romm_db_image_version: "11.2"
romm_redis_container_name: "romm-redis"
romm_redis_image_name: "redis"
romm_redis_image_version: "alpine"
# specs
romm_memory: 1g
romm_db_memory: 1g
romm_redis_memory: 1g
# IGDB auth credentials - see https://github.com/zurdi15/romm/tree/release#-docker for more info
romm_igdb_client_id: "abcd"
romm_igdb_client_secret: "abcd"
# auth config
romm_auth_secret_key: "aaaabbbbccccdddd" # Generate a key with `openssl rand -hex 32`
romm_auth_username: "admin"
romm_auth_password: "admin"

View file

@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
romm_enabled: true

View file

@ -0,0 +1,10 @@
---
- name: Stop
hosts: all
become: true
tasks:
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
ansible.builtin.include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
romm_enabled: false

View file

@ -0,0 +1,18 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- ansible.builtin.include_vars:
file: ../../defaults/main.yml
- name: Get Romm container state
community.docker.docker_container:
name: "{{ romm_container_name }}"
register: result
- name: Check if Romm containers are running
ansible.builtin.assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false

View file

@ -0,0 +1,18 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- ansible.builtin.include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Romm
community.docker.docker_container:
name: "{{ romm_container_name }}"
state: absent
register: result
- name: Check if joomla is stopped
ansible.builtin.assert:
that:
- not result.changed

91
roles/romm/tasks/main.yml Normal file
View file

@ -0,0 +1,91 @@
---
- name: Start Romm
block:
- name: Create Romm Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ romm_data_directory }}/resources"
- "{{ romm_db_data_directory }}"
- name: MariaDB Docker Container for Romm
community.docker.docker_container:
name: "{{ romm_db_container_name }}"
image: "{{ romm_db_image_name }}:{{ romm_db_image_version }}"
pull: true
volumes:
- "{{ romm_db_data_directory }}/db:/var/lib/mysql"
env:
MYSQL_ROOT_PASSWORD: "{{ romm_database_root_password }}"
MYSQL_DATABASE: "romm"
MYSQL_USER: "{{ romm_database_username }}"
MYSQL_PASSWORD: "{{ romm_database_password }}"
restart_policy: unless-stopped
memory: "{{ romm_db_memory }}"
- name: Create Romm Redis
community.docker.docker_container:
name: "{{ romm_redis_container_name }}"
image: "{{ romm_redis_image_name }}:{{ romm_redis_image_version }}"
pull: true
restart_policy: unless-stopped
memory: "{{ romm_redis_memory }}"
- name: Romm Docker Container
community.docker.docker_container:
name: "{{ romm_container_name }}"
image: "{{ romm_image_name }}:{{ romm_image_version }}"
pull: true
volumes:
- "{{ romm_roms_directory }}:/romm/library/roms:rw"
- "{{ romm_data_directory }}/resources:/romm/resources:rw"
ports:
- "{{ romm_port }}:8080"
env:
ROMM_DB_DRIVER: "mariadb"
DB_HOST: "db"
DB_PORT: "3306"
DB_USER: "{{ romm_database_username }}"
DB_PASSWD: "{{ romm_database_password }}"
DB_NAME: "romm"
ROMM_AUTH_ENABLED: "true"
ROMM_AUTH_SECRET_KEY: "{{ romm_auth_secret_key }}"
ENABLE_EXPERIMENTAL_REDIS: "true"
REDIS_HOST: "redis"
REDIS_PORT: "6379"
IGDB_CLIENT_ID: "{{ romm_igdb_client_id }}"
IGDB_CLIENT_SECRET: "{{ romm_igdb_client_secret }}"
ROMM_AUTH_USERNAME: "{{ romm_auth_username }}"
ROMM_AUTH_PASSWORD: "{{ romm_auth_password }}"
restart_policy: unless-stopped
memory: "{{ romm_memory }}"
links:
- "{{ romm_db_container_name }}:db"
- "{{ romm_redis_container_name }}:redis"
labels:
traefik.enable: "{{ romm_available_externally | string }}"
traefik.http.routers.romm.rule: "Host(`{{ romm_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.romm.tls.certresolver: "letsencrypt"
traefik.http.routers.romm.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.romm.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.romm.loadbalancer.server.port: "8080"
homepage.group: Media
homepage.name: Romm
homepage.icon: romm
homepage.href: http://{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ romm_port }}
homepage.description: Game library manager
when: romm_enabled is true
- name: Stop Romm
block:
- name: Stop Romm
community.docker.docker_container:
name: "{{ romm_container_name }}"
state: absent
- name: Stop Romm DB
community.docker.docker_container:
name: "{{ romm_db_container_name }}"
state: absent
when: romm_enabled is false

View file

@ -0,0 +1,15 @@
---
title: "Romm"
---
Homepage: [https://github.com/zurdi15/romm](https://github.com/zurdi15/romm)
RomM (ROM Manager) is a game library manager focused on retro gaming.
It enables you to efficiently manage and organize all your games from a web browser.
## Usage
Set `romm_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file.
The Romm web interface can be found at [http://ansible_nas_host_or_ip:8484](http://ansible_nas_host_or_ip:8484).

View file

@ -31,7 +31,7 @@ Traefik routes traffic from ports 80 (HTTP) and 443 (HTTPS) on your Ansible-NAS
Simply set `traefik_enabled: true` in your `all.yml`. By default it listens on ports 80 and 443, but doesn't route any traffic.
Ensure you set the relevant environment variables for your DNS provider in `traefik_environment_variables`. More info at https://doc.traefik.io/traefik/https/acme/.
Ensure you set the relevant environment variables for your DNS provider in `traefik_environment_variables`. More info in the [Traefik ACME docs](https://doc.traefik.io/traefik/https/acme/).
## Router Configuration