Skip to content

Added Kubernetes deployment yaml files #385

Added Kubernetes deployment yaml files

Added Kubernetes deployment yaml files #385

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
name: Build docker image
strategy:
matrix:
nominatim:
- version: "4.3"
- version: "4.4"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export image
uses: docker/build-push-action@v5
with:
context: ${{ matrix.nominatim.version }}
tags: nominatim:latest
outputs: type=docker,dest=/tmp/nominatim.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nominatim-${{ matrix.nominatim.version }}
path: /tmp/nominatim.tar
test:
name: Test docker image
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
nominatim:
- version: "4.3"
- version: "4.4"
test_scenario:
- name: Import with PBF_URL and update
commands: |-
# get the data from four days ago to make sure there really are updates to apply
four_days_ago=`date --date="4 days ago" +%y%m%d`
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-${four_days_ago}.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-p 8001:8080 \
--name nominatim \
nominatim &
./assert-non-empty-json "http://localhost:8001/search.php?q=avenue%20pasteur"
docker exec -i nominatim sudo -u nominatim nominatim replication --project-dir /nominatim --once
./assert-non-empty-json "http://localhost:8001/search.php?q=avenue%20pasteur"
- name: Import with volume mount
commands: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-v nominatim-data:/var/lib/postgresql/14/main \
-p 8002:8080 \
nominatim &
./assert-non-empty-json "http://localhost:8002/search.php?q=avenue%20pasteur"
- name: Import with bind-mount, container restart & update
commands: |-
# get the data from four days ago to make sure there really are updates to apply
four_days_ago=`date --date="4 days ago" +%y%m%d`
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-${four_days_ago}.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-v /tmp/nominatim-data:/var/lib/postgresql/14/main \
-p 8003:8080 \
--name nominatim \
nominatim &
./assert-non-empty-json "http://localhost:8003/search.php?q=avenue%20pasteur"
# Stop container
docker stop nominatim
# import to bind mount is done previously
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-${four_days_ago}.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-v /tmp/nominatim-data:/var/lib/postgresql/14/main \
-p 8004:8080 \
--name nominatim \
nominatim &
./assert-non-empty-json "http://localhost:8004/search.php?q=avenue%20pasteur"
docker exec -i nominatim sudo -u nominatim nominatim replication --project-dir /nominatim --once
./assert-non-empty-json "http://localhost:8004/search.php?q=avenue%20pasteur"
- name: UPDATE_MODE=once with volume
commands: |-
# get the data from four days ago to make sure there really are updates to apply
four_days_ago=`date --date="4 days ago" +%y%m%d`
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-${four_days_ago}.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e UPDATE_MODE=once \
-v nominatim-update-volume:/var/lib/postgresql/14/main \
-p 8004:8080 \
--name nominatim \
nominatim &
./assert-non-empty-json "http://localhost:8004/search.php?q=avenue%20pasteur"
echo -n "check replication log for Update completed. Count:"
docker exec nominatim /bin/bash -c 'tail -f /var/log/replication.log | grep -m 1 -c "Update completed."'
- name: UPDATE_MODE=continuous with bind-mount
commands: |-
# get the data from few days ago to make sure there really are updates to apply
days_ago=`date --date="4 days ago" +%y%m%d`
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-${days_ago}.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e UPDATE_MODE=continuous \
-v /tmp/nominatim-update-bindmount:/var/lib/postgresql/14/main \
-p 8004:8080 \
--name nominatim \
nominatim &
./assert-non-empty-json "http://localhost:8004/search.php?q=avenue%20pasteur"
echo -n "check replication log for Update completed. Count:"
docker exec nominatim /bin/bash -c 'tail -f /var/log/replication.log | grep -m 1 -c "Update completed."'
- name: Import full style
commands: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e IMPORT_STYLE=full \
-p 8005:8080 \
nominatim &
./assert-non-empty-json "http://localhost:8005/search.php?q=hotel%20de%20paris"
- name: Import admin style
commands: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e IMPORT_STYLE=admin \
-p 8006:8080 \
nominatim &
./assert-empty-json "http://localhost:8006/search.php?q=hotel%20de%20paris"
- name: Import with PBF_PATH
commands: |-
wget --cut-dirs=1 -nH -xP /tmp/data http://download.geofabrik.de/europe/monaco-latest.osm.pbf
docker run -i --rm \
-e PBF_PATH=/nominatim/data/monaco-latest.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-v nominatim7-data:/var/lib/postgresql/14/main \
-v /tmp/data:/nominatim/data \
-p 8007:8080 \
--name nominatim \
nominatim &
./assert-non-empty-json "http://localhost:8007/search.php?q=avenue%20pasteur"
- name: REPLICATION_URL is blank
commands: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-p 8008:8080 \
nominatim &
./assert-non-empty-json "http://localhost:8008/search.php?q=avenue%20pasteur"
- name: FREEZE
commands: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e FREEZE="true" \
-p 8009:8080 \
nominatim &
./assert-non-empty-json "http://localhost:8009/search.php?q=avenue%20pasteur"
- name: GB postcode import
commands: |-
docker run -i --rm \
-e PBF_URL=https://download.geofabrik.de/europe/great-britain/england/rutland-latest.osm.pbf \
-e IMPORT_GB_POSTCODES="true" \
-p 8010:8080 \
nominatim &
./assert-non-empty-json "http://localhost:8010/search.php?postalcode=LE15+8TX"
./assert-non-empty-json "http://localhost:8010/search.php?postalcode=PE9+3SY"
./assert-non-empty-json "http://localhost:8010/search.php?postalcode=PE9+4ES"
- name: REVERSE_ONLY
commands: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e REVERSE_ONLY="true" \
-p 8011:8080 \
nominatim &
./assert-reverse-only "http://localhost:8011/search.php?q=avenue%20pasteur"
./assert-non-empty-json "http://localhost:8011/reverse.php?lat=43.734&lon=7.42&format=jsonv2"
- name: Check for clean shutdown
commands: |-
docker run --detach --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-p 8009:8080 \
--name nominatim \
nominatim
./assert-non-empty-json "http://localhost:8009/search.php?q=avenue%20pasteur"
# Shutdown the container
docker stop -t 60 nominatim
# Verify that the exit code is zero
CONTAINER_EXIT_CODE=$(docker inspect nominatim --format='{{.State.ExitCode}}')
test "$CONTAINER_EXIT_CODE" -eq 0
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: nominatim-${{ matrix.nominatim.version }}
path: /tmp
- name: Load image
run: |
docker load --input /tmp/nominatim.tar
docker image ls -a
- name: Checkout
uses: actions/checkout@v4
# Excute the test scenario
- name: ${{ matrix.test_scenario.name }}
working-directory: .github/workflows
run: ${{ matrix.test_scenario.commands }}
publish:
name: Publish docker image
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
nominatim:
- version: "4.3"
- version: "4.4"
steps:
- name: Checkout
uses: actions/checkout@v4
# Compute the Docker tags and labels to apply to the built image
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# List of Docker images to use as base name for tags
images: |
mediagis/nominatim
# Disable generation of latest tag
flavor: |
latest=false
# Add simple tag with nominatim version + tag with custom date format
tags: |
type=raw,value=${{ matrix.nominatim.version }}
type=raw,value=${{ matrix.nominatim.version }}-{{date 'YYYY-MM-DDTHH-mm'}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'mediagis' }}
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.nominatim.version }}
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'mediagis' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}