mirror of
https://github.com/umap-project/umap.git
synced 2025-05-05 22:11:50 +02:00
Merge d72debdeb2
into be83eddbd0
This commit is contained in:
commit
300da3ba74
5 changed files with 29 additions and 56 deletions
10
Dockerfile
10
Dockerfile
|
@ -1,12 +1,12 @@
|
||||||
# This part installs deps needed at runtime.
|
# This part installs deps needed at runtime.
|
||||||
FROM python:3.11-slim AS common
|
FROM python:3.11-slim AS runtime
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
tini \
|
tini \
|
||||||
uwsgi \
|
|
||||||
sqlite3 \
|
sqlite3 \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
|
redis-server \
|
||||||
gdal-bin \
|
gdal-bin \
|
||||||
&& \
|
&& \
|
||||||
apt-get autoremove -y && \
|
apt-get autoremove -y && \
|
||||||
|
@ -14,7 +14,7 @@ RUN apt-get update && \
|
||||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
# This part adds deps needed only at buildtime.
|
# This part adds deps needed only at buildtime.
|
||||||
FROM common AS build
|
FROM runtime AS build
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
@ -39,9 +39,9 @@ WORKDIR /srv/umap
|
||||||
|
|
||||||
COPY . /srv/umap
|
COPY . /srv/umap
|
||||||
|
|
||||||
RUN /venv/bin/pip install .[docker,s3]
|
RUN /venv/bin/pip install .[docker,s3,sync]
|
||||||
|
|
||||||
FROM common
|
FROM runtime
|
||||||
|
|
||||||
COPY --from=build /srv/umap/docker/ /srv/umap/docker/
|
COPY --from=build /srv/umap/docker/ /srv/umap/docker/
|
||||||
COPY --from=build /venv/ /venv/
|
COPY --from=build /venv/ /venv/
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
source /venv/bin/activate
|
source /venv/bin/activate
|
||||||
|
service redis-server start
|
||||||
|
|
||||||
# collect static files
|
# collect static files
|
||||||
umap collectstatic --noinput
|
umap collectstatic --noinput
|
||||||
|
@ -9,5 +10,5 @@ umap collectstatic --noinput
|
||||||
umap wait_for_database
|
umap wait_for_database
|
||||||
# then migrate the database
|
# then migrate the database
|
||||||
umap migrate
|
umap migrate
|
||||||
# run uWSGI
|
# run the server
|
||||||
exec uwsgi --ini docker/uwsgi.ini
|
exec uvicorn --proxy-headers --no-access-log umap.asgi:application
|
||||||
|
|
|
@ -354,52 +354,7 @@ Otherwise, use any valid [python-social-auth configuration](https://python-socia
|
||||||
|
|
||||||
#### WEBSOCKET_ENABLED
|
#### WEBSOCKET_ENABLED
|
||||||
|
|
||||||
A WebSocket server is packaged with uMap, and can be turned-on to activate
|
Setting `WEBSOCKET_ENABLED` to `True` will allow users to enable real-time collaboration.
|
||||||
"real-time collaboration". In practice, in order to enable it, a few settings
|
A switch will be available for them in the "advanced properties" of the map.
|
||||||
are exposed.
|
|
||||||
|
|
||||||
Setting `WEBSOCKET_ENABLED` to `True` will **not** enable real-time
|
See [the documentation about ASGI deployment](../deploy/asgi.md) for more information.
|
||||||
collaboration on all the maps served by the server. Instead, a switch will be
|
|
||||||
available in the "advanced properties" of the map.
|
|
||||||
|
|
||||||
The websocket server can be started with the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
umap run_websocket_server
|
|
||||||
```
|
|
||||||
|
|
||||||
And can take optional settings `--host` and `--port` (default values are defined in
|
|
||||||
the settings).
|
|
||||||
|
|
||||||
Configuration example:
|
|
||||||
|
|
||||||
```python
|
|
||||||
WEBSOCKET_ENABLED = True
|
|
||||||
WEBSOCKET_BACK_HOST = "localhost"
|
|
||||||
WEBSOCKET_BACK_PORT = 8002
|
|
||||||
WEBSOCKET_FRONT_URI = "ws://localhost:8002"
|
|
||||||
```
|
|
||||||
|
|
||||||
These settings can also be set with the (same names) environment variables.
|
|
||||||
|
|
||||||
#### WEBSOCKET_BACK_HOST
|
|
||||||
#### WEBSOCKET_BACK_PORT
|
|
||||||
|
|
||||||
The internal host and port the websocket server will connect to.
|
|
||||||
|
|
||||||
#### WEBSOCKET_FRONT_URI
|
|
||||||
|
|
||||||
The connection string that will be used by the client to connect to the
|
|
||||||
websocket server. In practice, as it's useful to put the WebSocket server behind
|
|
||||||
TLS encryption, the values defined by `WEBSOCKET_FRONT_URI` are different than
|
|
||||||
the values defined by `WEBSOCKET_BACK_PORT` and `WEBSOCKET_BACK_HOST`.
|
|
||||||
|
|
||||||
This value is comprised of three parts:
|
|
||||||
|
|
||||||
```
|
|
||||||
protocol://host:port
|
|
||||||
```
|
|
||||||
|
|
||||||
- `protocol`: can either be `ws` for plain unencrypted WebSockets, or `wss` when using TLS encryption.
|
|
||||||
- `host`: is the address where the connection will be sent. It should be public facing.
|
|
||||||
- `port`: is the port that is open on the host.
|
|
||||||
|
|
|
@ -48,3 +48,19 @@ User accounts can be managed via the Django admin page ({SITE_URL}/admin). The r
|
||||||
```bash
|
```bash
|
||||||
umap createsuperuser
|
umap createsuperuser
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Developping with Docker
|
||||||
|
|
||||||
|
If you want to develop with podman or docker, here are commands that might be useful, given that you have a postgreSQL server running locally and that your settings are located at `umap.conf`:
|
||||||
|
|
||||||
|
You can build the docker image with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
podman build -t umap .
|
||||||
|
```
|
||||||
|
|
||||||
|
And run it with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
podman run -v ./umap.conf:/tmp/umap.conf -e UMAP_SETTINGS=/tmp/umap.conf -it --network host umap
|
||||||
|
```
|
||||||
|
|
|
@ -65,7 +65,7 @@ test = [
|
||||||
"moto[s3]==5.1.1"
|
"moto[s3]==5.1.1"
|
||||||
]
|
]
|
||||||
docker = [
|
docker = [
|
||||||
"uwsgi==2.0.28",
|
"uvicorn==0.34.0",
|
||||||
]
|
]
|
||||||
s3 = [
|
s3 = [
|
||||||
"django-storages[s3]==1.14.5",
|
"django-storages[s3]==1.14.5",
|
||||||
|
@ -73,6 +73,7 @@ s3 = [
|
||||||
sync = [
|
sync = [
|
||||||
"pydantic==2.10.6",
|
"pydantic==2.10.6",
|
||||||
"redis==5.2.1",
|
"redis==5.2.1",
|
||||||
|
"websockets==15.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
|
|
Loading…
Reference in a new issue