Skip to content

Commit

Permalink
refactored the tileserver initialisation to be less error prawn
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed May 10, 2024
1 parent 02740a6 commit d000169
Show file tree
Hide file tree
Showing 11 changed files with 3,464 additions and 40 deletions.
3 changes: 0 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# tileserver
TILE_SPRITES_URL=https://raw.githubusercontent.com/maputnik/osm-liberty/gh-pages/sprites

# database
POSTGRES_PASSWORD=CHANGE_ME
POSTGRES_USER=navigatum
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
NavigaTUM is a tool developed by students for students, to help you get around at [TUM](https://tum.de).
Feel free to contribute, we are open to new people 😄.

_Note: Not all buildings in NavigaTUM are owned by TUM, but are instead being used by TUM departments._
> [!NOTE]
> Not all buildings in NavigaTUM are owned by TUM, but are instead being used by TUM departments.
Features/Roadmap:
## Features/Roadmap

- [x] 🗺️ Interactive/static maps to look up the position of rooms or buildings
- [x] 🔍 Fast and typo-tolerant search
- [x] 💾 Support for different room code formats as well as generic names
- [x] 🤖 All functionality is also available via an open and well documented API
- [x] 🗘 Automatically update the data from upstream datasources
- [ ] 🗨️ Allow sudents/staff to easily submit feedback and data patches
- [ ] 🗨️ Allow students/staff to easily submit feedback and data patches
- [ ] 🏫 Generate maps from CAD data sources
- [ ] 🚶🏻 Generate turn by turn navigation advice for navigating end to end

Expand All @@ -33,7 +34,7 @@ You can consume our API Documentation in two ways:

- Head over to [our Website](https://nav.tum.de/api) and look at the interactive documentation
- We also describe our API in an [OpenAPI 3.0](https://de.wikipedia.org/wiki/OpenAPI) compliant file.
You can find it [here](./openapi.yaml).
You can find it [here](openapi.yaml).
Using this Specification you can generate your own client to access the API in the language of your choice.
To do this head over to
the [Swagger Editor](https://editor.swagger.io/?url=https://raw.githubusercontent.com/TUM-Dev/navigatum/main/openapi.yaml)
Expand Down Expand Up @@ -84,11 +85,11 @@ ready-made docker images to run the server locally:
> Because we have a tileserver, running the following command is required once.
>
> ```bash
> docker run -it --rm -v navigatum_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"
> 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.dev.yml up --build
docker compose -f docker-compose.local.yml up --build
```
Else you can follow the steps in the [server documentation](server/README.md).
Expand Down
33 changes: 17 additions & 16 deletions docker-compose.dev.yml → docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,28 @@ services:
condition: service_healthy
main-api:
condition: service_healthy
feedback-api:
condition: service_healthy
# maps
tileserver-init-sprites:
image: alpine:latest
command: sh -c "mkdir -p /data/sprites/ && rm -f /data/sprites/* && wget -P /data/sprites ${TILE_SPRITES_URL}/osm-liberty.json ${TILE_SPRITES_URL}/[email protected] ${TILE_SPRITES_URL}/osm-liberty.png ${TILE_SPRITES_URL}/[email protected]"
volumes:
- tileserver-src:/data
tileserver-init-config:
image: alpine:latest
command: sh -c "apk update --no-progress --quiet && apk add rsync --no-progress --quiet && rsync /to_data/ /data/"
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
- ./deployment/k3s/files/:/to_data/:ro
depends_on:
tileserver-init-sprites:
condition: service_completed_successfully
- ./map/:/map/:ro
tileserver-srv-src: # needed for simpler initialisation of dev environments
image: nginx:1.26
restart: on-failure
Expand All @@ -40,8 +45,6 @@ services:
depends_on:
tileserver-init-config:
condition: service_completed_successfully
tileserver-init-sprites:
condition: service_completed_successfully
healthcheck:
test: service nginx status || exit 1
retries: 2
Expand All @@ -61,8 +64,6 @@ services:
depends_on:
tileserver-init-config:
condition: service_completed_successfully
tileserver-init-sprites:
condition: service_completed_successfully
# cdn
data:
restart: unless-stopped
Expand Down
23 changes: 9 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,19 @@ services:
main-api:
condition: service_healthy
# maps
tileserver-init-sprites:
image: alpine:latest
command: sh -c "mkdir -p /data/sprites/ && rm -f /data/sprites/* && wget -P /data/sprites ${TILE_SPRITES_URL}/osm-liberty.json ${TILE_SPRITES_URL}/[email protected] ${TILE_SPRITES_URL}/osm-liberty.png ${TILE_SPRITES_URL}/[email protected]"
volumes:
- tileserver-src:/data
tileserver-init-config:
image: alpine:latest
command: sh -c "apk update --no-progress --quiet && apk add rsync --no-progress --quiet && rsync /to_data/ /data/"
command:
- /bin/bash
- -c
- |
mkdir -p /data/sprites/
rm -f /data/*.json
rm -f /data/style/*
cp /map/sprites/* /data/sprites/
volumes:
- tileserver-src:/data
- ./deployment/k3s/files/:/to_data/:ro
depends_on:
tileserver-init-sprites:
condition: service_completed_successfully
- ./map/:/map/:ro
tileserver-srv-src: # needed for simpler initialisation of dev environments
image: nginx:1.26
restart: unless-stopped
Expand All @@ -56,8 +55,6 @@ services:
depends_on:
tileserver-init-config:
condition: service_completed_successfully
tileserver-init-sprites:
condition: service_completed_successfully
healthcheck:
test: service nginx status || exit 1
retries: 2
Expand Down Expand Up @@ -89,8 +86,6 @@ services:
depends_on:
tileserver-init-config:
condition: service_completed_successfully
tileserver-init-sprites:
condition: service_completed_successfully
# cdn
data:
image: ghcr.io/tum-dev/navigatum-data:main
Expand Down
12 changes: 11 additions & 1 deletion map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This may be one optimisation point in the future.
From the root of the repository, run:

```bash
docker compose -f docker-compose.dev.yml up --build
docker compose -f docker-compose.local.yml up --build
```

### Edit the style
Expand Down Expand Up @@ -80,3 +80,13 @@ docker run -it --rm -p 8888:8888 maputnik/editor
| Step 1 | Step 2 |
|------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| ![Where in Maputnik to click to import a style](/resources/documentation/maputnik-import1.png) | ![Where in Maputnik to click then to import a style](/resources/documentation/maputnik-import2.png) |

### Sprites

We get our sprites from [maputnik/osm-liberty](https://github.com/maputnik/osm-liberty) via

```
export TILE_SPRITES_URL=https://raw.githubusercontent.com/maputnik/osm-liberty/gh-pages/sprites
rm sprites/*
wget -P sprites ${TILE_SPRITES_URL}/osm-liberty.json ${TILE_SPRITES_URL}/[email protected] ${TILE_SPRITES_URL}/osm-liberty.png ${TILE_SPRITES_URL}/[email protected]
```
File renamed without changes.
Loading

0 comments on commit d000169

Please sign in to comment.