diff --git a/deployment/k3s/files/rsyncd.conf b/deployment/k3s/files/rsyncd.conf new file mode 100644 index 000000000..ddff999bd --- /dev/null +++ b/deployment/k3s/files/rsyncd.conf @@ -0,0 +1,13 @@ +use chroot = true + +transfer logging = true +log file = /dev/stdout +log format = %h %o %f %l %b + +[maps] +comment = Public Share +path = /home/maps +read only = yes +list = yes +uid = nobody +gid = nogroup \ No newline at end of file diff --git a/deployment/k3s/templates/deployments/maps/maps-deployment.yaml b/deployment/k3s/templates/deployments/maps/maps-deployment.yaml index 4986a219d..f98131268 100644 --- a/deployment/k3s/templates/deployments/maps/maps-deployment.yaml +++ b/deployment/k3s/templates/deployments/maps/maps-deployment.yaml @@ -104,12 +104,19 @@ spec: failureThreshold: 6 periodSeconds: 10 - name: tileserver-src # serve tileserver-vol at /maps/vol/... - image: nginx:1.25 + image: alpine:18 imagePullPolicy: IfNotPresent + command: + - sh + - -c + - "apk add --no-cache rsync && rsync --daemon --no-detach --config=/etc/rsyncd.conf" ports: - - containerPort: 80 - name: http + - containerPort: 873 + name: rsync volumeMounts: - name: tileserver-vol - mountPath: /usr/share/nginx/html/maps/vol + mountPath: /home/maps/vol readOnly: true + - name: tileserver-config + mountPath: /etc/rsyncd.conf + subPath: rsyncd.conf diff --git a/deployment/k3s/templates/deployments/maps/tileserver-config.yaml b/deployment/k3s/templates/deployments/maps/tileserver-config.yaml index 80a80ff11..5fdc53caf 100644 --- a/deployment/k3s/templates/deployments/maps/tileserver-config.yaml +++ b/deployment/k3s/templates/deployments/maps/tileserver-config.yaml @@ -6,6 +6,8 @@ metadata: data: osm-liberty.json: |- {{ .Files.Get "files/maps/osm-liberty.json" | indent 4 }} + rsyncd.conf: |- +{{ .Files.Get "files/maps/rsyncd.conf" | indent 4 }} config.json: |- { "options": { diff --git a/deployment/k3s/templates/networking/ingress.yaml b/deployment/k3s/templates/networking/ingress.yaml index 0082e2417..e44ba5f72 100644 --- a/deployment/k3s/templates/networking/ingress.yaml +++ b/deployment/k3s/templates/networking/ingress.yaml @@ -28,7 +28,7 @@ spec: match: Host(`{{ $.Values.url }}`) && PathPrefix(`/maps/vol/`) services: - name: maps-svc - port: 7771 + port: 873 - kind: Rule match: Host(`{{ $.Values.url }}`) && PathPrefix(`/maps/`) services: diff --git a/deployment/k3s/templates/networking/service.yaml b/deployment/k3s/templates/networking/service.yaml index 869bd1bcf..c36ea024d 100644 --- a/deployment/k3s/templates/networking/service.yaml +++ b/deployment/k3s/templates/networking/service.yaml @@ -70,8 +70,8 @@ spec: port: 3001 targetPort: 8080 - name: src - port: 7771 - targetPort: 80 + port: 873 + targetPort: 873 --- apiVersion: v1 kind: Service diff --git a/docker-compose.yml b/docker-compose.yml index 9df89ec8a..f2ae10aa4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,7 @@ services: tileserver-init-src: image: alpine:latest restart: on-failure - command: wget -P /map --continue https://nav.tum.de/maps/vol/output.mbtiles + command: rsync --update --compress --progress --partial --human-readable --stats rsync://nav.tum.de/maps/vol/output.mbtiles /map/output.mbtiles volumes: - ./map:/map tileserver: @@ -58,6 +58,15 @@ services: condition: service_completed_successfully tileserver-init-src: condition: service_completed_successfully + tileserver-rsync-deamon-src: + image: alpine:3.18 + restart: always + command: sh -c "apk add --no-cache rsync && rsync --daemon --no-detach --config=/etc/rsyncd.conf" + volumes: + - ./deployment/k3s/files/rsyncd.conf:/etc/rsyncd.conf:ro + - ./map/output.mbtiles:/home/maps/vol/output.mbtiles:ro + ports: + - "873:873" # cdn data: image: ghcr.io/tum-dev/navigatum-cdn:latest