Commit Graph

78 Commits

Author SHA1 Message Date
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
zurdi
cac9602974 refactor: streamline logging setup and improve log formatting across multiple modules 2025-05-08 17:57:40 +00:00
zurdi
5bc820d3ee refactor: enhance logging and user agent mapping in nginx configuration for improved monitoring 2025-05-08 17:22:30 +00:00
zurdi
d5bb63c06f refactor: improve logging in redis_handler and init scripts for better debugging and process management 2025-05-08 16:34:23 +00:00
zurdi
0f1c29be73 refactor: enhance logging format in init script with color coding for better visibility 2025-05-08 14:17:03 +00:00
zurdi
c0f33545b1 refactor: enhance initialization script with improved logging and process management 2025-05-08 14:04:21 +00:00
zurdi
ad1cd9e0c6 refactor: replace info_debug with debug_log for consistency in logging 2025-05-08 11:31:46 +00:00
zurdi
5d1114b832 refactor: set default web concurrency to reduce resource usage 2025-05-08 10:44:58 +00:00
zurdi
82c265e7d3 refactor: update log messages for consistency and clarity 2025-05-08 10:40:08 +00:00
zurdi
3bd9382b12 refactor: enable scheduled tasks in scheduler and init scripts 2025-05-08 08:59:56 +00:00
Michael Manganiello
9602d58865 misc: Add support for WEB_CONCURRENCY environment variable
The `WEB_CONCURRENCY` environment variable is a more common way to
configure the number of workers for Gunicorn [1] or other web servers.

This change maintains `GUNICORN_WORKERS` compatibility, while notifying
users that it is deprecated and should be replaced with
`WEB_CONCURRENCY`.

It would also allow us to replace Gunicorn with another web server in
the future without changing the variable name.

[1] https://docs.gunicorn.org/en/stable/settings.html#workers
2025-02-19 00:31:34 -03:00
Georges-Antoine Assi
e5f7a0f335 fix trunk check issue in init script 2025-01-07 10:50:19 -05:00
Mikhail Vazhnov
f5bd75cced fix: Handle terminate signals in init script
`tini` does not wait for child processes to close, so all processes will be killed immediately. This is why the container stops so fast.

This fix makes the `init` script listen and handle terminate signals. It also ensures that child processes are shut down in reverse order with proper waiting for completion.
2024-12-27 01:02:19 +03:00
Michael Manganiello
66e5939b2b misc: Use bundled Valkey instead of Redis server
This change replaces the bundled Redis server with Valkey. No breaking
changes are introduced, as considered environment variables still
maintain the `REDIS_` prefix.

Fixes #925.
2024-09-22 13:27:18 -03:00
Michael Manganiello
27ba5a1159 fix: Set Gunicorn option forwarded-allow-ips
Currently, the `request.url_for` and `URLPath.make_absolute_url` methods
always build URLs with "http" scheme, even when the original requested
URL is using "https".

The reason for this is that Gunicorn does not allow IPs other than
127.0.0.1 to set secure headers by default. As regular RomM
installations don't know which frontend IPs will try to set security
headers in advance, we can disable this validation, and fix URL
building.

A simple way to test this change is to access any of the `feed` endpoints,
which generate URLs using the mentioned methods. Accessing the endpoint
using "https" scheme must generate "https" URLs.

Reference:
* https://github.com/encode/starlette/issues/538#issuecomment-2054013679
* https://docs.gunicorn.org/en/stable/settings.html#forwarded-allow-ips
2024-08-09 01:20:17 -03:00
Michael Manganiello
0daa708a05 misc: Simplify backend environment configuration in Docker image
This change moves the virtualenv creation in the `Dockerfile` to a
separate stage, to simplify isolating the process and reduce the need
for uninstalling build dependencies.

The approach is similar to the one explained in [1]. It relies on
building a virtualenv folder, and copying it in the final stage.
Changing the `PATH` environment variable makes the virtualenv usable by
default, without affecting the default Python installation.

Also, added Dockerfile arguments for Alpine, nginx, and Python versions,
as some of them are reused, and also simplifies testing new versions.

An extra side effect is that the image size for the final stage is
reduced from 315MB to 262MB.

[1] https://scribe.rip/@albertazzir/blazing-fast-python-docker-builds-with-poetry-a78a66f5aed0
2024-06-22 18:19:16 -03:00
Georges-Antoine Assi
c4ef4d92d2 run truck fixes 2024-05-31 19:00:04 -04:00
Georges-Antoine Assi
9b62641d55 Merge branch 'master' into trunk-io 2024-05-31 18:42:43 -04:00
Zurdi
44f10a560c Solve merge into release conflicts 2024-05-31 16:46:35 +02:00
Georges-Antoine Assi
ca1363a93c run chech 2024-05-23 10:14:04 -04:00
Georges-Antoine Assi
10479bdc9f run formatter 2024-05-23 10:06:43 -04:00
Georges-Antoine Assi
fcb34f9088 Merge branch 'master' into trunk-io 2024-05-23 10:06:13 -04:00
Georges-Antoine Assi
b2085f87a8 bunch of fixes for trunk 2024-05-21 17:10:11 -04:00
Georges-Antoine Assi
a7cf0d389a run trunk format on all files 2024-05-21 10:18:13 -04:00
Georges-Antoine Assi
66510c0327 Improve fetch times of platforms endpoint 2024-05-18 17:24:07 -04:00
Georges-Antoine Assi
07dc02aa6a typo 2024-04-28 13:27:00 +00:00
Georges-Antoine Assi
2baa5f2fec Merge branch 'gunicorn-socket-handling' of github.com:zurdi15/romm into gunicorn-socket-handling 2024-04-28 13:10:56 +00:00
Georges-Antoine Assi
f2f2b3b0cd clear leftover pid files 2024-04-28 09:10:10 -04:00
Georges-Antoine Assi
2407e83e1a only wait when creating nginx 2024-04-26 13:09:23 +00:00
Georges-Antoine Assi
f98bbf183e dont create the file manually 2024-04-26 13:05:51 +00:00
Georges-Antoine Assi
138b75c698 handle gunicorn socket creation manually 2024-04-26 08:53:31 -04:00
Georges-Antoine Assi
4863b80eb3 tweak startup text 2024-03-25 22:08:32 +00:00
Psych0D0g
072acb9fec only print patience log one 2024-03-25 23:03:23 +01:00
Psych0D0g
680f2b239d add a log line to ask for patience 2024-03-25 23:02:36 +01:00
Psych0D0g
a06ccb5324 move sleep to the beginning of our while true loop to save innocent CPUs from overheating in case of errornous behaviour 2024-03-25 22:52:10 +01:00
Psych0D0g
de6838df85 make gunicorn log access and error logs to stdout 2024-03-25 22:20:25 +01:00
Psych0D0g
22f8b6115e remove uvicorn function from init 2024-03-25 22:00:49 +01:00
Psych0D0g
dd428e0af9 switch to gunicorn for handling backend app 2024-03-25 21:56:31 +01:00
Psych0D0g
8f5536c69b switch to gunicorn for handling backend app 2024-03-25 21:56:19 +01:00
zurdi
208239b51b fixed REDIS_HOST check 2024-03-25 10:46:28 +01:00