Skip to content

Commit

Permalink
Merge branch 'main' into calendar-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm authored Jul 13, 2024
2 parents c4328e2 + 703d45c commit d6b5114
Show file tree
Hide file tree
Showing 21 changed files with 441 additions and 422 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
venv
__pycache__
.idea
*.pbf
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ You can consume our API Documentation in two ways:
the [Swagger Editor](https://editor.swagger.io/?url=https://raw.githubusercontent.com/TUM-Dev/navigatum/main/openapi.yaml)
or other similar [OpenAPI tools](https://openapi.tools/).

Note: The API is still under development, and we are open to Issues, Feature Requests or Pull Requests.
> [!NOTE]
> The API is still under development, and we are open to Issues, Feature Requests or Pull Requests.
## Getting started

Expand Down Expand Up @@ -81,17 +82,20 @@ If you want to work on the webclient only (and not server or data), you don't ne
You can instead either use the public API (see the [webclient documentation](webclient/README.md#Testing)) or use our
ready-made docker images to run the server locally:

> [!NOTE]
> Because we have a tileserver, running the following command is required once.
>
> ```bash
> docker run -it --rm -v tileserver-src:/data ubuntu:latest sh -c "apt -qq update && apt -qq install wget -y && wget --progress=bar:force:noscroll --timestamping --directory-prefix=/data --compression=auto --continue --tries=5 https://nav.tum.de/maps/vol/output.mbtiles"
> ```
```bash
docker compose -f docker-compose.local.yml up --build
```

> [!NOTE]
> While most of the setup is simple, we need to download data (only Oberbayern is needed) for the initial setup. This takes 1-2 minutes.
> Please first bring up a [postgis](https://postgis.net/) instance (for example via `docker compose -f docker-compose.local.yml up --build`) and then run:
>
> ```bash
> wget -O data.pbf https://download.geofabrik.de/europe/germany/bayern/oberbayern-latest.osm.pbf
> docker run -it -v $(pwd):/data -e PGPASSWORD=CHANGE_ME --network="host" iboates/osm2pgsql:latest osm2pgsql --create --slim --database postgres --user postgres --host 127.0.0.1 --port 5432 /data/data.pbf --hstore --hstore-add-index --hstore-column raw
> docker run -it -v $(pwd):/data -e PGPASSWORD=CHANGE_ME --network="host" iboates/osm2pgsql:latest replication init --database postgres --username postgres --host localhost --port 5432
> ```
Else you can follow the steps in the [server documentation](server/README.md).
### Webclient
Expand Down
2 changes: 1 addition & 1 deletion data/processors/tumonline.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def merge_tumonline_rooms(data: dict[str, dict[str, Any]]) -> None:
data[r_data["id"]].setdefault("sources", {}).setdefault("base", []).append(
{
"name": "TUMonline",
"url": f"https://campus.tum.de/tumonline/ee/ui/ca2/app/desktop/#/pl/ui/$ctx/{room.tumonline_id}",
"url": f"https://campus.tum.de/tumonline/ee/ui/ca2/app/desktop/#/pl/ui/$ctx/wbRaum.editRaum?pRaumNr={room.tumonline_id}",
},
)
if room.patched:
Expand Down
81 changes: 22 additions & 59 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,14 @@ services:
ports:
- "3000:3000"
environment:
NUXT_PUBLIC_MAPS_URL: http://tileserver:8080
NUXT_PUBLIC_MAPS_URL: https://nav.tum.de/maps
NUXT_PUBLIC_CDN_URL: http://data:3002
NUXT_PUBLIC_API_URL: http://main-api:3003
depends_on:
tileserver:
condition: service_healthy
data:
condition: service_healthy
main-api:
condition: service_healthy
# maps
tileserver-init-config:
image: alpine:latest
command:
- /bin/sh
- -c
- |
rm -f /data/*.json
cp /map/*.json /data/
rm -fr /data/sprites/
mkdir -p /data/sprites/
cp /map/sprites/* /data/sprites/
rm -fr /data/styles/
mkdir -p /data/styles/
cp /map/styles/* /data/styles/
mkdir -p /data/fonts/
volumes:
- tileserver-src:/data
- ./map/:/map/:ro
tileserver-srv-src: # needed for simpler initialisation of dev environments
image: nginx:1.27
restart: on-failure
volumes:
- tileserver-src:/usr/share/nginx/html/maps/vol:ro
depends_on:
tileserver-init-config:
condition: service_completed_successfully
healthcheck:
test: service nginx status || exit 1
retries: 2
interval: 10s
start_period: 10s
tileserver:
image: maptiler/tileserver-gl:v4.12.0
restart: unless-stopped
command: /usr/src/app/docker-entrypoint.sh --public_url=https://nav.tum.de/maps/
tmpfs:
- /tmp
volumes:
- tileserver-src:/data/
read_only: true
ports:
- "8080:8080"
depends_on:
tileserver-init-config:
condition: service_completed_successfully
# cdn
data:
restart: unless-stopped
Expand All @@ -81,7 +30,8 @@ services:
environment:
LOG_LEVEL: ${LOG_LEVEL-debug}
MIELI_URL: http://meilisearch:7700
TILESERVER_URL: http://tileserver:8080
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
TILESERVER_URL: https://nav.tum.de/maps
CDN_URL: http://data:3002/cdn
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
Expand All @@ -93,21 +43,38 @@ services:
JWT_KEY: ${JWT_KEY}
depends_on:
meilisearch:
condition: service_started
db:
condition: service_healthy
osm2pgsql:
image: iboates/osm2pgsql:latest
environment:
PGPASSWORD: ${POSTGRES_PASSWORD}
command:
- replication
- update
- --database ${POSTGRES_DB}
- --username ${POSTGRES_USER}
- --host db
- --port 5432
depends_on:
db:
condition: service_healthy
meilisearch:
image: getmeili/meilisearch:v1.9.0
restart: unless-stopped
ports:
- "7700:7700"
environment:
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
MEILI_ENV: development
healthcheck:
test: wget -q --spider http://localhost:7700/health
test: curl --fail http://localhost:7700/health || exit 1
retries: 5
interval: 10s
start_period: 10s
db:
image: postgres:16
image: postgis/postgis:16-3.4
restart: unless-stopped
environment:
PGDATA: /var/lib/postgresql/data/pgdata
Expand All @@ -121,7 +88,3 @@ services:
retries: 5
interval: 10s
start_period: 10s

volumes:
tileserver-src:
driver: local
24 changes: 21 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ services:
environment:
LOG_LEVEL: ${LOG_LEVEL-info}
MIELI_URL: http://meilisearch:7700
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
TILESERVER_URL: http://tileserver:8080
CDN_URL: http://data:3002/cdn
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
Expand All @@ -142,20 +143,37 @@ services:
condition: service_healthy
db:
condition: service_healthy
osm2pgsql:
image: iboates/osm2pgsql:latest
environment:
PGPASSWORD: ${POSTGRES_PASSWORD}
command:
- replication
- update
- --database ${POSTGRES_DB}
- --username ${POSTGRES_USER}
- --host db
- --port 5432
depends_on:
db:
condition: service_healthy
meilisearch:
image: getmeili/meilisearch:v1.9.0
restart: unless-stopped
networks:
- traefik_traefik
expose:
- "7700"
environment:
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
MEILI_ENV: production
healthcheck:
test: wget -q --spider http://localhost:7700/health
retries: 5
interval: 10s
start_period: 10s
db:
image: postgres:16
image: postgis/postgis:16-3.4
restart: unless-stopped
environment:
PGDATA: /var/lib/postgresql/data/pgdata
Expand All @@ -167,7 +185,7 @@ services:
expose:
- "5432"
volumes:
- postgres-data:/var/lib/postgresql/data
- postgis-data:/var/lib/postgresql/data
healthcheck:
test: [ "CMD", "pg_isready", "-U", "${POSTGRES_USER}" ]
retries: 5
Expand Down Expand Up @@ -200,7 +218,7 @@ services:
volumes:
tileserver-src:
driver: local
postgres-data:
postgis-data:
driver: local

networks:
Expand Down
15 changes: 12 additions & 3 deletions map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,26 @@ You can use it to edit the style and see the changes live.

> [!NOTE]
> Maputnik is not fully compatible with tileserver-gl
> Maputnik expects the data on an url, tileserver-gl expects it to be a file.
> For maputnik to accept the file, you need to do the following:
> Maputnik expects the data on urls, tileserver-gl expects it to be files.
> For maputnik to accept the files, you need to do the following:
```diff
"openmaptiles": {
"type": "vector",
- "url": "mbtiles://output.mbtiles"
+ "url": "http://localhost:7770/data/openmaptiles.json"
+ "url": "https://nav.tum.de/maps/data/openmaptiles.json"
},
```

```diff
},
- "sprite": "{style}",
- "glyphs": "{fontstack}/{range}.pbf",
+ "sprite": "https://nav.tum.de/maps/styles/osm-liberty/sprite",
+ "glyphs": "https://nav.tum.de/maps/fonts/{fontstack}/{range}.pbf",
"layers": [
```

To edit the style you thus need to run maputnik and tileserver-gl at the same time.
Change the style to the version maputnik expects.
You cannot preview the style in tileserver-gl, but you can see the changes in maputnik.
Expand Down
44 changes: 38 additions & 6 deletions map/styles/osm-liberty.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
"base": 1.5,
"stops": [
[
0,
0.6
4,
0.7
],
[
6,
0.1
0
]
]
}
Expand Down Expand Up @@ -3090,7 +3090,7 @@
"source": "openmaptiles",
"source-layer": "building",
"minzoom": 13,
"maxzoom": 14.5,
"maxzoom": 24,
"paint": {
"fill-color": "rgba(152, 198, 234, 1)",
"fill-outline-color": {
Expand All @@ -3115,9 +3115,22 @@
[
14,
1
],
[
14.5,
0
],
[
16.8,
0
],
[
17,
1
]
]
}
},
"fill-antialias": true
}
},
{
Expand All @@ -3126,6 +3139,7 @@
"source": "openmaptiles",
"source-layer": "building",
"minzoom": 13.5,
"maxzoom": 17.5,
"paint": {
"fill-extrusion-height": {
"property": "render_height",
Expand All @@ -3144,6 +3158,18 @@
[
14,
0.8
],
[
16.8,
0.8
],
[
17,
0.1
],
[
17.1,
0
]
]
},
Expand Down Expand Up @@ -3540,6 +3566,7 @@
"type": "symbol",
"source": "openmaptiles",
"source-layer": "transportation_name",
"maxzoom": 24,
"filter": [
"all"
],
Expand Down Expand Up @@ -3617,7 +3644,8 @@
],
"text-rotation-alignment": "viewport",
"text-size": 10,
"icon-size": 0.8
"icon-size": 0.8,
"visibility": "visible"
}
},
{
Expand Down Expand Up @@ -3827,6 +3855,7 @@
"type": "symbol",
"source": "openmaptiles",
"source-layer": "place",
"minzoom": 0,
"maxzoom": 6,
"filter": [
"all",
Expand Down Expand Up @@ -3866,6 +3895,7 @@
"type": "symbol",
"source": "openmaptiles",
"source-layer": "place",
"minzoom": 2.5,
"filter": [
"all",
[
Expand Down Expand Up @@ -3911,6 +3941,7 @@
"type": "symbol",
"source": "openmaptiles",
"source-layer": "place",
"minzoom": 2,
"filter": [
"all",
[
Expand Down Expand Up @@ -3956,6 +3987,7 @@
"type": "symbol",
"source": "openmaptiles",
"source-layer": "place",
"minzoom": 1,
"filter": [
"all",
[
Expand Down
Loading

0 comments on commit d6b5114

Please sign in to comment.