Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade martin #1440

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,17 +431,13 @@ jobs:
mkdir -p ~/.ssh
touch ~/.ssh/known_hosts
echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=" >> ~/.ssh/known_hosts
git clone [email protected]:urbica/martin.git ~/martin
git config advice.detachedHead false
git checkout ed14582a8f5c3e11bfb165f3b012edccd929b479
name: Checkout
git config --global advice.detachedHead false
git clone --depth 1 --branch v0.13.0 [email protected]:maplibre/martin.git ~/martin
name: Clone martin
- restore_cache:
keys:
- v1-cargo-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}
- prepare_workspace
- run:
command: cargo update openssl --precise 0.10.64
name: Update OpenSSL library due to failed compilation
- run:
command: |
cargo build --release --target x86_64-unknown-linux-gnu
Expand Down
10 changes: 3 additions & 7 deletions .circleci/src/jobs/build_martin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@ steps:
- run: apt update -y && apt install -y nodejs npm
- install_app_toolbelt
- run:
name: "Checkout"
name: "Clone martin"
command: |
mkdir -p ~/.ssh
touch ~/.ssh/known_hosts
echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=" >> ~/.ssh/known_hosts
git clone [email protected]:urbica/martin.git ~/martin
git config advice.detachedHead false
git checkout ed14582a8f5c3e11bfb165f3b012edccd929b479
git config --global advice.detachedHead false
git clone --depth 1 --branch v0.13.0 [email protected]:maplibre/martin.git ~/martin
- restore_cache:
keys:
- v1-cargo-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}
- prepare_workspace
- run:
name: "Update OpenSSL library due to failed compilation"
command: cargo update openssl --precise 0.10.64
- run:
name: "Build"
command: |
Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/resources/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ postgres:
user: postgres
password: postgres
map:
# baseUrl: https://tiles.entitlementcard.app/rpc/physical_stores/{z}/{x}/{y}.pbf
baseUrl: http://localhost:5002/rpc/physical_stores/{z}/{x}/{y}.pbf
# baseUrl: https://tiles.entitlementcard.app/physical_stores/{z}/{x}/{y}
baseUrl: http://localhost:5002/physical_stores/{z}/{x}/{y}
geocoding:
enabled: false
host: nominatim.maps.tuerantuer.org
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: "3.5"
services:
martin:
image: urbica/martin
command: martin --config /app/config.yaml
image: ghcr.io/maplibre/martin:v0.13.0
command: --config /app/config.yaml
volumes:
- ./docker/martin-config.yaml:/app/config.yaml
depends_on:
Expand Down Expand Up @@ -32,6 +32,7 @@ services:
- 127.0.0.1:5002:80
volumes:
- ./backend/ehrenamtskarte-maplibre-style:/usr/share/nginx/html
- ./docker/map.html:/usr/share/nginx/html/map.html
- ./docker/nginx-development.conf:/etc/nginx/conf.d/default.conf
depends_on:
- martin
Expand Down
17 changes: 13 additions & 4 deletions docker/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="utf-8"/>
<title>Display a map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/>
<script src="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css" rel="stylesheet"/>
<script crossorigin src="https://unpkg.com/maplibre-gl@4.2.0/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@4.2.0/dist/maplibre-gl.css" rel="stylesheet"/>
<style>
body {
margin: 0;
Expand All @@ -18,15 +18,24 @@
bottom: 0;
width: 100%;
}

body > button {
position: relative;
z-index: 1;
}
</style>
</head>
<body>
<div id="map"></div>
<button onclick="localStorage.setItem('style-url', BAYERN_URL); location.reload()">Switch to Bayern</button>
<button onclick="localStorage.setItem('style-url', NUERNBERG_URL); location.reload()">Switch to Nuernberg</button>
<script>
const BAYERN_URL = 'http://localhost:8000/project/bayern.ehrenamtskarte.app/map'
const NUERNBERG_URL = 'http://localhost:8000/project/nuernberg.sozialpass.app/map'
const styleUrl = localStorage.getItem("style-url") ?? BAYERN_URL
new maplibregl.Map({
container: 'map', // container id
//style: 'http://0.0.0.0:8000/project/bayern.ehrenamtskarte.app/map', // style URL
style: 'http://0.0.0.0:8000/project/nuernberg.sozialpass.app/map', // style URL
style: styleUrl, // style URL
center: [0, 0], // starting position [lng, lat]
zoom: 1 // starting zoom
});
Expand Down
43 changes: 20 additions & 23 deletions docker/martin-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
---
# Database connection string
connection_string: "postgres://postgres:postgres@db-postgis:5432/ehrenamtskarte"

# Connection keep alive timeout [default: 75]
keep_alive: 75

# The socket address to bind [default: 0.0.0.0:3000]
listen_addresses: "0.0.0.0:3000"

# Maximum connections pool size [default: 20]
pool_size: 20

# Enable watch mode
watch: false

# Trust invalid certificates. This introduces significant vulnerabilities, and should only be used as a last resort.
danger_accept_invalid_certs: false
listen_addresses: '0.0.0.0:3000'

# Number of web server workers
worker_processes: 8

function_sources:
physical_stores:
id: physical_stores
schema: public

function: physical_stores
# Amount of memory (in MB) to use for caching tiles [default: 512, 0 to disable]
# We disable it, as martin cannot flush its own cache (yet?), so the tiles would never be updated.
cache_size_mb: 0

# Database configuration. This can also be a list of PG configs.
postgres:
# Database connection string. You can use env vars too, for example:
# $DATABASE_URL
# ${DATABASE_URL:-postgresql://postgres@localhost/db}
connection_string: 'postgres://postgres:postgres@db-postgis:5432/ehrenamtskarte'

# Associative arrays of function sources
functions:
physical_stores:
schema: public
function: physical_stores
physical_stores_clustered:
schema: public
function: physical_stores_clustered
5 changes: 5 additions & 0 deletions docker/nginx-development.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ server {
try_files $uri /style.json;
}

# Rewrite for backward compatibility to accommodate for new Martin URL scheme
# See https://github.com/digitalfabrik/entitlementcard/issues/1439.
# Added in May 2024; this rewrite can be removed (roughly) in May 2025
rewrite ^\/rpc\/([^\/]+)\/([^\/]+)\/([^\/]+)\/([^\/]+)\.pbf(\?.*)?$ /$1/$2/$3/$4$5 break;

location ~ /(?<fwd_path>.*) {
proxy_set_header X-Rewrite-URL $request_uri;
proxy_set_header X-Forwarded-Host $host;
Expand Down