281 Commits

Author SHA1 Message Date
Georges-Antoine Assi
a1519a4b05
Make default ROMM_AUTH_SECRET_KEY consistent between workers 2025-08-15 12:46:46 -04:00
Michael Manganiello
6e7edd2b89
misc: Upgrade Ruffle to v2025-08-14 2025-08-15 12:16:34 -03:00
Michael Manganiello
eaad91422a
fix: Disable OpenTelemetry integration if not configured
OpenTelemetry tries to send traces to a default `localhost:4317`
endpoint if no configuration is provided, which is not what we want if
users don't configure OpenTelemetry explicitly.

This change sets the `OTEL_SDK_DISABLED` environment variable to
`true` if no `OTEL_` prefixed environment variables are found, which
disables the OpenTelemetry SDK.
2025-08-14 09:45:04 -03:00
Michael Manganiello
80291f4be1
misc: Move cache initialization to startup script
Guarantee that cache is initialized during startup, and only once,
instead of every time a `MetadataHandler` object is instantiated.

Also, improve logic to determine `fixtures` paths.
2025-08-13 12:26:15 -03:00
Michael Manganiello
63f84b78d5
misc: Create startup script to run initial tasks before main application
For steps that need to run before the web application starts, such as
scheduling tasks, this new `startup.py` script is introduced.

This fixes a recently introduced issue where task scheduling was not
being triggered, because of it being included in the
`if __name__ == "__main__":` block, which is not executed when
the application is run by Gunicorn in production environments.

We do not include this logic as part of FastAPI's lifespan
implementation, as running multiple workers with Gunicorn would
cause this logic to be executed multiple times.
2025-08-12 23:14:26 -03:00
Michael Manganiello
f95e0edff4
feat: Add OpenTelemetry integration to file watcher
Run file watcher using `opentelemetry-instrument` to enable tracing for
the watcher service.
2025-08-12 11:25:40 -03:00
Michael Manganiello
652df5d4cd
feat: Add OpenTelemetry integration for API service
This change introduces OpenTelemetry dependencies, and uses
`opentelemetry-instrument` auto-instrumentation to allow users to
configure OpenTelemetry settings via environment variables [1].

The only custom environment variable added is
`OTEL_SERVICE_NAME_PREFIX`, which allows users to set a prefix to the
service names included by RomM to differentiate between `api`, `worker`,
and `watcher` services.

The instrumentation of RQ workers and file watcher will be added in
subsequent pull requests.

[1] https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
2025-08-12 09:18:59 -03:00
Michael Manganiello
4eea761d87
misc: Do not warn when REDIS_HOST is set
Change log level to info when REDIS_HOST is set, as this is a valid
and common configuration.
2025-08-09 21:21:24 -03:00
Georges-Antoine Assi
d005dba90b
fix a bunch of shit 2025-08-09 11:16:12 -04:00
Michael Manganiello
86b7d021b7
Merge pull request #2238 from rommapp/fix/docker-build-fixes
fix: Docker build and init fixes
2025-08-08 15:35:57 -03:00
Michael Manganiello
676079f1e5
fix: Docker build and init fixes
* Added `linux-headers` back, but only for development stage.
* Fixed initialization script, as `uv` is not included in the final
  Docker image.
* Initialize variable `ENABLE_SCHEDULED_UPDATE_LAUNCHBOX_METADATA`.
2025-08-08 15:09:27 -03:00
Michael Manganiello
9c0df02296
fix: Correctly set up dockerignore file
* Rename file to `Dockerfile.dockerignore`. As the `Dockerfile` is not
  in the root directory, the Docker spec requires the file to be
  named `<dockerfile_name>.dockerignore`.
* Update ignore rules, and include `.mypy_cache/` directory.
2025-08-08 14:38:11 -03:00
Georges-Antoine Assi
de42333f2f
Merge pull request #2232 from rommapp/native-7z-parse
Use native 7z to extract files and calculate hashes
2025-08-08 09:23:29 -04:00
Georges-Antoine Assi
b247a5c5bb
small tweaks 2025-08-07 17:39:57 -04:00
Michael Manganiello
76db0ab98c
feat: Migrate watcher to use watchfiles library
The `watchfiles` library supports event batching, which allows us to
process multiple filesystem changes in a single run.

This change also avoids database calls in the watcher as much as
possible.
2025-08-07 13:28:49 -03:00
Georges-Antoine Assi
836e7358c2
fix issues from code review 2025-08-07 09:34:43 -04:00
Georges-Antoine Assi
4c6c36fa04
fix typo 2025-08-06 23:57:47 -04:00
Georges-Antoine Assi
64493348b9
add ignores for shellcheck 2025-08-06 23:30:32 -04:00
Georges-Antoine Assi
7e0cb2272d
run watchdog as a native task 2025-08-06 23:25:47 -04:00
Georges-Antoine Assi
dd6669ebd5
fix pythonpath 2025-08-06 22:08:28 -04:00
Georges-Antoine Assi
6b307afcd3
Run worker as a native process 2025-08-06 21:57:32 -04:00
Michael Manganiello
5dcc1bd31c
feat: Migrate scheduler to native RQ process
This change replaces our custom `scheduler.py` script with the
`rqscheduler` command, allowing us to run the RQ scheduler as a
separate, low-memory process, by avoiding the need to maintain
the Python app in memory.

* Remove `scheduler.py` script.
* Move initialization of scheduled tasks to `worker.py`.
* Update `docker/init_scripts/init` to start the `rqscheduler`
  command instead of the custom script.
* Fix scheduled tasks' `func` paths to the new project structure.
* Temporarily use a fork of `rq-scheduler` to support
  username and SSL settings in the `rqscheduler` command.
2025-08-06 19:13:12 -03:00
Michael Manganiello
9c8aad6cd6
fix: Run scheduler when only LaunchBox update is enabled
Include the check for `ENABLE_SCHEDULED_UPDATE_LAUNCHBOX_METADATA` to
decide whether to start the scheduler process.
2025-08-06 17:05:03 -03:00
Daniel Koster
2aa0c204b1
Update default.conf.template
Add IPv6 support
2025-08-04 20:16:59 +02:00
zurdi
270758ba69
feat: display version information in the banner 2025-07-21 11:47:12 +00:00
Georges-Antoine Assi
988fa510e5
readd link in dockerfile 2025-07-07 18:05:38 -04:00
Michael Manganiello
87d20b0bb8
fix: Correctly use Python 3.13 in Docker image
The `production-stage` stage was depending on the `python3` package from
Alpine, which at the moment of writing is still Python 3.12.

To avoid relying on Alpine's package and releases, we now copy the
Python installation directly from its official Docker image.

Other options were tested but did not work:
- Trying to install Python 3.13 using `apk`. As mentioned, Alpine does
  not support Python 3.13 yet.
- Installing Python 3.13 using `pyenv`. The installation worked, but the
  generated image was too large. Related `pyenv` discussion:
  https://github.com/orgs/pyenv/discussions/2868
- Installing Python 3.13 using `uv`. Only worked for `amd64`
  architecture, but the installation failed on `arm64`.
2025-07-07 00:17:25 -03:00
Georges-Antoine Assi
d1117a11f3
bump emujs to 4.2.3 2025-07-05 16:18:48 -04:00
Michael Manganiello
ea9def4b85
misc: Replace deprecated uvicorn.workers with uvicorn-worker
According to the `uvicorn` docs [1], the `uvicorn.workers.UvicornWorker`
class is deprecated and replaced by the `uvicorn-worker` package [2].

[1] https://www.uvicorn.org/deployment/#gunicorn
[2] https://github.com/Kludex/uvicorn-worker
2025-07-05 12:59:49 -03:00
Georges-Antoine Assi
8e1a93480e
Apply suggestion from @adamantike
Co-authored-by: Michael Manganiello <adamantike@users.noreply.github.com>
2025-07-04 21:26:34 -04:00
Georges-Antoine Assi
4f6b6fe660
Apply suggestion from @adamantike
Co-authored-by: Michael Manganiello <adamantike@users.noreply.github.com>
2025-07-04 21:26:20 -04:00
Georges-Antoine Assi
edfa25ef21
Apply suggestion from @adamantike
Co-authored-by: Michael Manganiello <adamantike@users.noreply.github.com>
2025-07-04 21:26:12 -04:00
Georges-Antoine Assi
e1a5c14817
Apply suggestion from @adamantike
Co-authored-by: Michael Manganiello <adamantike@users.noreply.github.com>
2025-07-04 21:26:05 -04:00
Georges-Antoine Assi
e6fe94fc0b
Apply suggestion from @adamantike
Co-authored-by: Michael Manganiello <adamantike@users.noreply.github.com>
2025-07-04 21:25:53 -04:00
Georges-Antoine Assi
543238fb40
install uv to correct dir 2025-07-04 10:03:44 -04:00
Georges-Antoine Assi
e8f8f1621c
complete migration to uv 2025-07-04 09:54:04 -04:00
Michael Manganiello
de762aa9f8
Merge pull request #2048 from rommapp/misc/python-3.13
misc: Upgrade to Python 3.13
2025-07-04 08:15:56 -03:00
Georges-Antoine Assi
8908d21afa
Merge pull request #2043 from starkmapper/fix-proxy-aware-feed
Fix for setting the correct forward proto when behind ssl proxy
2025-07-04 00:35:49 -04:00
Michael Manganiello
f96adeeaee
misc: Upgrade to Python 3.13
Small changes to upgrade Python to version 3.13, and fixes based on a
`pyupgrade` run using the `--py313-plus` flag.
2025-07-03 23:37:00 -03:00
Georges-Antoine Assi
1050f47aac
bump emulatorjs to 4.2.2 2025-07-02 16:40:01 -04:00
Mark Stapper
365c0efece Fix typo 2025-07-02 08:11:35 +02:00
Georges-Antoine Assi
67dc49c818
Add vscode devcontainer file and fix dockerfile 2025-07-01 15:02:32 -04:00
Mark Stapper
fa3a5c534f Fix Set correct forward proto even when behind reverse proxy 2025-07-01 10:34:19 +02:00
Michael Manganiello
dac5cf687e
misc: Upgrade nginx to v1.29.0 2025-06-29 12:42:17 -03:00
Michael Manganiello
ab6ccc0999
misc: Upgrade RALibretro to v1.8.1
The previous attempt to upgrade RALibretro before a new tagged version
was available (#1970) needed to be reverted, as the RAHasher tool failed
with segmentation faults in some scenarios.
2025-06-28 13:10:37 -03:00
Michael Manganiello
c532f177ad
misc: Remove support for deprecated GUNICORN_WORKERS variable
The `GUNICORN_WORKERS` environment variable has been deprecated in favor
of `WEB_CONCURRENCY`.
2025-06-19 10:19:40 -03:00
Georges-Antoine Assi
798f1cdcb0
fulyl revert it 2025-06-15 11:13:47 -04:00
Georges-Antoine Assi
8a89775ec8
add back libs for rahasher 2025-06-15 10:43:30 -04:00
Georges-Antoine Assi
bc0a0c1f26
revert ralibretro change 2025-06-15 10:32:07 -04:00
Michael Manganiello
a85a696505
misc: Upgrade RALibretro to the current upstream version
Bump `RALibretro` to the latest commit from the upstream repository.
Removes the need to use an older version of Alpine Linux, but requires
some changes to the `RALibretro` source code to compile successfully.

The `nginx` image is still not available for Alpine 3.22, but we can
also upgrade to its latest patch version (`1.27.5`).
2025-06-10 20:48:15 -03:00