mirror of
https://github.com/rommapp/romm.git
synced 2026-10-12 02:21:58 +00:00
* fix(docker): boot when the container runs as a non-default UID Unraid runs the container as 99:100, which can't write to the image's /romm (owned by 1000, mode 755), only to the mounted subfolders. The PSP pending dir at /romm/cache/retroarch_sync was created at import time, so every gunicorn worker failed to boot. - Buffer pending PSP save files under the user's assets folder (assets/users/<user>/retroarch/psp_pending/), beside the other RetroArch Cloud Sync files and outside the client-reachable blob categories. - Move the zip and rom-converto download caches to /tmp/romm/cache, and point nginx's internal /cache/ alias there. - Put gunicorn's control socket in /tmp/gunicorn instead of $HOME/.gunicorn, since HOME is / for that UID. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(docker): honor ROMM_TMP_PATH for caches, explain an unwritable sync folder - The download caches live under $ROMM_TMP_PATH/cache when it's set, so installs with a small Docker disk (Unraid's docker.img) can point them at a share. The entrypoint exports the same path for nginx's /cache/ alias. - With ENABLE_SYNC_FOLDER_WATCHER on and /romm/sync not writable, /init warns and skips the watcher instead of dying on mkdir under errexit. - The compose example lists the /romm/sync mount the sync features need. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * test(sync): cover reading back and clearing buffered PSP files Addresses Greptile's review on #5189. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(sync): apply code-review findings to PSP pending buffer Remove the emptied psp_pending folder after a merge, define the sync folder path once in init, update the architecture doc's PSP and blob locations, and drop a stale .gitignore entry. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * refactor(sync): apply simplify findings to PSP pending cleanup Clear the buffered folder with remove_directory, let the startup check own creating the sync folder, and reword the test fixture docstring. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(sync): cap buffered PSP files and drop them on delete Buffered files for an unresolved save folder now count against the bundle limits, so a folder can't fill the assets share and then fail every merge once it resolves. A DELETE also removes the buffered copy, so a deleted file isn't merged back when the folder resolves. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(docker): check the sync folder for push-pull sync too ENABLE_SYNC_PUSH_PULL keeps SSH keys and device saves under /romm/sync as well, so an unwritable folder now disables it with the watcher and warns at boot instead of failing when the task runs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(docker): strip whitespace from env vars like the backend does The backend strips every variable it reads, while the init script and nginx templates used raw values, so a padded ROMM_TMP_PATH sent nginx's /cache/ alias somewhere the backend never writes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * chore(config): drop the CACHE_BASE_PATH comment Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs(docker): say which backend config strips env whitespace Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * revert(docker): drop the entrypoint env whitespace trimming Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(sync): apply pr-ready code-review findings Gate push-pull on its SSH keys path rather than a writable sync folder, accept the same truthy values as the backend, and clear only the merged PSP pending files so another worker's buffered file survives. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * refactor: apply pr-ready simplify findings Share one truthy pattern across init's flag checks (the watcher gates now accept the same values as the backend), disable gunicorn's unused control socket instead of placing it, derive the converts redirect from its own cache path, and factor the unknown PSP folder in tests. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs(docker): apply pr-ready humanizer pass to the sync mount note Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(fs): create handler base folders on first write, skip leftover temp files FSHandler no longer mkdirs its base path when constructed, so a module-level handler rooted at an unmounted or unwritable folder can't take down boot; every write path already creates its parent folders. Blob listings skip .romm_tmp_ files a crashed write left behind, so they are never merged into a PSP bundle or advertised in the sync manifest. The prefix now lives in one TEMP_FILE_PREFIX constant. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
82 lines
2.6 KiB
Bash
Executable File
82 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Load environment variables from variants with a _FILE suffix.
|
|
# The following logic reads variables with a _FILE suffix and
|
|
# loads the contents of the file specified in the variable
|
|
# into the variable without the suffix.
|
|
for var_name in $(printenv | cut -d= -f1 | grep "_FILE$" || true); do
|
|
# If variable is empty, skip.
|
|
if [[ -z ${!var_name} ]]; then
|
|
continue
|
|
fi
|
|
|
|
var_name_no_suffix=${var_name%"_FILE"}
|
|
|
|
# If the variable without the suffix is already set, raise an error.
|
|
if [[ -n ${!var_name_no_suffix} ]]; then
|
|
echo "ERROR: Both ${var_name_no_suffix} and ${var_name} are set (but are exclusive)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
file_path="${!var_name}"
|
|
|
|
# If file does not exist, raise an error.
|
|
if [[ ! -f ${file_path} ]]; then
|
|
echo "ERROR: File ${file_path} from ${var_name} does not exist" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Setting ${var_name_no_suffix} from ${var_name} at ${file_path}"
|
|
export "${var_name_no_suffix}"="$(cat "${file_path}")"
|
|
|
|
# Unset the _FILE variable.
|
|
unset "${var_name}"
|
|
done
|
|
|
|
# Set default values for environment variables used by nginx templates.
|
|
# Nginx uses `envsubst` to load environment variables into configuration files, but it does not
|
|
# support the default value syntax `${VAR:-default}`.
|
|
export ROMM_BASE_PATH=${ROMM_BASE_PATH:-/romm}
|
|
export ROMM_PORT=${ROMM_PORT:-8080}
|
|
# Matches CACHE_BASE_PATH in the backend config, for nginx's /cache/ alias.
|
|
export ROMM_CACHE_BASE_PATH="${ROMM_TMP_PATH:-/tmp/romm}/cache"
|
|
# Keep the nginx upstream port in sync with the port gunicorn binds to.
|
|
export DEV_PORT=${DEV_PORT:-5000}
|
|
|
|
# Disable nginx access logs when log level is WARNING, ERROR, or CRITICAL
|
|
loglevel="${LOGLEVEL:-INFO}"
|
|
loglevel="${loglevel^^}"
|
|
case "${loglevel}" in
|
|
WARNING | WARN | ERROR | CRITICAL)
|
|
export NGINX_ACCESS_LOG="access_log off;"
|
|
;;
|
|
*)
|
|
export NGINX_ACCESS_LOG=""
|
|
;;
|
|
esac
|
|
|
|
# Set IPV6_LISTEN based on IPV4_ONLY
|
|
if [[ ${IPV4_ONLY} == "true" ]]; then
|
|
export IPV6_LISTEN="#listen [::]:${ROMM_PORT};"
|
|
else
|
|
export IPV6_LISTEN="listen [::]:${ROMM_PORT};"
|
|
fi
|
|
|
|
# Replace environment variables used in nginx configuration templates.
|
|
/docker-entrypoint.d/20-envsubst-on-templates.sh >/dev/null
|
|
|
|
# Fix symbolic links used by nginx for resources,
|
|
# if they don't point to the correct location,
|
|
# set by the ROMM_BASE_PATH environment variable.
|
|
if [[ -L /var/www/html/assets/romm/resources ]]; then
|
|
target=$(readlink "/var/www/html/assets/romm/resources")
|
|
|
|
# If the target is not the same as ${ROMM_BASE_PATH}/resources, recreate the symbolic link.
|
|
if [[ ${target} != "${ROMM_BASE_PATH}/resources" ]]; then
|
|
rm "/var/www/html/assets/romm/resources"
|
|
ln -s "${ROMM_BASE_PATH}/resources" "/var/www/html/assets/romm/resources"
|
|
fi
|
|
fi
|
|
|
|
exec "$@"
|