135 Commits

Author SHA1 Message Date
Georges-Antoine Assi 485b6af0dd fix: wire LOGLEVEL into gunicorn logger level and RQ worker/scheduler
The gunicorn logging config hard-coded level=INFO, ignoring LOGLEVEL.
Patch it at startup via sed. Also pass --logging_level to rq worker
and rqscheduler so their framework logging respects LOGLEVEL.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 10:09:03 -04:00
Georges-Antoine Assi af2d1f3471 changes from bot review 2026-04-11 09:58:32 -04:00
copilot-swe-agent[bot] bc9961cfe5 fix: remove dynamic gunicorn logging config generator from init script
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/bdfc3221-ba18-445d-9cf7-f4b495e82577

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-04-11 02:48:15 +00:00
Georges-Antoine Assi 3f9d71f741 run fmt 2026-04-10 22:45:14 -04:00
copilot-swe-agent[bot] 6e2f502b67 fix: use dynamic log level in gunicorn format and add auto-generated comment
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/0b5ef21c-89e1-4f08-b402-03f3276aab08

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-04-11 02:15:01 +00:00
copilot-swe-agent[bot] d6036cb5ef fix: respect LOGLEVEL env var for all log output sources
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/0b5ef21c-89e1-4f08-b402-03f3276aab08

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-04-11 02:13:20 +00:00
Georges-Antoine Assi f13f929d7d tweaks based on self review 2026-03-14 22:26:53 -04:00
Christian Rehm 91ee163585 fix(watcher): skip opentelemetry-instrument when OTEL is disabled
When OTEL_SDK_DISABLED=true (set automatically when no OTEL_ env vars
are present), the opentelemetry-instrument wrapper does not properly
pass through the WATCHFILES_CHANGES environment variable to watcher.py.

This causes the filesystem watcher to silently fail - watchfiles detects
changes but watcher.py receives an empty WATCHFILES_CHANGES and exits
immediately without scheduling any rescans.

The fix skips the opentelemetry-instrument wrapper when OTEL is disabled,
allowing watchfiles to pass WATCHFILES_CHANGES directly to watcher.py.

Fixes automatic rescan on filesystem change for users who don't configure
OpenTelemetry (the majority of self-hosted deployments).
2026-01-30 23:18:49 +00:00
Georges-Antoine Assi f40dcb25a6 change it again 2026-01-10 14:32:32 -05:00
Georges-Antoine Assi 53330536e0 change to WEB_SERVER_GUNICORN_WAIT 2026-01-10 14:26:36 -05:00
Georges-Antoine Assi 91ff88a008 Add WEB_SERVER_GUNICORN_RETRIES env var for slow systems 2026-01-10 14:24:31 -05:00
Georges-Antoine Assi 7e4e27db62 commit frontend code 2025-10-16 15:40:27 -04:00
Georges-Antoine Assi 0d357d59e5 [ROMM-2470] Skip bind IPV6 if IPV4_ONLY is true 2025-10-07 09:07:30 -04:00
Georges-Antoine Assi 3d698c06b1 make gunicorn a warn not an error 2025-10-02 16:41:03 -04:00
Georges-Antoine Assi e2d7e73ed4 Use uppercase loglevel check in init script 2025-09-29 08:45:55 -04:00
Georges-Antoine Assi 2bf87e7425 Merge branch 'master' into console-mode 2025-08-29 13:07:05 -05:00
Georges-Antoine Assi 798ffa31b3 switch names to WEB_SERVER_ 2025-08-26 23:53:55 -04:00
Georges-Antoine Assi e32e51a1e2 use correct arguments 2025-08-26 19:11:39 -04:00
Georges-Antoine Assi 603f6ec5af Add options to gunicorn call 2025-08-26 18:16:52 -04:00
Georges-Antoine Assi 3075ffeab4 centralize routes 2025-08-25 13:25:34 -04:00
Georges-Antoine Assi a1519a4b05 Make default ROMM_AUTH_SECRET_KEY consistent between workers 2025-08-15 12:46:46 -04: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
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 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
zurdi 270758ba69 feat: display version information in the banner 2025-07-21 11:47:12 +00: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
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
zurdi 2aa6f1251b fix: set default ROMM_BASE_URL in nginx startup log message 2025-05-23 00:11:12 +00:00
zurdi d27f4d626b feat: Reset forgotten password added 2025-05-13 09:35:53 +00:00
Zurdi 5c6d35b141 Update docker/init_scripts/init
Co-authored-by: Georges-Antoine Assi <3247106+gantoine@users.noreply.github.com>
2025-05-11 09:17:34 +02:00
zurdi 693f3e038b refactor: add ASCII art banner to init script and improve debug log output 2025-05-09 15:55:58 +00:00
zurdi 1b38607eab refactor: update Alembic logging configuration and add ASCII art banner to init script 2025-05-09 15:23:32 +00:00
zurdi 22f5134fbb refactor: add Gunicorn logging configuration and update startup script 2025-05-09 10:25:02 +00:00
zurdi e6c4a43c1e refactor: improve logging messages and formatting for clarity and consistency across multiple modules 2025-05-09 09:35:13 +00:00
zurdi 53f9386208 refactor: enhance logging messages and formatting for improved clarity and consistency 2025-05-08 23:35:33 +00:00
zurdi b3d341bc11 refactor: add TODO comment to check on database disconnection in init script 2025-05-08 17:59:50 +00:00
zurdi c5033d9967 refactor: enhance logging output with color formatting for improved readability 2025-05-08 17:59:01 +00:00