Compare commits
10 Commits
c9922a5bbd
...
792af43640
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
792af43640 | ||
|
|
bf5a306aaa | ||
|
|
c10ea3cc8a | ||
|
|
0eedea3db2 | ||
|
|
6cbeaf33c2 | ||
|
|
eb15452d7e | ||
|
|
567d20fd64 | ||
|
|
d3d9770751 | ||
|
|
7a6bc139e4 | ||
|
|
b58dfa2a20 |
19
.github/workflows/build-and-test.yaml
vendored
19
.github/workflows/build-and-test.yaml
vendored
@@ -1,5 +1,4 @@
|
|||||||
name: Build and test image
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -17,7 +16,6 @@ concurrency:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE : ${{ github.repository_owner }}/openstreetmap-tile-server
|
IMAGE : ${{ github.repository_owner }}/openstreetmap-tile-server
|
||||||
TAG : ${{ github.sha }}
|
|
||||||
# Use docker.io for Docker Hub if empty
|
# Use docker.io for Docker Hub if empty
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
# github.repository as <account>/<repo>
|
# github.repository as <account>/<repo>
|
||||||
@@ -33,13 +31,11 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- arch : amd64
|
- arch : amd64
|
||||||
mode : build-and-test
|
|
||||||
runner : ubuntu-24.04
|
runner : ubuntu-24.04
|
||||||
- arch : arm64
|
- arch : arm64
|
||||||
variant : v8
|
variant : v8
|
||||||
mode : build-and-test
|
|
||||||
runner : ubuntu-24.04-arm
|
runner : ubuntu-24.04-arm
|
||||||
runs-on: ${{matrix.runner}}
|
runs-on: ${{ matrix.runner }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
env:
|
env:
|
||||||
@@ -70,7 +66,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
|
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
|
||||||
with:
|
with:
|
||||||
pull : true
|
pull : true
|
||||||
load : ${{ matrix.mode == 'build-and-test' }}
|
load : true
|
||||||
platforms : ${{ env.PLATFORM }}
|
platforms : ${{ env.PLATFORM }}
|
||||||
context : .
|
context : .
|
||||||
file : ./Dockerfile
|
file : ./Dockerfile
|
||||||
@@ -79,20 +75,17 @@ jobs:
|
|||||||
cache-to : type=gha,scope=${{ github.workflow }}:${{ env.PLATFORM }},mode=max
|
cache-to : type=gha,scope=${{ github.workflow }}:${{ env.PLATFORM }},mode=max
|
||||||
-
|
-
|
||||||
name: Import Luxembourg
|
name: Import Luxembourg
|
||||||
if : ${{ matrix.mode == 'build-and-test' }}
|
|
||||||
run : |
|
run : |
|
||||||
docker volume create ${VOLUME}
|
docker volume create ${VOLUME}
|
||||||
docker run --rm --shm-size=4GB -v ${VOLUME}:${MOUNT} -e UPDATES=enabled ${{ env.IMAGE }}:testbuild-${{ matrix.arch }} import
|
docker run --rm --shm-size=4GB -v ${VOLUME}:${MOUNT} -e UPDATES=enabled ${{ env.IMAGE }}:testbuild-${{ matrix.arch }} import
|
||||||
-
|
-
|
||||||
name: Start server
|
name: Start server
|
||||||
if : ${{ matrix.mode == 'build-and-test' }}
|
|
||||||
run : |
|
run : |
|
||||||
docker run --shm-size=4GB -v ${VOLUME}:${MOUNT} -e UPDATES=enabled -p 80:80 -d --name ${CONTAINER} ${{ env.IMAGE }}:testbuild-${{ matrix.arch }} run
|
docker run --shm-size=4GB -v ${VOLUME}:${MOUNT} -e UPDATES=enabled -p 80:80 -d --name ${CONTAINER} ${{ env.IMAGE }}:testbuild-${{ matrix.arch }} run
|
||||||
sleep 30
|
sleep 30
|
||||||
docker logs ${CONTAINER}
|
docker logs ${CONTAINER}
|
||||||
-
|
-
|
||||||
name: Download tiles
|
name: Download tiles
|
||||||
if : ${{ matrix.mode == 'build-and-test' }}
|
|
||||||
run : |
|
run : |
|
||||||
curl http://localhost/tile/0/0/0.png --fail -o 000.png
|
curl http://localhost/tile/0/0/0.png --fail -o 000.png
|
||||||
curl http://localhost/tile/1/0/0.png --fail -o 100.png
|
curl http://localhost/tile/1/0/0.png --fail -o 100.png
|
||||||
@@ -103,7 +96,6 @@ jobs:
|
|||||||
curl http://localhost/tile/18/135536/89345.png --fail -o example.png
|
curl http://localhost/tile/18/135536/89345.png --fail -o example.png
|
||||||
-
|
-
|
||||||
name: Verify tiles
|
name: Verify tiles
|
||||||
if : ${{ matrix.mode == 'build-and-test' }}
|
|
||||||
run : |
|
run : |
|
||||||
sha1sum *.png
|
sha1sum *.png
|
||||||
sha1sum --check <<EOF
|
sha1sum --check <<EOF
|
||||||
@@ -124,7 +116,6 @@ jobs:
|
|||||||
done
|
done
|
||||||
-
|
-
|
||||||
name: Cleanup
|
name: Cleanup
|
||||||
if : ${{ matrix.mode == 'build-and-test' }}
|
|
||||||
run : |
|
run : |
|
||||||
docker rm --force --volumes ${CONTAINER}
|
docker rm --force --volumes ${CONTAINER}
|
||||||
docker volume rm --force ${VOLUME}
|
docker volume rm --force ${VOLUME}
|
||||||
@@ -225,7 +216,7 @@ jobs:
|
|||||||
needs: deploy
|
needs: deploy
|
||||||
permissions:
|
permissions:
|
||||||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
||||||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
contents: write # for sbom-action artifact uploads
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
@@ -267,6 +258,6 @@ jobs:
|
|||||||
output-format: sarif
|
output-format: sarif
|
||||||
-
|
-
|
||||||
name: Upload Anchore scan SARIF report
|
name: Upload Anchore scan SARIF report
|
||||||
uses: github/codeql-action/upload-sarif@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.5
|
uses: github/codeql-action/upload-sarif@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.29.5
|
||||||
with:
|
with:
|
||||||
sarif_file: ${{ steps.scan.outputs.sarif }}
|
sarif_file: ${{ steps.scan.outputs.sarif }}
|
||||||
17
Dockerfile
17
Dockerfile
@@ -1,16 +1,16 @@
|
|||||||
FROM ubuntu:24.04@sha256:7c06e91f61fa88c08cc74f7e1b7c69ae24910d745357e0dfe1d2c0322aaf20f9 AS compiler-common
|
FROM debian:trixie AS compiler-common
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV LANG C.UTF-8
|
ENV LANG=C.UTF-8
|
||||||
ENV LC_ALL C.UTF-8
|
ENV LC_ALL=C.UTF-8
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ca-certificates gnupg lsb-release locales \
|
ca-certificates gnupg lsb-release locales \
|
||||||
wget curl \
|
wget curl \
|
||||||
git-core unzip unrar postgresql-common \
|
git-core unzip unrar-free postgresql-common \
|
||||||
&& locale-gen $LANG && update-locale LANG=$LANG \
|
&& locale-gen $LANG && update-locale LANG=$LANG \
|
||||||
&& /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -i -v 17\
|
&& /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -i -v 18 \
|
||||||
&& apt-get update && apt-get -y upgrade\
|
&& apt-get update && apt-get -y upgrade\
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
@@ -46,10 +46,10 @@ FROM compiler-common
|
|||||||
# https://switch2osm.org/serving-tiles/manually-building-a-tile-server-18-04-lts/
|
# https://switch2osm.org/serving-tiles/manually-building-a-tile-server-18-04-lts/
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV AUTOVACUUM=on
|
ENV AUTOVACUUM=on
|
||||||
ENV UPDATES=enabled
|
ENV UPDATES=disabled
|
||||||
ENV REPLICATION_URL=https://planet.openstreetmap.org/replication/hour/
|
ENV REPLICATION_URL=https://planet.openstreetmap.org/replication/hour/
|
||||||
ENV MAX_INTERVAL_SECONDS=3600
|
ENV MAX_INTERVAL_SECONDS=3600
|
||||||
ENV PG_VERSION 17
|
ENV PG_VERSION=18
|
||||||
|
|
||||||
RUN ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
|
RUN ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
|
||||||
|
|
||||||
@@ -84,6 +84,7 @@ RUN apt-get update \
|
|||||||
python3-shapely \
|
python3-shapely \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
renderd \
|
renderd \
|
||||||
|
libgoogle-perftools4 \
|
||||||
sudo \
|
sudo \
|
||||||
vim \
|
vim \
|
||||||
pipx \
|
pipx \
|
||||||
@@ -136,7 +137,7 @@ RUN chmod +x /usr/bin/openstreetmap-tiles-update-expire.sh \
|
|||||||
&& mkdir /var/log/tiles \
|
&& mkdir /var/log/tiles \
|
||||||
&& chmod a+rw /var/log/tiles \
|
&& chmod a+rw /var/log/tiles \
|
||||||
&& ln -s /home/renderer/src/mod_tile/osmosis-db_replag /usr/bin/osmosis-db_replag \
|
&& ln -s /home/renderer/src/mod_tile/osmosis-db_replag /usr/bin/osmosis-db_replag \
|
||||||
&& echo "* * * * * renderer openstreetmap-tiles-update-expire.sh\n" >> /etc/crontab
|
&& echo "* * * * * renderer openstreetmap-tiles-update-expire.sh" >> /etc/crontab
|
||||||
|
|
||||||
# Configure PosgtreSQL
|
# Configure PosgtreSQL
|
||||||
COPY postgresql.custom.conf.tmpl /etc/postgresql/$PG_VERSION/main/
|
COPY postgresql.custom.conf.tmpl /etc/postgresql/$PG_VERSION/main/
|
||||||
|
|||||||
@@ -14,5 +14,6 @@
|
|||||||
|
|
||||||
<IfDefine ALLOW_CORS>
|
<IfDefine ALLOW_CORS>
|
||||||
Header set Access-Control-Allow-Origin "*"
|
Header set Access-Control-Allow-Origin "*"
|
||||||
|
Header set Access-Control-Allow-Methods "GET, OPTIONS"
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
[renderd]
|
[renderd]
|
||||||
stats_file=/run/renderd/renderd.stats
|
stats_file=/run/renderd/renderd.stats
|
||||||
socketname=/run/renderd/renderd.sock
|
socketname=/run/renderd/renderd.sock
|
||||||
num_threads=4
|
num_threads=16
|
||||||
tile_dir=/var/cache/renderd/tiles
|
tile_dir=/var/cache/renderd/tiles
|
||||||
|
|
||||||
[mapnik]
|
[mapnik]
|
||||||
plugins_dir=/usr/lib/mapnik/3.1/input
|
plugins_dir=/usr/lib/x86_64-linux-gnu/mapnik/4.0/input
|
||||||
font_dir=/usr/share/fonts
|
font_dir=/usr/share/fonts
|
||||||
font_dir_recurse=true
|
font_dir_recurse=true
|
||||||
|
|
||||||
|
|||||||
18
run.sh
18
run.sh
@@ -116,14 +116,6 @@ if [ "$1" == "import" ]; then
|
|||||||
${OSM2PGSQL_EXTRA_ARGS:-} \
|
${OSM2PGSQL_EXTRA_ARGS:-} \
|
||||||
;
|
;
|
||||||
|
|
||||||
# clean up downloaded files
|
|
||||||
if [ -n "${DOWNLOAD_PBF:-}" ] && [ -f /data/region.osm.pbf ]; then
|
|
||||||
rm /data/region.osm.pbf
|
|
||||||
fi
|
|
||||||
if [ -n "${DOWNLOAD_POLY:-}" ] && [ -f /data/region.poly ]; then
|
|
||||||
rm /data/region.poly
|
|
||||||
fi
|
|
||||||
|
|
||||||
# old flat-nodes dir
|
# old flat-nodes dir
|
||||||
if [ -f /nodes/flat_nodes.bin ] && ! [ -f /data/database/flat_nodes.bin ]; then
|
if [ -f /nodes/flat_nodes.bin ] && ! [ -f /data/database/flat_nodes.bin ]; then
|
||||||
mv /nodes/flat_nodes.bin /data/database/flat_nodes.bin
|
mv /nodes/flat_nodes.bin /data/database/flat_nodes.bin
|
||||||
@@ -196,24 +188,28 @@ if [ "$1" == "run" ]; then
|
|||||||
# Configure renderd threads
|
# Configure renderd threads
|
||||||
sed -i -E "s/num_threads=[0-9]+/num_threads=${THREADS:-4}/g" /etc/renderd.conf
|
sed -i -E "s/num_threads=[0-9]+/num_threads=${THREADS:-4}/g" /etc/renderd.conf
|
||||||
|
|
||||||
|
cronPID=0
|
||||||
# start cron job to trigger consecutive updates
|
# start cron job to trigger consecutive updates
|
||||||
if [ "${UPDATES:-}" == "enabled" ] || [ "${UPDATES:-}" == "1" ]; then
|
if [ "${UPDATES:-}" == "enabled" ] || [ "${UPDATES:-}" == "1" ]; then
|
||||||
printenv > /etc/environment
|
printenv > /etc/environment
|
||||||
/etc/init.d/cron start
|
cron &
|
||||||
|
cronPID=$!
|
||||||
sudo -u renderer touch /var/log/tiles/run.log; tail -f /var/log/tiles/run.log >> /proc/1/fd/1 &
|
sudo -u renderer touch /var/log/tiles/run.log; tail -f /var/log/tiles/run.log >> /proc/1/fd/1 &
|
||||||
sudo -u renderer touch /var/log/tiles/osmosis.log; tail -f /var/log/tiles/osmosis.log >> /proc/1/fd/1 &
|
sudo -u renderer touch /var/log/tiles/osmosis.log; tail -f /var/log/tiles/osmosis.log >> /proc/1/fd/1 &
|
||||||
sudo -u renderer touch /var/log/tiles/expiry.log; tail -f /var/log/tiles/expiry.log >> /proc/1/fd/1 &
|
sudo -u renderer touch /var/log/tiles/expiry.log; tail -f /var/log/tiles/expiry.log >> /proc/1/fd/1 &
|
||||||
sudo -u renderer touch /var/log/tiles/osm2pgsql.log; tail -f /var/log/tiles/osm2pgsql.log >> /proc/1/fd/1 &
|
sudo -u renderer touch /var/log/tiles/osm2pgsql.log; tail -f /var/log/tiles/osm2pgsql.log >> /proc/1/fd/1 &
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run while handling docker stop's SIGTERM
|
# Run while handling docker stop's SIGTERM
|
||||||
stop_handler() {
|
stop_handler() {
|
||||||
kill -TERM "$child"
|
kill -TERM "$child"
|
||||||
|
if [ $cronPID -gt 0 ] ; then
|
||||||
|
kill -TERM "$cronPID"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
trap stop_handler SIGTERM
|
trap stop_handler SIGTERM
|
||||||
|
|
||||||
sudo -u renderer renderd -f -c /etc/renderd.conf &
|
sudo LD_PRELOAD=libtcmalloc.so.4 -u renderer renderd -f -c /etc/renderd.conf &
|
||||||
child=$!
|
child=$!
|
||||||
wait "$child"
|
wait "$child"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user