Compare commits
1 Commits
master
...
310_fix_so
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
663dbff9e6 |
@ -1,32 +0,0 @@
|
|||||||
name: Build docker image
|
|
||||||
run-name: ${{ gitea.actor }} is runs ci pipeline
|
|
||||||
on: [ push ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: gitea.ref == 'refs/heads/master'
|
|
||||||
steps:
|
|
||||||
- uses: https://github.com/actions/checkout@v4
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: git.whimsoc.dev/${{gitea.repository_owner}}/openstreetmap-tile-server
|
|
||||||
username: ${{ gitea.repository_owner }}
|
|
||||||
password: ${{ secrets.PAT }}
|
|
||||||
# - name: Set up Docker Buildx
|
|
||||||
# uses: docker/setup-buildx-action@v3
|
|
||||||
# - name: Build and push Docker image
|
|
||||||
# uses: https://github.com/docker/build-push-action@v6
|
|
||||||
# with:
|
|
||||||
# context: .
|
|
||||||
# file: ./Dockerfile
|
|
||||||
# push: true
|
|
||||||
# tags: "git.whimsoc.dev/${{gitea.repository_owner}}/openstreetmap-tile-server:${{gitea.sha}},git.whimsoc.dev/${{gitea.repository_owner}}/openstreetmap-tile-server:latest"
|
|
||||||
- name: Build and push
|
|
||||||
run: |
|
|
||||||
TODAY=$(date +'%Y-%m-%d')
|
|
||||||
docker build -t git.whimsoc.dev/${{gitea.repository_owner}}/openstreetmap-tile-server:${TODAY} -t git.whimsoc.dev/${{gitea.repository_owner}}/openstreetmap-tile-server:latest .
|
|
||||||
docker push git.whimsoc.dev/${{gitea.repository_owner}}/openstreetmap-tile-server:${TODAY}
|
|
||||||
docker push git.whimsoc.dev/${{gitea.repository_owner}}/openstreetmap-tile-server:latest
|
|
||||||
|
|
||||||
8
.github/workflows/build-and-test.yaml
vendored
8
.github/workflows/build-and-test.yaml
vendored
@ -5,10 +5,10 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
tags:
|
tags:
|
||||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
- 'v*'
|
||||||
# pull_request:
|
pull_request:
|
||||||
# branches:
|
branches:
|
||||||
# - master
|
- master
|
||||||
|
|
||||||
# cancel outdated jobs for the same reference
|
# cancel outdated jobs for the same reference
|
||||||
concurrency:
|
concurrency:
|
||||||
|
|||||||
48
Dockerfile
48
Dockerfile
@ -1,17 +1,11 @@
|
|||||||
FROM ubuntu:22.04 AS compiler-common
|
FROM ubuntu:22.04 AS compiler-common
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV LANG C.UTF-8
|
|
||||||
ENV LC_ALL C.UTF-8
|
|
||||||
|
|
||||||
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 \
|
git-core \
|
||||||
wget curl \
|
ca-certificates \
|
||||||
git-core unzip unrar \
|
&& apt-get update
|
||||||
&& locale-gen $LANG && update-locale LANG=$LANG \
|
|
||||||
&& sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' \
|
|
||||||
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
|
|
||||||
&& apt-get update && apt-get -y upgrade
|
|
||||||
|
|
||||||
###########################################################################################################
|
###########################################################################################################
|
||||||
|
|
||||||
@ -37,7 +31,7 @@ RUN mkdir -p /home/renderer/src \
|
|||||||
|
|
||||||
###########################################################################################################
|
###########################################################################################################
|
||||||
|
|
||||||
FROM compiler-common AS final
|
FROM ubuntu:22.04 AS final
|
||||||
|
|
||||||
# Based on
|
# Based on
|
||||||
# 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/
|
||||||
@ -46,7 +40,6 @@ ENV AUTOVACUUM=on
|
|||||||
ENV UPDATES=disabled
|
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 15
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -70,9 +63,9 @@ RUN apt-get update \
|
|||||||
osm2pgsql \
|
osm2pgsql \
|
||||||
osmium-tool \
|
osmium-tool \
|
||||||
osmosis \
|
osmosis \
|
||||||
postgresql-$PG_VERSION \
|
postgresql-14 \
|
||||||
postgresql-$PG_VERSION-postgis-3 \
|
postgresql-14-postgis-3 \
|
||||||
postgresql-$PG_VERSION-postgis-3-scripts \
|
postgresql-14-postgis-3-scripts \
|
||||||
postgis \
|
postgis \
|
||||||
python-is-python3 \
|
python-is-python3 \
|
||||||
python3-mapnik \
|
python3-mapnik \
|
||||||
@ -82,7 +75,7 @@ RUN apt-get update \
|
|||||||
python3-pip \
|
python3-pip \
|
||||||
renderd \
|
renderd \
|
||||||
sudo \
|
sudo \
|
||||||
vim \
|
wget \
|
||||||
&& apt-get clean autoclean \
|
&& apt-get clean autoclean \
|
||||||
&& apt-get autoremove --yes \
|
&& apt-get autoremove --yes \
|
||||||
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
|
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
|
||||||
@ -102,26 +95,17 @@ RUN pip3 install \
|
|||||||
pyyaml
|
pyyaml
|
||||||
|
|
||||||
# Install carto for stylesheet
|
# Install carto for stylesheet
|
||||||
RUN npm install -g carto@1.2.0
|
RUN npm install -g carto@0.18.2
|
||||||
|
|
||||||
# Configure Apache
|
# Configure Apache
|
||||||
RUN echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" >> /etc/apache2/conf-available/mod_tile.conf \
|
RUN echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" >> /etc/apache2/conf-available/mod_tile.conf \
|
||||||
&& echo "LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so" >> /etc/apache2/conf-available/mod_headers.conf \
|
&& echo "LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so" >> /etc/apache2/conf-available/mod_headers.conf \
|
||||||
&& a2enconf mod_tile && a2enconf mod_headers
|
&& a2enconf mod_tile && a2enconf mod_headers
|
||||||
COPY apache.conf /etc/apache2/sites-available/000-default.conf
|
COPY apache.conf /etc/apache2/sites-available/000-default.conf
|
||||||
|
COPY leaflet-demo.html /var/www/html/index.html
|
||||||
RUN ln -sf /dev/stdout /var/log/apache2/access.log \
|
RUN ln -sf /dev/stdout /var/log/apache2/access.log \
|
||||||
&& ln -sf /dev/stderr /var/log/apache2/error.log
|
&& ln -sf /dev/stderr /var/log/apache2/error.log
|
||||||
|
|
||||||
# leaflet
|
|
||||||
COPY leaflet-demo.html /var/www/html/index.html
|
|
||||||
RUN cd /var/www/html/ \
|
|
||||||
&& wget https://github.com/Leaflet/Leaflet/releases/download/v1.8.0/leaflet.zip \
|
|
||||||
&& unzip leaflet.zip \
|
|
||||||
&& rm leaflet.zip
|
|
||||||
|
|
||||||
# Icon
|
|
||||||
RUN wget -O /var/www/html/favicon.ico https://www.openstreetmap.org/favicon.ico
|
|
||||||
|
|
||||||
# Copy update scripts
|
# Copy update scripts
|
||||||
COPY openstreetmap-tiles-update-expire.sh /usr/bin/
|
COPY openstreetmap-tiles-update-expire.sh /usr/bin/
|
||||||
RUN chmod +x /usr/bin/openstreetmap-tiles-update-expire.sh \
|
RUN chmod +x /usr/bin/openstreetmap-tiles-update-expire.sh \
|
||||||
@ -131,11 +115,11 @@ RUN chmod +x /usr/bin/openstreetmap-tiles-update-expire.sh \
|
|||||||
&& echo "* * * * * renderer openstreetmap-tiles-update-expire.sh\n" >> /etc/crontab
|
&& echo "* * * * * renderer openstreetmap-tiles-update-expire.sh\n" >> /etc/crontab
|
||||||
|
|
||||||
# Configure PosgtreSQL
|
# Configure PosgtreSQL
|
||||||
COPY postgresql.custom.conf.tmpl /etc/postgresql/$PG_VERSION/main/
|
COPY postgresql.custom.conf.tmpl /etc/postgresql/14/main/
|
||||||
RUN chown -R postgres:postgres /var/lib/postgresql \
|
RUN chown -R postgres:postgres /var/lib/postgresql \
|
||||||
&& chown postgres:postgres /etc/postgresql/$PG_VERSION/main/postgresql.custom.conf.tmpl \
|
&& chown postgres:postgres /etc/postgresql/14/main/postgresql.custom.conf.tmpl \
|
||||||
&& echo "host all all 0.0.0.0/0 scram-sha-256" >> /etc/postgresql/$PG_VERSION/main/pg_hba.conf \
|
&& echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/14/main/pg_hba.conf \
|
||||||
&& echo "host all all ::/0 scram-sha-256" >> /etc/postgresql/$PG_VERSION/main/pg_hba.conf
|
&& echo "host all all ::/0 md5" >> /etc/postgresql/14/main/pg_hba.conf
|
||||||
|
|
||||||
# Create volume directories
|
# Create volume directories
|
||||||
RUN mkdir -p /run/renderd/ \
|
RUN mkdir -p /run/renderd/ \
|
||||||
@ -145,10 +129,10 @@ RUN mkdir -p /run/renderd/ \
|
|||||||
&& chown -R renderer: /data/ \
|
&& chown -R renderer: /data/ \
|
||||||
&& chown -R renderer: /home/renderer/src/ \
|
&& chown -R renderer: /home/renderer/src/ \
|
||||||
&& chown -R renderer: /run/renderd \
|
&& chown -R renderer: /run/renderd \
|
||||||
&& mv /var/lib/postgresql/$PG_VERSION/main/ /data/database/postgres/ \
|
&& mv /var/lib/postgresql/14/main/ /data/database/postgres/ \
|
||||||
&& mv /var/cache/renderd/tiles/ /data/tiles/ \
|
&& mv /var/cache/renderd/tiles/ /data/tiles/ \
|
||||||
&& chown -R renderer: /data/tiles \
|
&& chown -R renderer: /data/tiles \
|
||||||
&& ln -s /data/database/postgres /var/lib/postgresql/$PG_VERSION/main \
|
&& ln -s /data/database/postgres /var/lib/postgresql/14/main \
|
||||||
&& ln -s /data/style /home/renderer/src/openstreetmap-carto \
|
&& ln -s /data/style /home/renderer/src/openstreetmap-carto \
|
||||||
&& ln -s /data/tiles /var/cache/renderd/tiles \
|
&& ln -s /data/tiles /var/cache/renderd/tiles \
|
||||||
;
|
;
|
||||||
|
|||||||
@ -67,10 +67,10 @@ By default the container will use openstreetmap-carto if it is not specified. Ho
|
|||||||
docker run \
|
docker run \
|
||||||
-e DOWNLOAD_PBF=https://download.geofabrik.de/europe/luxembourg-latest.osm.pbf \
|
-e DOWNLOAD_PBF=https://download.geofabrik.de/europe/luxembourg-latest.osm.pbf \
|
||||||
-e DOWNLOAD_POLY=https://download.geofabrik.de/europe/luxembourg.poly \
|
-e DOWNLOAD_POLY=https://download.geofabrik.de/europe/luxembourg.poly \
|
||||||
-e NAME_LUA=sample.lua \
|
-e NAME_LUA=sample.lua
|
||||||
-e NAME_STYLE=test.style \
|
-e NAME_STYLE=test.style
|
||||||
-e NAME_MML=project.mml \
|
-e NAME_MML=project.mml
|
||||||
-e NAME_SQL=test.sql \
|
-e NAME_SQL=test.sql
|
||||||
-v /home/user/openstreetmap-carto-modified:/data/style/ \
|
-v /home/user/openstreetmap-carto-modified:/data/style/ \
|
||||||
-v osm-data:/data/database/ \
|
-v osm-data:/data/database/ \
|
||||||
overv/openstreetmap-tile-server \
|
overv/openstreetmap-tile-server \
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
services:
|
|
||||||
map:
|
|
||||||
image: git.whimsoc.dev/hendrik/openstreetmap-tile-server:latest
|
|
||||||
environment:
|
|
||||||
- UPDATES=enabled
|
|
||||||
- MAX_INTERVAL_SECONDS=3600
|
|
||||||
- REPLICATION_URL=https://planet.openstreetmap.org/replication/hour/
|
|
||||||
- THREADS=10
|
|
||||||
- OSM2PGSQL_EXTRA_ARGS=-C 8196
|
|
||||||
- ALLOW_CORS=enabled
|
|
||||||
- TILESIZE=512
|
|
||||||
volumes:
|
|
||||||
- osm-data:/data/database/
|
|
||||||
- osm-tiles:/data/tiles/
|
|
||||||
- ./run.sh:/run.sh
|
|
||||||
ports:
|
|
||||||
- "8080:80"
|
|
||||||
command: "run"
|
|
||||||
shm_size: 2g
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
osm-tiles:
|
|
||||||
external: true
|
|
||||||
osm-data:
|
|
||||||
external: true
|
|
||||||
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
map:
|
||||||
|
image: overv/openstreetmap-tile-server
|
||||||
|
volumes:
|
||||||
|
- osm-data:/data/database/
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
command: "run"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
osm-data:
|
||||||
|
external: true
|
||||||
@ -6,8 +6,8 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<link rel="stylesheet" href="leaflet.css"/>
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin="" />
|
||||||
<script src="leaflet.js"></script>
|
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
html, body, #map {
|
html, body, #map {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# Suggested minimal settings from
|
# Suggested minimal settings from
|
||||||
# https://ircama.github.io/osm-carto-tutorials/tile-server-ubuntu/
|
# https://ircama.github.io/osm-carto-tutorials/tile-server-ubuntu/
|
||||||
|
|
||||||
shared_buffers = 1GB
|
shared_buffers = 128MB
|
||||||
min_wal_size = 1GB
|
min_wal_size = 1GB
|
||||||
# max_wal_size = 2GB # Overridden below
|
# max_wal_size = 2GB # Overridden below
|
||||||
maintenance_work_mem = 256MB
|
maintenance_work_mem = 256MB
|
||||||
@ -16,14 +16,10 @@ wal_buffers = 1024kB
|
|||||||
wal_writer_delay = 500ms
|
wal_writer_delay = 500ms
|
||||||
commit_delay = 10000
|
commit_delay = 10000
|
||||||
# checkpoint_segments = 60 # unrecognized in psql 10.7.1
|
# checkpoint_segments = 60 # unrecognized in psql 10.7.1
|
||||||
max_wal_size = 5GB
|
max_wal_size = 2880MB
|
||||||
random_page_cost = 1.1
|
random_page_cost = 1.1
|
||||||
track_activity_query_size = 16384
|
track_activity_query_size = 16384
|
||||||
autovacuum_vacuum_scale_factor = 0.05
|
autovacuum_vacuum_scale_factor = 0.05
|
||||||
autovacuum_analyze_scale_factor = 0.02
|
autovacuum_analyze_scale_factor = 0.02
|
||||||
|
|
||||||
checkpoint_timeout = 60min
|
|
||||||
wal_level = minimal
|
|
||||||
max_wal_senders = 0
|
|
||||||
|
|
||||||
listen_addresses = '*'
|
listen_addresses = '*'
|
||||||
|
|||||||
11
run.sh
11
run.sh
@ -3,9 +3,9 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
function createPostgresConfig() {
|
function createPostgresConfig() {
|
||||||
cp /etc/postgresql/$PG_VERSION/main/postgresql.custom.conf.tmpl /etc/postgresql/$PG_VERSION/main/conf.d/postgresql.custom.conf
|
cp /etc/postgresql/14/main/postgresql.custom.conf.tmpl /etc/postgresql/14/main/conf.d/postgresql.custom.conf
|
||||||
sudo -u postgres echo "autovacuum = $AUTOVACUUM" >> /etc/postgresql/$PG_VERSION/main/conf.d/postgresql.custom.conf
|
sudo -u postgres echo "autovacuum = $AUTOVACUUM" >> /etc/postgresql/14/main/conf.d/postgresql.custom.conf
|
||||||
cat /etc/postgresql/$PG_VERSION/main/conf.d/postgresql.custom.conf
|
cat /etc/postgresql/14/main/conf.d/postgresql.custom.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPostgresPassword() {
|
function setPostgresPassword() {
|
||||||
@ -46,7 +46,7 @@ if [ "$1" == "import" ]; then
|
|||||||
chown renderer: /data/database/
|
chown renderer: /data/database/
|
||||||
chown -R postgres: /var/lib/postgresql /data/database/postgres/
|
chown -R postgres: /var/lib/postgresql /data/database/postgres/
|
||||||
if [ ! -f /data/database/postgres/PG_VERSION ]; then
|
if [ ! -f /data/database/postgres/PG_VERSION ]; then
|
||||||
sudo -u postgres /usr/lib/postgresql/$PG_VERSION/bin/pg_ctl -D /data/database/postgres/ initdb -o "--locale C.UTF-8"
|
sudo -u postgres /usr/lib/postgresql/14/bin/pg_ctl -D /data/database/postgres/ initdb -o "--locale C.UTF-8"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialize PostgreSQL
|
# Initialize PostgreSQL
|
||||||
@ -169,7 +169,6 @@ 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
|
||||||
sed -i -E "s/TILESIZE=[0-9]+/TILESIZE=${TILESIZE:-256}/g" /etc/renderd.conf
|
|
||||||
|
|
||||||
# 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
|
||||||
@ -198,5 +197,3 @@ fi
|
|||||||
|
|
||||||
echo "invalid command"
|
echo "invalid command"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user