mirror of
https://github.com/rommapp/romm.git
synced 2026-06-30 07:45:52 +00:00
Merge pull request #685 from zurdi15/redis-data-volume-bind
Redis data volume bind
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -50,6 +50,7 @@ backend/romm_test/resources
|
||||
backend/romm_test/logs
|
||||
backend/romm_test/config
|
||||
.pytest_cache
|
||||
/romm_test
|
||||
|
||||
# service worker
|
||||
frontend/dev-dist
|
||||
|
||||
@@ -7,32 +7,27 @@ from tasks.update_switch_titledb import update_switch_titledb_task
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@protected_route(router.post, "/tasks", ["tasks.run"])
|
||||
async def run_tasks(request: Request, action: str) -> MessageResponse:
|
||||
@protected_route(router.post, "/tasks/run", ["tasks.run"])
|
||||
async def run_tasks(request: Request) -> MessageResponse:
|
||||
"""Run all tasks endpoint
|
||||
|
||||
Args:
|
||||
request (Request): Fastapi Request object
|
||||
action: Action to perform on tasks
|
||||
Returns:
|
||||
RunTasksResponse: Standard message response
|
||||
"""
|
||||
|
||||
if action == "run":
|
||||
await update_mame_xml_task.run()
|
||||
await update_switch_titledb_task.run()
|
||||
return {"msg": f"All tasks {action} successfully!"}
|
||||
|
||||
return {"msg": "No action performed on tasks"}
|
||||
await update_mame_xml_task.run()
|
||||
await update_switch_titledb_task.run()
|
||||
return {"msg": "All tasks ran successfully!"}
|
||||
|
||||
|
||||
@protected_route(router.post, "/tasks/{task}", ["tasks.run"])
|
||||
async def run_task(request: Request, task: str, action: str) -> MessageResponse:
|
||||
@protected_route(router.post, "/tasks/{task}/run", ["tasks.run"])
|
||||
async def run_task(request: Request, task: str) -> MessageResponse:
|
||||
"""Run all tasks endpoint
|
||||
|
||||
Args:
|
||||
request (Request): Fastapi Request object
|
||||
action: Action to perform on tasks
|
||||
Returns:
|
||||
RunTasksResponse: Standard message response
|
||||
"""
|
||||
@@ -42,8 +37,5 @@ async def run_task(request: Request, task: str, action: str) -> MessageResponse:
|
||||
"switch_titledb": update_switch_titledb_task
|
||||
}
|
||||
|
||||
if action == "run":
|
||||
await tasks[task].run()
|
||||
return {"msg": f"Task {task} {action} successfully!"}
|
||||
|
||||
return {"msg": "No action performed on task {task}"}
|
||||
await tasks[task].run()
|
||||
return {"msg": f"Task {task} run successfully!"}
|
||||
|
||||
@@ -122,9 +122,6 @@ RUN wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \
|
||||
redis-server --version; \
|
||||
echo '{"spdxVersion":"SPDX-2.3","SPDXID":"SPDXRef-DOCUMENT","name":"redis-server-sbom","packages":[{"name":"redis-server","versionInfo":"7.2.4","SPDXID":"SPDXRef-Package--redis-server","externalRefs":[{"referenceCategory":"PACKAGE-MANAGER","referenceType":"purl","referenceLocator":"pkg:generic/redis-server@7.2.4?os_name=alpine&os_version=3.19"}],"licenseDeclared":"BSD-3-Clause"}]}' > /usr/local/redis.spdx.json
|
||||
|
||||
RUN mkdir /redis-data && chown 1000:1000 /redis-data
|
||||
VOLUME /redis-data
|
||||
|
||||
# cleanup additional build dependencies
|
||||
RUN apk del \
|
||||
gcc \
|
||||
@@ -157,6 +154,10 @@ COPY --from=production-stage / /
|
||||
RUN addgroup -g 1000 -S romm && adduser -u 1000 -D -S -G romm romm
|
||||
RUN mkdir /romm && chown 1000:1000 /romm -R
|
||||
|
||||
# Create data volume for redis
|
||||
RUN mkdir /redis-data && chown 1000:1000 /redis-data
|
||||
VOLUME /redis-data
|
||||
|
||||
# Expose ports and start
|
||||
EXPOSE 8080
|
||||
EXPOSE 6379/tcp
|
||||
|
||||
@@ -63,7 +63,7 @@ start_bin_redis-server () {
|
||||
if [ -f /usr/local/etc/redis/redis.conf ]; then
|
||||
redis-server /usr/local/etc/redis/redis.conf &
|
||||
else
|
||||
redis-server &
|
||||
redis-server --dir /redis-data &
|
||||
fi
|
||||
REDIS_PID=$!
|
||||
echo $REDIS_PID > /tmp/redis-server.pid
|
||||
|
||||
@@ -21,6 +21,7 @@ services:
|
||||
- ROMM_AUTH_PASSWORD= # default: admin
|
||||
volumes:
|
||||
- romm_resources:/romm/resources # Resources fetched from IGDB (covers, screenshots, etc.)
|
||||
- romm_redis_data:/redis-data # Cached data for background tasks
|
||||
- /path/to/library:/romm/library # Your game library
|
||||
- /path/to/assets:/romm/assets # Uploaded saves, states, etc.
|
||||
- /path/to/config:/romm/config # [Optional] Path where config.yml is stored
|
||||
|
||||
Reference in New Issue
Block a user