From 101969f34279b1943a19ff49abc8706a2c9e826f Mon Sep 17 00:00:00 2001
From: Georg Krause <mail@georg-krause.net>
Date: Mon, 28 Nov 2022 11:25:25 +0100
Subject: [PATCH] WIP

---
 Dockerfile                    |  2 +-
 docker-compose.yml            |  2 +-
 funkwhale_network/settings.py | 13 +++++++------
 funkwhale_network/worker.py   |  1 +
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 4052c45..ce06ec8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,6 +15,6 @@ WORKDIR /app/
 COPY ./poetry.lock /app/
 COPY ./pyproject.toml /app/
 COPY ./funkwhale_network/ /app/funkwhale_network/
-RUN pip install .
+RUN pip install -e .
 
 EXPOSE 8000
diff --git a/docker-compose.yml b/docker-compose.yml
index 5222ea9..cf866f1 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -54,7 +54,7 @@ services:
 
   worker:
     restart: ${RESTART_POLICY-unless-stopped}
-    command: tail -f /dev/null #funkwhale-network worker start
+    command: arq funkwhale_network.worker.WorkerSettings
     image: funkwhale/network
     environment:
       - "DB_DSN=${DB_DSN-user=postgres password=postgres dbname=funkwhale_network host=db}"
diff --git a/funkwhale_network/settings.py b/funkwhale_network/settings.py
index d0869dd..9e6670e 100644
--- a/funkwhale_network/settings.py
+++ b/funkwhale_network/settings.py
@@ -1,4 +1,5 @@
 import environ
+from arq.connections import RedisSettings
 
 env = environ.Env()
 env_file = env("ENV_FILE", default=None)
@@ -22,9 +23,9 @@ from funkwhale_network import middlewares
 MIDDLEWARES = [middlewares.conn_middleware]
 PORT = env.int("APP_PORT", default=8000)
 GF_SERVER_ROOT_URL = env("GF_SERVER_ROOT_URL", default="/dashboards/")
-REDIS_CONFIG = {
-    "host": env("REDIS_HOST", default="localhost"),
-    "port": env.int("REDIS_PORT", default=6379),
-    "database": env.int("REDIS_DB", default=0),
-    "password": env("REDIS_PASSWORD", default=None),
-}
+REDIS_CONFIG = RedisSettings(
+    host=env("REDIS_HOST", default="localhost"),
+    port=env.int("REDIS_PORT", default=6379),
+    database=env.int("REDIS_DB", default=0),
+    password=env("REDIS_PASSWORD", default=None),
+)
diff --git a/funkwhale_network/worker.py b/funkwhale_network/worker.py
index 8a2cace..5cafe50 100644
--- a/funkwhale_network/worker.py
+++ b/funkwhale_network/worker.py
@@ -26,3 +26,4 @@ class WorkerSettings:
     max_concurrent_tasks = 20
     shutdown_delay = 5
     timeout_seconds = 15
+    redis_settings = settings.REDIS_CONFIG
-- 
GitLab