Skip to content

Commit

Permalink
Add Romm 🎮
Browse files Browse the repository at this point in the history
  • Loading branch information
davestephens committed Feb 27, 2024
1 parent 5ce9d06 commit 12281ac
Show file tree
Hide file tree
Showing 10 changed files with 208 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@
tags:
- radarr

- role: romm
tags:
- romm

- role: route53_ddns
tags:
- route53_ddns
Expand Down
44 changes: 44 additions & 0 deletions roles/romm/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 6 additions & 0 deletions roles/romm/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
romm_enabled: true
10 changes: 10 additions & 0 deletions roles/romm/molecule/default/side_effect.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions roles/romm/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions roles/romm/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 91 additions & 0 deletions roles/romm/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions website/docs/applications/media-serving/romm.md
Original file line number Diff line number Diff line change
@@ -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).
2 changes: 1 addition & 1 deletion website/docs/getting-started/external-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 12281ac

Please sign in to comment.