Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Upload Files via the WebUI. You can now drag-and-drop single files into an inbox. To upload whole albums, zip them on your host first (uploading of folders directly is not implemented, as it would require a secure context).
- New config option `gui.terminal.enabled` (default: true) [#254](https://github.com/pSpitzner/beets-flask/pull/224)
- You can now alternatively use `PUID` and `PGID` instead of `GROUP_ID` and `USER_ID` environment variables. Good for [yaml anchors](https://docs.docker.com/reference/compose-file/fragments/). [#260](https://github.com/pSpitzner/beets-flask/issues/260)
- Use an external redis server by setting the `REDIS_URL` environment variable. [#277](https://github.com/pSpitzner/beets-flask/pull/277)

### Fixed
- Missing library stats dont cause a crash on first launch anymore [#264](https://github.com/pSpitzner/beets-flask/issues/264)
Expand Down
8 changes: 6 additions & 2 deletions backend/beets_flask/redis.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import asyncio
import os
import time
from concurrent.futures import ThreadPoolExecutor

from redis import Redis
import redis
from rq import Queue
from rq.job import Job

# Setup redis connection
redis_conn = Redis()
if os.environ.get("REDIS_URL"):
redis_conn = redis.from_url(os.environ["REDIS_URL"])
else:
redis_conn = redis.Redis()

# Init our different queues
preview_queue = Queue("preview", connection=redis_conn, default_timeout=600)
Expand Down
4 changes: 3 additions & 1 deletion docker/entrypoints/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export PYTHONWARNINGS="ignore"
# running the server from inside the backend dir makes imports and redis easier
cd /repo/backend

redis-server --daemonize yes >/dev/null 2>&1
if [ -z "$REDIS_URL" ]; then
redis-server --daemonize yes >/dev/null 2>&1
fi

# blocking
python ./launch_db_init.py
Expand Down
20 changes: 20 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,26 @@ Default: `/config/beets-flask`

Should not be changed.

### `REDIS_URL`

Usually, a daemonised Redis server is started within the container. This can cause issues due to the expectation that only one process runs per container, or if you wish to run the beets-flask container with a read-only root filesystem, or want greater control over the persistence of the Redis database. The `REDIS_URL` environment variable makes beets-flask connect to an external Redis instead, ideally one running in another container.

Example: Add a Redis container to your `docker-compose.yaml`, and make beets-flask connect to it:

```yaml
services:
redis:
image: docker.io/library/redis:alpine
volumes:
- redis:/data
beets-flask:
...
environment:
...
REDIS_URL: "redis://redis:6379/"
volumes:
redis:
```

## Validation

Expand Down
Loading