Skip to content

Commit 074ec0e

Browse files
authored
Merge pull request #791 from OpenHistoricalMap/staging
Production release - ohmx update , planet-dump sequence number and planet-stats deploy
2 parents 0e21bbb + 1e490ab commit 074ec0e

21 files changed

Lines changed: 586 additions & 492 deletions
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build and Publish OHM Stats Dashboard
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "staging"
8+
workflow_dispatch:
9+
10+
env:
11+
DASHBOARD_REPO: danvk/ohm
12+
DASHBOARD_GITSHA: 58c9bca6894a76158242b2025bfcba29ada6ddd8
13+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
14+
15+
jobs:
16+
build:
17+
permissions:
18+
contents: read
19+
runs-on: ubuntu-latest
20+
steps:
21+
22+
- name: Cancel Previous Runs
23+
uses: styfle/cancel-workflow-action@0.13.0
24+
with:
25+
access_token: ${{ github.token }}
26+
27+
- name: Set environment variables - Staging
28+
if: github.ref == 'refs/heads/staging'
29+
uses: allenevans/set-env@v4.0.0
30+
with:
31+
CLOUDFLARE_PROJECT: ohm-planet-stats-dash-staging
32+
DASHBOARD_SERVER: https://s3.amazonaws.com/planet-staging.openhistoricalmap.org/planet-stats
33+
34+
- name: Set environment variables - Production
35+
if: github.ref == 'refs/heads/main'
36+
uses: allenevans/set-env@v4.0.0
37+
with:
38+
CLOUDFLARE_PROJECT: ohm-planet-stats-dash-production
39+
DASHBOARD_SERVER: https://s3.amazonaws.com/planet.openhistoricalmap.org/planet-stats
40+
41+
- name: Checkout dashboard repo
42+
uses: actions/checkout@v6
43+
with:
44+
repository: ${{ env.DASHBOARD_REPO }}
45+
ref: ${{ env.DASHBOARD_GITSHA }}
46+
path: ohm
47+
48+
- name: Prepare publish dir
49+
run: |
50+
mkdir -p site/dashboard
51+
cp ohm/index.html site/
52+
cp -r ohm/dashboard/. site/dashboard/
53+
sed -i "s|export const SERVER = .*;|export const SERVER = \"${DASHBOARD_SERVER}\";|" site/dashboard/metrics.js
54+
echo "SERVER set to:"; grep "export const SERVER" site/dashboard/metrics.js
55+
ls -la site site/dashboard
56+
57+
- name: Deploy to Cloudflare Pages
58+
uses: cloudflare/wrangler-action@v3
59+
with:
60+
apiToken: ${{ secrets.DEPLOY_CLOUDFLARE_PAGES_API_TOKEN }}
61+
accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }}
62+
command: pages deploy site --project-name=${{ env.CLOUDFLARE_PROJECT }} --branch=${{ github.ref_name }}

images/ohmx-adiff-builder/Dockerfile

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
1-
FROM ghcr.io/bdon/osmexpress:latest
1+
FROM ghcr.io/bdon/osmexpress:045a515132e91a3679ce3df27329937c9b8b221a
22

33
ENV PATH="/root/.cargo/bin:${PATH}"
44

5-
RUN apk add --no-cache python3 py3-pip git bash xmlstarlet curl aws-cli py3-lxml
5+
RUN apk add --no-cache python3 py3-pip git bash curl aws-cli py3-lxml make libxml2 libgcc
66

7-
RUN apk add --no-cache --virtual .build-deps build-base patch python3-dev make cmake zlib-dev expat-dev bzip2-dev boost-dev rust cargo && \
7+
RUN apk add --no-cache --virtual .build-deps \
8+
build-base patch python3-dev cmake zlib-dev expat-dev bzip2-dev boost-dev \
9+
capnproto-dev clang-dev libxml2-dev pkgconfig && \
810
\
911
pip install --break-system-packages osmx requests osmium && \
1012
\
11-
echo "--- Clonando y modificando osm-cli para OpenHistoricalMap ---" && \
13+
# Alpine's rust/cargo lag behind crate MSRVs (osmpbf/home now need rustc 1.88+),
14+
# so pull a current stable toolchain via rustup instead of the apk packages.
15+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
16+
| sh -s -- -y --profile minimal --default-toolchain stable && \
17+
export LIBCLANG_PATH=/usr/lib && \
18+
# musl defaults to static linking; bindgen's build script must dlopen
19+
# libclang, which a static binary can't do. Link dynamically instead.
20+
export RUSTFLAGS="-C target-feature=-crt-static" && \
21+
\
22+
echo "--- Build osm-cli (jake-low) with OpenHistoricalMap replication URLs ---" && \
1223
git clone https://github.com/jake-low/osm-cli.git /tmp/osm-cli && \
1324
cd /tmp/osm-cli && \
14-
echo "Cambiando URL en src/replication.rs" && \
1525
sed -i 's|https://planet.openstreetmap.org/replication/minute|https://s3.amazonaws.com/planet.openhistoricalmap.org/replication/minute|g' src/replication.rs && \
16-
echo "Cambiando URL en src/main.rs" && \
1726
sed -i 's|https://www.openstreetmap.org|https://www.openhistoricalmap.org|g' src/main.rs && \
18-
echo "Compilando osm-cli desde la fuente modificada..." && \
19-
cargo install --path . && \
20-
cd / && \
21-
rm -rf /tmp/osm-cli && \
27+
cargo install --root /usr/local --path . && \
28+
cd / && rm -rf /tmp/osm-cli && \
29+
\
30+
echo "--- Build osmx-rs (jake-low) for augmented-diff --split ---" && \
31+
cargo install --root /usr/local --git https://github.com/jake-low/osmx-rs.git osmx-rs && \
2232
\
23-
apk del .build-deps && \
24-
apk add make
33+
# Binaries now live in /usr/local/bin, so the whole toolchain can go.
34+
rustup self uninstall -y && \
35+
apk del .build-deps
2536

2637
RUN curl https://mise.jdx.dev/install.sh | sh
2738
ENV PATH="/root/.local/bin:${PATH}"
2839

2940
WORKDIR /app
3041

31-
# RUN echo "Update repo 08/08/2025"
32-
33-
RUN git clone https://github.com/OpenHistoricalMap/osmx-adiff-builder.git /app
34-
35-
COPY *.sh .
36-
COPY *.py .
42+
# Pipeline scripts come from OSMCha/osmx-adiff-builder (Rust path), customized
43+
# for OpenHistoricalMap and copied in directly instead of cloned.
44+
COPY scripts/*.sh scripts/*.py scripts/*.mk /app/
3745

3846
RUN chmod +x /app/*.sh && chmod +x /app/*.py
3947

images/ohmx-adiff-builder/config.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

images/ohmx-adiff-builder/functions.sh

Lines changed: 0 additions & 176 deletions
This file was deleted.

images/ohmx-adiff-builder/process_min_range.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
# Shared configuration. Sourced by start.sh and process_min_range.sh.
3+
export WORKDIR=${WORKDIR:-/data}
4+
5+
# Binaries: osmx (C++) for expand/update/query, osmx-rs (Rust) for augmented diffs.
6+
export OSMX_BIN=${OSMX_BIN:-osmx}
7+
export OSMX_RS_BIN=${OSMX_RS_BIN:-osmx-rs}
8+
9+
# Database
10+
export OSMX_DB_DIR=$WORKDIR/db
11+
export OSMX_DB_PATH=$OSMX_DB_DIR/osmx.db
12+
export PLANET_FILE_PATH=$WORKDIR/planet.osm.pbf
13+
14+
# Services
15+
export REPLICATION_URL="${REPLICATION_URL:-https://s3.amazonaws.com/planet.openhistoricalmap.org/replication/minute}"
16+
export API_URL=${API_URL:-https://api.openhistoricalmap.org}
17+
18+
# Working directories
19+
export SPLIT_ADIFFS_DIR=$WORKDIR/stage-data/split-adiffs # per-changeset fragments
20+
export CHANGESET_DIR=$WORKDIR/stage-data/changesets # merge.mk stamp files
21+
export BUCKET_DIR=$WORKDIR/stage-data/bucket-data # merged adiffs ready to upload
22+
export BAD_CHANGESETS_DIR=$WORKDIR/stage-data/bad_changesets
23+
24+
# Upload target: s3://$AWS_S3_BUCKET/$S3_PREFIX/<changeset>.adiff
25+
export S3_PREFIX=${S3_PREFIX:-ohm-augmented-diffs/changesets}
26+
27+
# Liveness (watchdog in start.sh + healthcheck.sh)
28+
export HEARTBEAT_DIR=${HEARTBEAT_DIR:-/tmp/heartbeat}
29+
export HEARTBEAT_STALE_SECONDS=${HEARTBEAT_STALE_SECONDS:-600}
30+
31+
# Kill one update.sh run if it exceeds this (must be < HEARTBEAT_STALE_SECONDS)
32+
export UPDATE_TIMEOUT=${UPDATE_TIMEOUT:-540}

0 commit comments

Comments
 (0)