diff --git a/backend/config/__init__.py b/backend/config/__init__.py index a703f8fed..e1a92eec6 100644 --- a/backend/config/__init__.py +++ b/backend/config/__init__.py @@ -28,6 +28,7 @@ DB_NAME: Final = os.environ.get("DB_NAME", "romm") # REDIS REDIS_HOST: Final = os.environ.get("REDIS_HOST", "127.0.0.1") REDIS_PORT: Final = os.environ.get("REDIS_PORT", 6379) +REDIS_PASSWORD: Final = os.environ.get("REDIS_PASSWORD") # IGDB IGDB_CLIENT_ID: Final = os.environ.get( diff --git a/backend/handler/redis_handler.py b/backend/handler/redis_handler.py index 1a5250cde..8d780fb6a 100644 --- a/backend/handler/redis_handler.py +++ b/backend/handler/redis_handler.py @@ -1,7 +1,7 @@ import sys from enum import Enum -from config import REDIS_HOST, REDIS_PORT +from config import REDIS_HOST, REDIS_PORT, REDIS_PASSWORD from logger.logger import log from redis import Redis from rq import Queue @@ -39,8 +39,8 @@ class FallbackCache: return repr(self) -redis_client = Redis(host=REDIS_HOST, port=REDIS_PORT, db=0) -redis_url = f"redis://{REDIS_HOST}:{REDIS_PORT}" +redis_client = Redis(host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWORD, db=0) +redis_url = f"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}" if REDIS_PASSWORD else f"redis://{REDIS_HOST}:{REDIS_PORT}" high_prio_queue = Queue(name=QueuePrio.HIGH.value, connection=redis_client) default_queue = Queue(name=QueuePrio.DEFAULT.value, connection=redis_client) @@ -54,6 +54,7 @@ else: cache = Redis( host=REDIS_HOST, port=REDIS_PORT, + password=REDIS_PASSWORD, db=0, decode_responses=True, ) diff --git a/docker/Dockerfile b/docker/Dockerfile index 954f15dcb..c907541ab 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -150,22 +150,20 @@ RUN rm -r \ /docker-entrypoint.sh \ /docker-entrypoint.d -# Move everything we prepared over to our final docker image -FROM scratch -COPY --from=production-stage / / - # User permissions RUN addgroup -g 1000 -S romm && adduser -u 1000 -D -S -G romm romm # Create the directories and set ownership and permissions RUN mkdir /romm /redis-data && \ - chown romm:romm /romm /redis-data && \ - chmod 777 /romm /redis-data + chown romm:romm /romm /redis-data /backend/handler/fixtures && \ + chmod -R 755 /romm /redis-data /backend/handler/fixtures -VOLUME /redis-data +# Move everything we prepared over to our final docker image +FROM scratch +COPY --from=production-stage / / -# Set user to run as -USER romm +# Declare the supported volumes +VOLUME ["/romm/resources", "/romm/library", "/romm/assets", "/romm/logs", "/romm/config", "/redis-data"] # Expose ports and start EXPOSE 8080 diff --git a/unraid_template/romm.xml b/unraid_template/romm.xml index f41d06ce5..a5d4d15c8 100644 --- a/unraid_template/romm.xml +++ b/unraid_template/romm.xml @@ -38,6 +38,9 @@ + + +