mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 11:32:38 +02:00
wip: make Redis service optional in Docker image
Co-authored-by: David Larlet <david@larlet.fr>
This commit is contained in:
parent
d72debdeb2
commit
023645a160
6 changed files with 44 additions and 32 deletions
|
@ -6,7 +6,6 @@ RUN apt-get update && \
|
|||
tini \
|
||||
sqlite3 \
|
||||
libpq-dev \
|
||||
redis-server \
|
||||
gdal-bin \
|
||||
&& \
|
||||
apt-get autoremove -y && \
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
services:
|
||||
|
||||
# Usefull only to use the real time collaboration
|
||||
redis:
|
||||
image: redis:latest
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
|
||||
interval: 1s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
command: ["redis-server"]
|
||||
|
||||
db:
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
|
||||
|
@ -14,7 +24,9 @@ services:
|
|||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
image: umap/umap:2.0.2
|
||||
redis:
|
||||
condition: service_healthy
|
||||
image: umap/umap:2.9.3
|
||||
ports:
|
||||
- "${PORT-8000}:8000"
|
||||
environment:
|
||||
|
@ -23,6 +35,8 @@ services:
|
|||
- SITE_URL=https://umap.local/
|
||||
- UMAP_ALLOW_ANONYMOUS=True
|
||||
- DEBUG=1
|
||||
- WEBSOCKET_ENABLED=1
|
||||
- REDIS_URL=redis://redis:6379
|
||||
volumes:
|
||||
- data:/srv/umap/uploads
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
set -eo pipefail
|
||||
|
||||
source /venv/bin/activate
|
||||
service redis-server start
|
||||
|
||||
# collect static files
|
||||
umap collectstatic --noinput
|
||||
|
@ -11,4 +10,4 @@ umap wait_for_database
|
|||
# then migrate the database
|
||||
umap migrate
|
||||
# run the server
|
||||
exec uvicorn --proxy-headers --no-access-log umap.asgi:application
|
||||
exec uvicorn --proxy-headers --no-access-log --host 0.0.0.0 umap.asgi:application
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
[uwsgi]
|
||||
http = :$(PORT)
|
||||
home = /venv
|
||||
module = umap.wsgi:application
|
||||
master = True
|
||||
vacuum = True
|
||||
max-requests = 5000
|
||||
processes = 4
|
||||
enable-threads = true
|
||||
static-map = /static=/srv/umap/static
|
||||
static-map = /uploads=/srv/umap/uploads
|
||||
buffer-size = 32768
|
||||
|
||||
; Run the websocket server only when the env variable
|
||||
; WEBSOCKET_ENABLED is set to True.
|
||||
; This is enough for the base docker image, but does not
|
||||
; take into account the settings as the source of truth.
|
||||
if-env = WEBSOCKET_ENABLED
|
||||
websocket_enabled = %(_)
|
||||
endif =
|
||||
|
||||
if-opt = websocket_enabled=True
|
||||
print = Starting the Websocket Server (WEBSOCKET_ENABLED=%(websocket_enabled))
|
||||
attach-daemon = umap run_websocket_server
|
||||
endif =
|
||||
lazy-apps = true
|
|
@ -14,7 +14,7 @@ services:
|
|||
|
||||
app:
|
||||
# Check https://hub.docker.com/r/umap/umap/tags to find the latest version
|
||||
image: umap/umap:2.0.2
|
||||
image: umap/umap:2.9.3
|
||||
ports:
|
||||
# modify the external port (8001, on the left) if desired, but make sure it matches SITE_URL, below
|
||||
- "8001:8000"
|
||||
|
@ -64,3 +64,29 @@ And run it with:
|
|||
```bash
|
||||
podman run -v ./umap.conf:/tmp/umap.conf -e UMAP_SETTINGS=/tmp/umap.conf -it --network host umap
|
||||
```
|
||||
|
||||
## Real time collaboration
|
||||
|
||||
To enable real time collaboration when using Docker, a Redis service must be added. Something like this in `docker-compose.py` world:
|
||||
|
||||
```yaml title="docker-compose.yml"
|
||||
services
|
||||
redis:
|
||||
image: redis:latest
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
|
||||
…
|
||||
command: ["redis-server"]
|
||||
…
|
||||
app:
|
||||
depends_on:
|
||||
…
|
||||
redis:
|
||||
condition: service_healthy
|
||||
…
|
||||
environment:
|
||||
- WEBSOCKET_ENABLED=1
|
||||
- REDIS_URL=redis://redis:6379
|
||||
…
|
||||
|
||||
```
|
||||
|
|
|
@ -346,4 +346,4 @@ WEBSOCKET_ENABLED = env.bool("WEBSOCKET_ENABLED", default=False)
|
|||
WEBSOCKET_BACK_HOST = env("WEBSOCKET_BACK_HOST", default="localhost")
|
||||
WEBSOCKET_BACK_PORT = env.int("WEBSOCKET_BACK_PORT", default=8001)
|
||||
|
||||
REDIS_URL = "redis://localhost:6379"
|
||||
REDIS_URL = env("REDIS_URL", default="redis://localhost:6379")
|
||||
|
|
Loading…
Reference in a new issue