-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upstreaming some changes from @paulswartz fork (#11)
* feat: also deploy to the local GHCR repository * fix: stop the loop if the server crashes * feat: only build the graph on BUILDPLATFORM * feat: update APK packages * fix: pretend we have elevation to prevent downloads Even using `elevation: false` doesn't prevent the elevation download, so we need to pretend our PBF has the data already. * chore: update to 8.2.0 * fix: set acccess=yes if motor_vehicles=yes This works around a bug in ORS (GIScience/openrouteservice#704) where `access=no` overrides the more specific `motor_vehicles=yes`. Example way: https://www.openstreetmap.org/way/1111815406
- Loading branch information
1 parent
9fbe644
commit bf5fea4
Showing
5 changed files
with
85 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Deploy to GitHub Container Registry | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: ["main"] | ||
schedule: | ||
# Runs every Monday and Thursday at 15:39 UTC, which is either | ||
# 8:49 AM or 9:49 AM ET, depending on Daylight Savings Time. This | ||
# is two hours before the prod deploy, so we can see how dev is | ||
# doing before approving a prod deploy. | ||
- cron: "49 13 * * 1,4" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
PLATFORMS: linux/amd64,linux/arm64 | ||
TAG: ghcr.io/${{ github.repository_owner }}/ors:latest | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Log in to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
platforms: ${{ env.PLATFORMS }} | ||
tags: ${{ env.TAG }} | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: ${{ env.TAG }} | ||
trivy-config: trivy.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
ARG OPEN_ROUTE_SERVICE_VERSION=8.0.1 | ||
ARG OPEN_ROUTE_SERVICE_VERSION=8.2.0 | ||
|
||
FROM openrouteservice/openrouteservice:v${OPEN_ROUTE_SERVICE_VERSION} AS builder | ||
FROM --platform=$BUILDPLATFORM openrouteservice/openrouteservice:v${OPEN_ROUTE_SERVICE_VERSION} AS builder | ||
|
||
COPY preparation.sh /preparation.sh | ||
|
||
RUN wget http://download.geofabrik.de/north-america/us/massachusetts-latest.osm.pbf -O files/data.osm.pbf | ||
RUN <<EOT | ||
apk add osmctools --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing | ||
wget http://download.geofabrik.de/north-america/us/massachusetts-latest.osm.pbf -O files/data.osm.pbf | ||
EOT | ||
|
||
COPY preparation.sh /preparation.sh | ||
COPY ors-config.yml config/ors-config.yml | ||
|
||
COPY parameter-file /parameter-file | ||
RUN /preparation.sh | ||
|
||
FROM openrouteservice/openrouteservice:v${OPEN_ROUTE_SERVICE_VERSION} | ||
|
||
RUN apk upgrade --no-cache -f --purge | ||
|
||
COPY --from=builder /home/ors/graphs graphs | ||
COPY ors-config.yml config/ors-config.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--modify-tags= | ||
access=no and motor_vehicle=yes | ||
to | ||
=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
export REBUILD_GRAPHS=true | ||
export ors.engine.preparation_mode=true | ||
export ors.services.routing.mode=preparation | ||
export ORS_ENGINE_PREPARATION_MODE=true | ||
export ORS_SERVICES_ROUTING_MODE=preparation | ||
|
||
mv files/data.osm.pbf original.pbf | ||
osmconvert -v original.pbf --parameter-file=/parameter-file -o=files/data.osm.pbf | ||
rm original.pbf | ||
|
||
/entrypoint.sh & | ||
entrypoint_pid=$! | ||
|
||
# Wait for the server to become healthy... | ||
while ! wget --quiet -O /dev/null http://localhost:8082/ors/v2/health; do | ||
# Wait for the server to stop or become healthy... | ||
while kill -0 $entrypoint_pid >/dev/null && ! wget --quiet -O /dev/null http://localhost:8082/ors/v2/health; do | ||
sleep 5 | ||
done | ||
|
||
echo Built graph, stopping server... | ||
kill $entrypoint_pid | ||
kill $entrypoint_pid || true | ||
|
||
echo Checking that graphs were built... | ||
test -d graphs/car || exit 1 | ||
test -d graphs/hgv || exit 1 |