Skip to content

Commit

Permalink
Fix full Ubuntu map service in docker-compose.yml (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
hummeltech authored Mar 6, 2024
1 parent 7389b16 commit 5014494
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
4 changes: 4 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ services:
PGUSER: renderer
volumes:
- data:/data
- tile_data:/var/cache/renderd/tiles
- ./ubuntu/entrypoint.sh:/entrypoint.sh:ro
postgres:
env_file: .env
Expand All @@ -260,10 +261,13 @@ services:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: renderer
image: postgis/postgis
ports:
- 65432:5432
volumes:
- pgdata:/var/lib/postgresql/data
shm_size: 1gb

volumes:
data:
pgdata:
tile_data:
30 changes: 20 additions & 10 deletions docker/ubuntu/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ then

cd /data/style

python3 ./scripts/get-external-data.py -c /data/style/external-data.yml -D /data/style/data
python3 scripts/get-external-data.py -c /data/style/external-data.yml -D /data/style/data

./scripts/get-fonts.sh

mv fonts/* /usr/share/fonts/
scripts/get-fonts.sh

psql --host "${PGHOST}" --user "${PGUSER}" --dbname "${PGDATABASE}" --command "CREATE EXTENSION postgis;"
psql --host "${PGHOST}" --user "${PGUSER}" --dbname "${PGDATABASE}" --command "CREATE EXTENSION hstore;"
Expand All @@ -33,19 +31,31 @@ then

curl --location "${DOWNLOAD_PBF:-http://download.geofabrik.de/asia/vietnam-latest.osm.pbf}" --output /data/region.osm.pbf

osm2pgsql --host "${PGHOST}" --username "${PGUSER}" --database "${PGDATABASE}" --create --slim -G --hstore \
--tag-transform-script /data/style/openstreetmap-carto.lua \
osm2pgsql \
--create \
--database "${PGDATABASE}" \
--host "${PGHOST}" \
--hstore \
--number-processes "$(nproc)" \
--slim \
--tag-transform-script /data/style/openstreetmap-carto.lua \
--user "${PGUSER}" \
-G \
-S /data/style/openstreetmap-carto.style \
/data/region.osm.pbf

psql --host "${PGHOST}" --user "${PGUSER}" --dbname "${PGDATABASE}" --file /data/style/indexes.sql

carto /data/style/project.mml > /data/style/mapnik.xml
sed -i 's#/usr/share/renderd/example-map/mapnik.xml#/data/style/mapnik.xml#g' /etc/renderd.conf
sed -i 's/URI=/MAXZOOM=20\nMINZOOM=0\URI=/g' /etc/renderd.conf
sed -i 's/maxZoom: 12/maxZoom: 20/g' /usr/share/renderd/example-map/index.html
sed \
-e 's#/usr/share/renderd/example-map/mapnik.xml#/data/style/mapnik.xml#g' \
-e 's/URI=/MAXZOOM=20\nMINZOOM=0\nURI=/g' \
-e 's#font_dir=/usr/share/fonts#font_dir=/data/style/fonts#g' \
/etc/renderd.conf > /data/renderd.conf
fi

sed -i 's#/etc/renderd.conf#/data/renderd.conf#g' /etc/apache2/sites-enabled/renderd-example-map.conf
sed -i 's/maxZoom: 12/maxZoom: 20/g' /usr/share/renderd/example-map/index.html

apachectl -e debug -k start
renderd --foreground
renderd --config /data/renderd.conf --foreground

0 comments on commit 5014494

Please sign in to comment.