76 Commits

Author SHA1 Message Date
Michael Manganiello
c05593db14
fix: Support for assets when using custom ROMM_BASE_PATH
When using a custom ROMM_BASE_PATH, the symbolic links used by nginx to
serve assets were not being updated to point to the correct location,
and always used the default `/romm` base path.

This change introduces a fix in the `docker-entrypoint.sh` script, so
those symbolic links are updated to point to the correct location set by
the `ROMM_BASE_PATH` environment variable.

Fixes #1626.
2025-02-20 00:21:32 -03:00
Michael Manganiello
fbff92403f
feat: Allow configuring app port using ROMM_PORT environment variable
By using the `ROMM_PORT` environment variable, users can now configure
the port on which the application listens, which defaults to `8080`.
2025-02-19 01:02:25 -03:00
Michael Manganiello
f6be1a6df3
Merge pull request #1632 from rommapp/misc/nginx-templates
misc: Use nginx templates to allow for environment variable usage
2025-02-19 00:55:34 -03: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
Michael Manganiello
98254d50b8
misc: Use nginx templates to allow for environment variable usage
Using the `envsubst` command, we can replace environment variables in
the nginx template files. This allows for more flexibility when
configuring the nginx server.

The Docker image we use as base for Nginx does provide the
`20-envsubst-on-templates.sh` script that will replace environment
variables in the template files.

This change does not include any behavior change, but unblocks future
changes that require environment variables in the nginx configuration.
2025-02-18 22:36:51 -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
9997b69ff6
feat: Add support for _FILE suffix in environment variables
This change allows setting environment variables with a `_FILE` suffix,
which will be used to load the contents of the file specified in the
variable into the variable without the suffix.

For example, setting `ROMM_AUTH_SECRET_KEY_FILE=/run/secrets/romm_auth_secret_key`
and creating a file with the secret key at the specified path will set
`ROMM_AUTH_SECRET_KEY` to the contents of the file.

A common use case for this is to use secrets in Docker Compose [1], to
avoid exposing secrets in the `docker-compose.yml` or `env` files.

[1] https://docs.docker.com/compose/how-tos/use-secrets/
2024-12-08 20:05:06 -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
Georges-Antoine Assi
c8dc872a0d
remove from init script and use user docker attr 2024-03-24 23:23:10 -04:00
Georges-Antoine Assi
1c7621c4b2
Hotifx PUID/GUID changes in init script 2024-03-24 22:53:54 -04:00
Georges-Antoine Assi
f259e1b1d0
fix scanning after socketio upgrade 2024-03-18 09:47:15 -04:00
Georges-Antoine Assi
be553d5524 add shadow to set ownership 2024-03-18 02:53:27 +00:00
Georges-Antoine Assi
d073657365
Allow setting dynamic PUID/PGID 2024-03-17 19:56:25 -04:00
Georges-Antoine Assi
02f27ace40
disable built in redis if env set 2024-03-17 17:05:26 -04:00
Georges-Antoine Assi
e024fc987f bind redis data volume 2024-03-12 02:07:31 +00:00
Georges-Antoine Assi
a36d49979e
[WIP] build redis into container
expose port right
2024-03-01 10:36:02 -05:00
Georges-Antoine Assi
6bcadec702
everything we need for 3.0 2024-02-01 18:13:16 -05:00
Lukas Wingerberg
d4dfda20a3 fix comment 2023-11-02 10:58:05 +01:00
Lukas Wingerberg
51c67a4e5d dont start the watcher.py when we disable rescan on change 2023-11-02 10:53:52 +01:00
Lukas Wingerberg
97f633f608 fix rare case where a socket file could be lingering leading to stsartup errors on uvicorn 2023-11-02 10:18:27 +01:00
Lukas Wingerberg
9204cf3381
Update docker/init_scripts/init
Co-authored-by: Georges-Antoine Assi <GAntoine@users.noreply.github.com>
2023-11-01 09:47:47 +01:00
Lukas Wingerberg
b1ca77e327
Update docker/init_scripts/init
Co-authored-by: Georges-Antoine Assi <GAntoine@users.noreply.github.com>
2023-11-01 09:47:34 +01:00
Lukas Wingerberg
b2ebe36c28 add error_log function that exit 1's implicitely 2023-10-31 23:05:34 +01:00