You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `rq` executable is available after installing the `rq` library with `pip`. The `-u` flag gives it the Redis URL to connect to. The `emails` at the end is the name of the queue that it should consume from. Make sure it matches the name of the queue you defined in `resources/user.py`.
Then run a container, but instead of running the default entrypoint (defined by the `CMD` line in the `Dockerfile`), we'll tell it to run the `rq` program:
43
43
44
44
```bash
45
-
docker run -w /app rest-apis-flask-smorest-rq sh -c "rq worker -u rediss://red-caenka10:MnLsmrX7Mrh9sp@frankfurt-redis.render.com:6379 emails"
45
+
docker run -w /app rest-apis-flask-smorest-rq sh -c "rq worker -u <insert your Redis url here> emails"
46
46
```
47
47
48
-
:::info
49
-
Make sure to enter your own Redis connection string in that command!
50
-
:::
51
-
52
48
This ensures one of the [considerations](https://python-rq.org/docs/#considerations-for-jobs) that the `rq` documentation suggests: that the worker and the work generator (our API) share _exactly_ the same source code.
53
49
54
50
Run another Docker container for your API, and try to register!
@@ -68,7 +64,7 @@ docker run -p 5000:5000 rest-apis-flask-smorest-rq sh -c "flask run --host 0.0.0
68
64
<TabItemvalue="worker"label="Run the background worker">
69
65
70
66
```bash
71
-
docker run -w /app rest-apis-flask-smorest-rq sh -c "rq worker -u rediss://red-caenka10:MnLsmrX7Mrh9sp@frankfurt-redis.render.com:6379 emails"
67
+
docker run -w /app rest-apis-flask-smorest-rq sh -c "rq worker -u <insert your Redis url here> emails"
0 commit comments