diff --git a/README.rst b/README.rst index d664b44b..ec30083f 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ This software contains two main pieces: 2) ``renderd``: A daemon that renders map tiles using mapnik. .. figure:: ./screenshot.jpg - :alt: Image shoing example slippy map and OSM layer + :alt: Image showing example slippy map and OSM layer Together they efficiently render and serve raster map tiles for example to use within a slippy map. The two consist of the classic raster tile @@ -21,15 +21,22 @@ combination with ``mod_tile``. Dependencies ------------ -* `GNU/Linux` Operating System (works best on Debian or Ubuntu) -* `Apache 2 HTTP webserver `__ -* `Mapnik `__ -* `Cairo 2D graphics library `__ -* `Curl library (SSL variant) `__ -* `Iniparser library `__ -* `GLib library `__ -* `Memcached library (optional) `__ -* `RADOS library (optional) `__ +* `Supported Operating Systems` + * `GNU/Linux` (works best on Debian or Ubuntu) + * `FreeBSD` + * `macOS` +* `Supported Build Systems` + * `GNU Autotools `__ + * `CMake `__ +* `Runtime/Build Dependencies` + * `Apache 2 HTTP webserver `__ + * `Mapnik `__ + * `Cairo 2D graphics library `__ + * `Curl library (SSL variant) `__ + * `Iniparser library `__ + * `GLib library `__ + * `Memcached library (optional) `__ + * `RADOS library (optional) `__ Installation ------------ @@ -58,10 +65,12 @@ when using it on an operating system this is not being packaged for. We prepared instructions for you on how to build the software on the following distributions: -* `CentOS 7 `__ -* `Fedora 34 `__ -* `Ubuntu 20.04 `__ (this should work as well for Debian 10) -* `Debian 12 `__ +* `CentOS `__ +* `CentOS Stream `__ +* `Debian `__ +* `Fedora `__ +* `FreeBSD `__ +* `Ubuntu `__ Configuration ------------- @@ -72,47 +81,63 @@ example configuration files are distributed with the software packages and located in the ``etc`` directory of this repository. A very basic example-map and data can be found in the ``utils/example-map`` -directory. For a simple test copy it over to ``/var/www/example-map``. +directory. -Copy the configuration files to their place, too: +For a simple test copy it over to ``/usr/share/renderd/example-map``: :: - $ cp etc/renderd/renderd.conf /etc/renderd.conf - $ cp etc/apache2/renderd.conf /etc/apache2/conf-available/renderd.conf - $ cp etc/apache2/renderd-example-map.conf /etc/apache2/conf-available/renderd-example-map.conf + $ sudo mkdir -p /usr/share/renderd + $ sudo cp -av utils/example-map /usr/share/renderd/ -Enable the configuration: +Copy the apache configuration file to its place, too: :: - $ sudo a2enmod tile - $ sudo a2enconf renderd - $ sudo a2enconf renderd-example-map + $ sudo cp -av etc/apache2/renderd-example-map.conf /etc/apache2/sites-available/renderd-example-map.conf -Restart apache2: +Add a map configuration for example-map to ``/etc/renderd.conf`: :: - $ sudo a2enmod tile - $ sudo a2enconf renderd + $ printf ' + [example-map] + URI=/tiles/renderd-example + XML=/usr/share/renderd/example-map/mapnik.xml + ' | sudo tee -a /etc/renderd.conf +Start the rendering daemon + +:: -And run the rendering daemon + $ sudo renderd + +Enable the apache module and site: :: - $ renderd -f + $ sudo a2enmod tile + $ sudo a2ensite renderd-example-map + +Restart apache: + +:: + + $ sudo apache2ctl restart + +Now visit the renderd example map in your browser, e.g.: + +:: -Make sure the ``/var/cache/renderd/tiles`` directory is writable by -the user running the renderd process. + http://localhost/renderd-example-map -Try loading a tile in your browser, e.g. +Or try loading a single tile, e.g: :: - http://localhost/renderd-example/tiles/0/0/0.png + http://localhost:8081/tiles/renderd-example/0/0/0.png +*Note: the above commands and paths may differ based on your OS/distribution.* You may edit ``/etc/renderd.conf`` to indicate the location of different mapnik style sheets (up to ten) and the endpoints you wish to use to access diff --git a/docs/build/building_on_centos.md b/docs/build/building_on_centos.md new file mode 100644 index 00000000..52c9246d --- /dev/null +++ b/docs/build/building_on_centos.md @@ -0,0 +1,72 @@ +# Building on CentOS + +This document provides users with step-by-step instructions on how to compile and use`mod_tile` and `renderd`. + +Please see our [Continuous Integration script](/.github/workflows/build-and-test.yml) for more details. + +_CentOS does not provide a `mapnik`/`mapnik-devel` package, so it will first need to be built & installed, which is beyond the scope of this document, please visit the project's [installation document on GitHub](https://github.com/mapnik/mapnik/blob/master/INSTALL.md) or our [Continuous Integration script](/.github/actions/dependencies/build-and-install/mapnik/action.yml) for more information._ + +## CentOS 7 +```shell +#!/usr/bin/env bash + +# Update installed packages +sudo yum --assumeyes update + +# Install build dependencies +# (libmemcached-devel & librados2-devel are optional) +sudo yum --assumeyes install epel-release +sudo yum --assumeyes --setopt=install_weak_deps=False install \ + boost169-devel \ + cairo-devel \ + cmake3 \ + gcc \ + gcc-c++ \ + gdal \ + git \ + glib2-devel \ + harfbuzz-devel \ + httpd-devel \ + iniparser-devel \ + libcurl-devel \ + libicu-devel \ + libjpeg \ + libmemcached-devel \ + librados2-devel \ + libtiff \ + libwebp \ + make \ + proj + +# Download, Build, Test & Install `mod_tile` +export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) +rm -rf /tmp/mod_tile_src /tmp/mod_tile_build +mkdir /tmp/mod_tile_src /tmp/mod_tile_build +cd /tmp/mod_tile_src +git clone --depth 1 https://github.com/openstreetmap/mod_tile.git . +cd /tmp/mod_tile_build +cmake3 -B . -S /tmp/mod_tile_src \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DCMAKE_CXX_FLAGS:STRING="-I/usr/include/boost169" \ + -DCMAKE_C_FLAGS:STRING="-I/usr/include/boost169" \ + -DENABLE_TESTS:BOOL=ON +cmake3 --build . +ctest3 +sudo cmake --install . --prefix /usr --strip + +# Create /usr/share/renderd directory +sudo mkdir --parents /usr/share/renderd + +# Copy files of example map +sudo cp -av /tmp/mod_tile_src/utils/example-map /usr/share/renderd/example-map + +# Add configuration +sudo cp -av /tmp/mod_tile_src/etc/apache2/renderd-example-map.conf /etc/httpd/conf.d/renderd-example-map.conf +printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' | sudo tee -a /etc/renderd.conf + +# Start services +sudo httpd +sudo renderd -f +``` + +Then you can visit: `http://localhost:8081/renderd-example-map` diff --git a/docs/build/building_on_centos_7.md b/docs/build/building_on_centos_7.md deleted file mode 100644 index e8e0bd8a..00000000 --- a/docs/build/building_on_centos_7.md +++ /dev/null @@ -1,116 +0,0 @@ -# Building on CentOS 7 - -This documents step by step on how to compile and put into use the software `mod_tile` and `renderd`. -Please see our [Continous Integration script](../../.github/workflows/build-and-test-centos-7.yml) for more detail. - -As `CentOS 7` does not provide any `mapnik`/`mapnik-devel` packages in the official repository (nor are any available from `EPEL`,) it must therefore be built and installed before `mod_tile` can be built. Although `boost-devel` is present in the official repository, the version available there (`1.53.0`) is not in [mapnik's recommended dependency list](https://github.com/mapnik/mapnik/blob/v3.0.24/INSTALL.md#depends), so the `boost169-devel` package from `EPEL` should probably be used instead. - -```shell -#!/usr/bin/env bash -export LD_LIBRARY_PATH=/usr/local/lib -export MAPNIK_VERSION=3.0.24 - -# Install `EPEL` yum repository -sudo yum --assumeyes install epel-release - -# Update installed packages -sudo yum --assumeyes update - -# Install "Development Tools" group -sudo yum --assumeyes groups install \ - "Development Tools" - -# Install build dependencies -sudo yum --assumeyes install \ - boost169-devel \ - cairo-devel \ - freetype-devel \ - gdal-devel \ - glib2-devel \ - harfbuzz-devel \ - httpd-devel \ - iniparser-devel \ - libcurl-devel \ - libicu-devel \ - libjpeg-turbo-devel \ - libmemcached-devel \ - libpng-devel \ - librados2-devel \ - libtiff-devel \ - libwebp-devel \ - libxml2-devel \ - postgresql-devel \ - proj-devel \ - sqlite-devel \ - zlib-devel - -# Export `GDAL_DATA` & `PROJ_LIB` variables and create directories (if needed) -export GDAL_DATA=$(gdal-config --datadir) -export PROJ_LIB=/usr/share/proj -sudo --preserve-env mkdir -p ${GDAL_DATA} ${PROJ_LIB} - -# Download, Build & Install `Mapnik` -sudo mkdir -p /usr/local/src/mapnik-${MAPNIK_VERSION} -cd /usr/local/src/mapnik-${MAPNIK_VERSION} -sudo curl --silent --location https://github.com/mapnik/mapnik/releases/download/v${MAPNIK_VERSION}/mapnik-v${MAPNIK_VERSION}.tar.bz2 \ - | sudo tar --verbose --extract --bzip2 --strip-components=1 --file=- -sudo --preserve-env ./configure BOOST_INCLUDES=/usr/include/boost169 BOOST_LIBS=/usr/lib64/boost169 -sudo --preserve-env JOBS=$(nproc) make -sudo --preserve-env make install - -# Fix issue with `iniparser.h` from `iniparser-devel` not being in the expected location -sudo mkdir /usr/include/iniparser -sudo ln -s /usr/include/iniparser.h /usr/include/iniparser/iniparser.h - -# Download and build -sudo git clone https://github.com/openstreetmap/mod_tile.git /usr/local/src/mod_tile -cd /usr/local/src/mod_tile -sudo --preserve-env ./autogen.sh -sudo --preserve-env ./configure -sudo --preserve-env make - -# Create tiles directory -sudo mkdir --parents /run/renderd /var/cache/renderd/tiles - -# Move files of example map -sudo cp -r "utils/example-map" /var/www/example-map - -# Install leaflet -sudo curl --silent \ - "https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js" \ - > /var/www/example-map/leaflet/leaflet.min.js -sudo curl --silent \ - "https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" \ - > /var/www/example-map/leaflet/leaflet.css - -# Add configuration -sudo cp "etc/renderd/renderd.conf.examples" /etc/renderd.conf -sudo cp "etc/apache2/renderd.conf" /etc/httpd/conf.d/renderd.conf -sudo cp "apache2/renderd-example-map.conf" \ - /etc/httpd/conf.d/renderd-example-map.conf - -# Apply CentOS specific changes to configuration files -sudo sed --in-place \ - "s#/usr/lib/mapnik/3.0/input#/usr/lib64/mapnik/input#g" \ - /etc/renderd.conf -sudo sed --in-place \ - "s#/usr/share/fonts/truetype#/usr/share/fonts#g" \ - /etc/renderd.conf - -# Add and activate mod_tile for Apache -echo "LoadModule tile_module /usr/lib64/httpd/modules/mod_tile.so" \ - | sudo tee --append /etc/httpd/conf.modules.d/11-mod_tile.conf - -# Make example map the new main page of Apache -sudo rm --force /etc/httpd/conf.d/welcome.conf - -# Install software -sudo make install -sudo make install-mod_tile - -# Start services -sudo httpd -sudo renderd -f -``` - -Then you can visit: `http://localhost/example-map` diff --git a/docs/build/building_on_centos_stream.md b/docs/build/building_on_centos_stream.md new file mode 100644 index 00000000..2f25e9b4 --- /dev/null +++ b/docs/build/building_on_centos_stream.md @@ -0,0 +1,92 @@ +# Building on CentOS Stream + +This document provides users with step-by-step instructions on how to compile and use`mod_tile` and `renderd`. + +Please see our [Continuous Integration script](/.github/workflows/build-and-test.yml) for more details. + +_CentOS Stream does not provide a `mapnik`/`mapnik-devel` package, so it will first need to be built & installed, which is beyond the scope of this document, please visit the project's [installation document on GitHub](https://github.com/mapnik/mapnik/blob/master/INSTALL.md) or our [Continuous Integration script](/.github/actions/dependencies/build-and-install/mapnik/action.yml) for more information._ + +## CentOS Stream 8 +```shell +#!/usr/bin/env bash + +# Update config-manager DNF plugin +sudo dnf --assumeyes install "dnf-command(config-manager)" + +# Enable PowerTools Repository +sudo dnf config-manager --save --setopt=powertools.enabled=1 +``` + +## CentOS Stream 9 +```shell +#!/usr/bin/env bash + +# Update config-manager DNF plugin +sudo dnf --assumeyes install "dnf-command(config-manager)" + +# Enable CRB Repository +sudo dnf config-manager --save --setopt=crb.enabled=1 +``` + +## CentOS Stream 8/9 +```shell +#!/usr/bin/env bash + +# Update installed packages +sudo dnf --assumeyes update + +# Install build dependencies +# (libmemcached-devel & librados2-devel are optional) +sudo dnf --assumeyes install epel-release +sudo dnf --assumeyes --setopt=install_weak_deps=False install \ + boost-devel \ + cairo-devel \ + cmake3 \ + gcc \ + gcc-c++ \ + gdal \ + git \ + glib2-devel \ + harfbuzz-devel \ + httpd-devel \ + iniparser-devel \ + libcurl-devel \ + libicu-devel \ + libjpeg \ + libmemcached-devel \ + librados2-devel \ + libtiff \ + libwebp \ + make \ + proj + +# Download, Build, Test & Install `mod_tile` +export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) +rm -rf /tmp/mod_tile_src /tmp/mod_tile_build +mkdir /tmp/mod_tile_src /tmp/mod_tile_build +cd /tmp/mod_tile_src +git clone --depth 1 https://github.com/openstreetmap/mod_tile.git . +cd /tmp/mod_tile_build +cmake -B . -S /tmp/mod_tile_src \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DENABLE_TESTS:BOOL=ON +cmake --build . +ctest +sudo cmake --install . --prefix /usr --strip + +# Create /usr/share/renderd directory +sudo mkdir --parents /usr/share/renderd + +# Copy files of example map +sudo cp -av /tmp/mod_tile_src/utils/example-map /usr/share/renderd/example-map + +# Add configuration +sudo cp -av /tmp/mod_tile_src/etc/apache2/renderd-example-map.conf /etc/httpd/conf.d/renderd-example-map.conf +printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' | sudo tee -a /etc/renderd.conf + +# Start services +sudo httpd +sudo renderd -f +``` + +Then you can visit: `http://localhost:8081/renderd-example-map` diff --git a/docs/build/building_on_debian.md b/docs/build/building_on_debian.md new file mode 100644 index 00000000..21838816 --- /dev/null +++ b/docs/build/building_on_debian.md @@ -0,0 +1,66 @@ +# Building on Debian + +This document provides users with step-by-step instructions on how to compile and use`mod_tile` and `renderd`. + +Please see our [Continuous Integration script](/.github/workflows/build-and-test.yml) for more details. + +## Debian 10/11/12 +```shell +#!/usr/bin/env bash + +# Update installed packages +sudo apt update && sudo apt --yes upgrade +sudo apt --yes install --reinstall ca-certificates + +# Install build dependencies +# (libmemcached-dev & librados-dev are optional) +sudo apt --no-install-recommends --yes install \ + apache2 \ + apache2-dev \ + cmake \ + curl \ + g++ \ + gcc \ + git \ + libcairo2-dev \ + libcurl4-openssl-dev \ + libglib2.0-dev \ + libiniparser-dev \ + libmapnik-dev \ + libmemcached-dev \ + librados-dev + +# Download, Build, Test & Install `mod_tile` +export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) +rm -rf /tmp/mod_tile_src /tmp/mod_tile_build +mkdir /tmp/mod_tile_src /tmp/mod_tile_build +cd /tmp/mod_tile_src +git clone --depth 1 https://github.com/openstreetmap/mod_tile.git . +cd /tmp/mod_tile_build +cmake -B . -S /tmp/mod_tile_src \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DENABLE_TESTS:BOOL=ON +cmake --build . +ctest +sudo cmake --install . --prefix /usr --strip + +# Create /usr/share/renderd directory +sudo mkdir --parents /usr/share/renderd + +# Copy files of example map +sudo cp -av /tmp/mod_tile_src/utils/example-map /usr/share/renderd/example-map + +# Add configuration +sudo cp -av /tmp/mod_tile_src/etc/apache2/renderd-example-map.conf /etc/apache2/sites-available/renderd-example-map.conf +printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' | sudo tee -a /etc/renderd.conf + +# Enable configuration +a2enmod tile +a2ensite renderd-example-map + +# Start services +sudo apache2ctl start +sudo renderd -f +``` + +Then you can visit: `http://localhost:8081/renderd-example-map` diff --git a/docs/build/building_on_debian_12.md b/docs/build/building_on_debian_12.md deleted file mode 100644 index 3e026575..00000000 --- a/docs/build/building_on_debian_12.md +++ /dev/null @@ -1,68 +0,0 @@ -# Building on Debian 12 - -This documents step by step on how to compile and put into use the software `mod_tile` and `renderd`. -Please see our [Continuous Integration script](../../.github/workflows/build-and-test.yml) for more detail. - -```shell -#!/usr/bin/env bash - -# Update installed packages -sudo apt update && sudo apt upgrade --yes - -# Install build dependencies -# (the last two are optional) -sudo apt install build-essential \ - autoconf \ - apache2-dev \ - libcairo2-dev \ - libcurl4-gnutls-dev \ - libglib2.0-dev \ - libiniparser-dev \ - libmapnik-dev \ - libmemcached-dev \ - librados-dev - -# Download, build & install -git clone https://github.com/openstreetmap/mod_tile.git /usr/local/src/mod_tile -cd /usr/local/src/mod_tile -./autogen.sh -./configure -make - -# Create tiles directory -sudo mkdir --parents /run/renderd /var/cache/renderd/tiles - -# Move files of example map -sudo mkdir --parents /usr/share/renderd/ -sudo cp -r "utils/example-map" /usr/share/renderd/example-map - -# Link leaflet library -sudo ln --symbolic \ - /usr/share/javascript/leaflet \ - /usr/share/renderd/example-map/leaflet - -# Add configuration -sudo cp "etc/renderd/renderd.conf.examples" /etc/renderd.conf -sudo cp "etc/apache2/renderd.conf" /etc/apach2/conf.d/renderd.conf -sudo cp "etc/apache2/renderd-example-map.conf" \ - /etc/apache2/conf-enabled/renderd-example-map.conf - -# Apply Debian specific changes to configuration files -sudo sed --in-place \ - "s#/usr/lib/mapnik/3.0/input#/usr/lib/mapnik/3.1/input#g" \ - /etc/renderd.conf - -# Add and activate mod_tile for Apache -echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" \ - | sudo tee --append /etc/apache2/mods-enabled/mod_tile.load - -# Install software -sudo make install -sudo make install-mod_tile - -# Start services -sudo systemctl --now enable apache2 -sudo renderd -f -``` - -Then you can visit: `http://localhost:8081/renderd-example-map` diff --git a/docs/build/building_on_fedora.md b/docs/build/building_on_fedora.md new file mode 100644 index 00000000..5011745d --- /dev/null +++ b/docs/build/building_on_fedora.md @@ -0,0 +1,59 @@ +# Building on Fedora + +This document provides users with step-by-step instructions on how to compile and use`mod_tile` and `renderd`. + +Please see our [Continuous Integration script](/.github/workflows/build-and-test.yml) for more details. + +## Fedora 34/35/36/37/38 +```shell +#!/usr/bin/env bash + +# Update installed packages +sudo dnf --assumeyes update + +# Install build dependencies +# (libmemcached-devel & librados-devel are optional) +sudo dnf --assumeyes --setopt=install_weak_deps=False install \ + cairo-devel \ + cmake \ + gcc \ + gcc-c++ \ + git \ + glib2-devel \ + httpd-devel \ + iniparser-devel \ + libcurl-devel \ + libmemcached-devel \ + librados-devel \ + mapnik-devel + +# Download, Build, Test & Install `mod_tile` +export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) +rm -rf /tmp/mod_tile_src /tmp/mod_tile_build +mkdir /tmp/mod_tile_src /tmp/mod_tile_build +cd /tmp/mod_tile_src +git clone --depth 1 https://github.com/openstreetmap/mod_tile.git . +cd /tmp/mod_tile_build +cmake -B . -S /tmp/mod_tile_src \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DENABLE_TESTS:BOOL=ON +cmake --build . +ctest +sudo cmake --install . --prefix /usr --strip + +# Create /usr/share/renderd directory +sudo mkdir --parents /usr/share/renderd + +# Copy files of example map +sudo cp -av /tmp/mod_tile_src/utils/example-map /usr/share/renderd/example-map + +# Add configuration +sudo cp -av /tmp/mod_tile_src/etc/apache2/renderd-example-map.conf /etc/httpd/conf.d/renderd-example-map.conf +printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' | sudo tee -a /etc/renderd.conf + +# Start services +sudo httpd +sudo renderd -f +``` + +Then you can visit: `http://localhost:8081/renderd-example-map` diff --git a/docs/build/building_on_fedora_34.md b/docs/build/building_on_fedora_34.md deleted file mode 100644 index e82301be..00000000 --- a/docs/build/building_on_fedora_34.md +++ /dev/null @@ -1,81 +0,0 @@ -# Building on Fedora 34 - -This documents step by step on how to compile and put into use the software `mod_tile` and `renderd`. -Please see our [Continous Integration script](../../.github/workflows/build-and-test-fedora-34.yml) for more detail. - -```shell -#!/usr/bin/env bash - -# Update installed packages -sudo yum --assumeyes update - -# Install "Development Tools" group -sudo yum --assumeyes groups install \ - "Development Tools" \ - "C Development Tools and Libraries" \ - "Development Libraries" \ - "Development Tools" - -# Install build dependencies -sudo yum --assumeyes install \ - cairo-devel \ - glib2-devel \ - httpd-devel \ - iniparser-devel \ - mapnik-devel \ - libcurl-devel \ - libmemcached-devel \ - librados-devel - -# Download, Build & Install `mod_tile` -git clone https://github.com/openstreetmap/mod_tile.git /usr/local/src/mod_tile -cd /usr/local/src/mod_tile -./autogen.sh -./configure -make - -# Create tiles directory -sudo mkdir --parents /run/renderd /var/cache/renderd/tiles - -# Move files of example map -sudo cp -r "utils/example-map" /var/www/example-map - -# Install leaflet -sudo curl --silent \ - "https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js" \ - > /var/www/example-map/leaflet/leaflet.min.js -sudo curl --silent \ - "https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" \ - > /var/www/example-map/leaflet/leaflet.css - -# Add configuration -sudo cp "etc/renderd/renderd.conf.examples" /etc/renderd.conf -sudo cp "etc/apache2/renderd.conf" /etc/httpd/conf.d/renderd.conf -sudo cp "apache2/renderd-example-map.conf" \ - /etc/httpd/conf.d/renderd-example-map.conf - -# Apply Fedora specific changes to configuration files -sudo sed --in-place \ - "s#/usr/lib/mapnik/3.0/input#/usr/lib64/mapnik/input#g" \ - /etc/renderd.conf -sudo sed --in-place \ - "s#/usr/share/fonts/truetype#/usr/share/fonts#g" \ - /etc/renderd.conf - -# Add and activate mod_tile for Apache -echo "LoadModule tile_module /usr/lib64/httpd/modules/mod_tile.so" \ - | sudo tee --append /etc/httpd/conf.modules.d/11-mod_tile.conf - -# Make example map the new main page of Apache -sudo rm --force /etc/httpd/conf.d/welcome.conf - -# Install software -sudo make install -sudo make install-mod_tile - -# Start services -sudo httpd -sudo renderd -f -``` - -Then you can visit: `http://localhost/example-map` diff --git a/docs/build/building_on_freebsd.md b/docs/build/building_on_freebsd.md new file mode 100644 index 00000000..6c3bc6ff --- /dev/null +++ b/docs/build/building_on_freebsd.md @@ -0,0 +1,64 @@ +# Building on FreeBSD + +This document provides users with step-by-step instructions on how to compile and use`mod_tile` and `renderd`. + +Please see our [Continuous Integration script](/.github/workflows/build-and-test.yml) for more details. + +## FreeBSD 13.0/13.1/13.2 +```shell +#!/usr/bin/env sh + +# Mapnik & GDAL w/ working GPKG support are not in the `quarterly` repository (2023.05.04) +sudo mkdir -p /usr/local/etc/pkg/repos +sudo sed 's#/quarterly#/latest#g' /etc/pkg/FreeBSD.conf > /usr/local/etc/pkg/repos/FreeBSD.conf + +# Update installed packages +sudo pkg upgrade --yes + +# Install build dependencies +# (libmemcached & ceph14 are optional) +sudo pkg install --yes \ + apache24 \ + cairo \ + ceph14 \ + cmake \ + coreutils \ + curl \ + git \ + glib \ + iniparser \ + libmemcached \ + mapnik \ + pkgconf + +# Download, Build, Test & Install `mod_tile` +export CMAKE_BUILD_PARALLEL_LEVEL=$(sysctl -n hw.ncpu) +rm -rf /tmp/mod_tile_src /tmp/mod_tile_build +mkdir /tmp/mod_tile_src /tmp/mod_tile_build +cd /tmp/mod_tile_src +git clone --depth 1 https://github.com/openstreetmap/mod_tile.git . +cd /tmp/mod_tile_build +cmake -B . -S /tmp/mod_tile_src \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DCMAKE_LIBRARY_PATH:PATH=/usr/local/lib \ + -DENABLE_TESTS:BOOL=ON +cmake --build . +ctest +sudo cmake --install . --prefix /usr --strip + +# Create /usr/share/renderd directory +sudo mkdir -p /usr/share/renderd + +# Copy files of example map +sudo cp -av /tmp/mod_tile_src/utils/example-map /usr/share/renderd/example-map + +# Add configuration +sudo cp -av /tmp/mod_tile_src/etc/apache2/renderd-example-map.conf /usr/local/etc/apache24/Includes/renderd-example-map.conf +printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' | sudo tee -a /etc/renderd.conf + +# Start services +sudo httpd +sudo renderd -f +``` + +Then you can visit: `http://localhost:8081/renderd-example-map` diff --git a/docs/build/building_on_macos.md b/docs/build/building_on_macos.md new file mode 100644 index 00000000..782d1ee6 --- /dev/null +++ b/docs/build/building_on_macos.md @@ -0,0 +1,63 @@ +# Building on macOS + +This document provides users with step-by-step instructions on how to compile and use`mod_tile` and `renderd`. + +Please see our [Continuous Integration script](/.github/workflows/build-and-test.yml) for more details. + +## macOS 11/12/13 +```shell +#!/usr/bin/env bash + +# Update installed packages +brew upgrade + +# Install build dependencies +# (libmemcached is optional) +brew install \ + apr \ + cairo \ + cmake \ + coreutils \ + curl \ + glib \ + httpd \ + iniparser \ + libmemcached \ + mapnik \ + pkg-config + +# Download, Build, Test & Install `mod_tile` +export CFLAGS="-Wno-implicit-function-declaration" +export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) +export ICU_ROOT=$(brew --prefix icu4c) +export LDFLAGS="-undefined dynamic_lookup" +export LIBRARY_PATH="/usr/local/lib" +rm -rf /tmp/mod_tile_src /tmp/mod_tile_build +mkdir /tmp/mod_tile_src /tmp/mod_tile_build +cd /tmp/mod_tile_src +git clone --depth 1 https://github.com/openstreetmap/mod_tile.git . +cd /tmp/mod_tile_build +cmake -B . -S /tmp/mod_tile_src \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DENABLE_TESTS:BOOL=ON +cmake --build . +ctest +sudo cmake --install . --prefix /usr --strip + +# Create /usr/local/share/renderd directory +sudo mkdir -p /usr/local/share/renderd + +# Copy files of example map +sudo cp -av /tmp/mod_tile_src/utils/example-map /usr/local/share/renderd/example-map + +# Add configuration +sed 's#/usr/share/#/usr/local/share/#g' /tmp/mod_tile_src/etc/apache2/renderd-example-map.conf | sudo tee /usr/local/etc/httpd/extra/renderd-example-map.conf +printf '\nInclude /usr/local/etc/httpd/extra/httpd-tile.conf\nInclude /usr/local/etc/httpd/extra/renderd-example-map.conf\n' | sudo tee -a /usr/local/etc/httpd/httpd.conf +printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/local/share/renderd/example-map/mapnik.xml\n' | sudo tee -a /etc/renderd.conf + +# Start services +httpd +sudo renderd -f +``` + +Then you can visit: `http://localhost:8081/renderd-example-map` diff --git a/docs/build/building_on_ubuntu.md b/docs/build/building_on_ubuntu.md new file mode 100644 index 00000000..7e27720b --- /dev/null +++ b/docs/build/building_on_ubuntu.md @@ -0,0 +1,66 @@ +# Building on Ubuntu + +This document provides users with step-by-step instructions on how to compile and use`mod_tile` and `renderd`. + +Please see our [Continuous Integration script](/.github/workflows/build-and-test.yml) for more details. + +# Ubuntu 20.04/22.04 +```shell +#!/usr/bin/env bash + +# Update installed packages +sudo apt update && sudo apt --yes upgrade +sudo apt --yes install --reinstall ca-certificates + +# Install build dependencies +# (libmemcached-dev & librados-dev are optional) +sudo apt --no-install-recommends --yes install \ + apache2 \ + apache2-dev \ + cmake \ + curl \ + g++ \ + gcc \ + git \ + libcairo2-dev \ + libcurl4-openssl-dev \ + libglib2.0-dev \ + libiniparser-dev \ + libmapnik-dev \ + libmemcached-dev \ + librados-dev + +# Download, Build, Test & Install `mod_tile` +export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) +rm -rf /tmp/mod_tile_src /tmp/mod_tile_build +mkdir /tmp/mod_tile_src /tmp/mod_tile_build +cd /tmp/mod_tile_src +git clone --depth 1 https://github.com/openstreetmap/mod_tile.git . +cd /tmp/mod_tile_build +cmake -B . -S /tmp/mod_tile_src \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DENABLE_TESTS:BOOL=ON +cmake --build . +ctest +sudo cmake --install . --prefix /usr --strip + +# Create /usr/share/renderd directory +sudo mkdir --parents /usr/share/renderd + +# Copy files of example map +sudo cp -av /tmp/mod_tile_src/utils/example-map /usr/share/renderd/example-map + +# Add configuration +sudo cp -av /tmp/mod_tile_src/etc/apache2/renderd-example-map.conf /etc/apache2/sites-available/renderd-example-map.conf +printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' | sudo tee -a /etc/renderd.conf + +# Enable configuration +a2enmod tile +a2ensite renderd-example-map + +# Start services +sudo apache2ctl start +sudo renderd -f +``` + +Then you can visit: `http://localhost:8081/renderd-example-map` diff --git a/docs/build/building_on_ubuntu_20_04.md b/docs/build/building_on_ubuntu_20_04.md deleted file mode 100644 index 24ccca1d..00000000 --- a/docs/build/building_on_ubuntu_20_04.md +++ /dev/null @@ -1,62 +0,0 @@ -# Building on Ubuntu 20.04 - -This documents step by step on how to compile and put into use the software `mod_tile` and `renderd`. -Please see our [Continuous Integration script](../../.github/workflows/build-and-test.yml) for more detail. - -```shell -#!/usr/bin/env bash - -# Update installed packages -sudo apt update && sudo apt upgrade --yes - -# Install build dependencies -# (the last two are optional) -sudo apt install build-essential \ - autoconf \ - apache2-dev \ - libcairo2-dev \ - libcurl4-gnutls-dev \ - libglib2.0-dev \ - libiniparser-dev \ - libmapnik-dev \ - libmemcached-dev \ - librados-dev - -# Download, build & install -git clone https://github.com/openstreetmap/mod_tile.git /usr/local/src/mod_tile -cd /usr/local/src/mod_tile -./autogen.sh -./configure -make - -# Create tiles directory -sudo mkdir --parents /run/renderd /var/cache/renderd/tiles - -# Move files of example map -sudo cp -r "utils/example-map" /var/www/example-map - -# Link leaflet library -sudo ln --symbolic \ - /usr/share/javascript/leaflet \ - /var/www/example-map/leaflet - -# Add configuration -sudo cp "etc/renderd/renderd.conf.examples" /etc/renderd.conf -sudo cp "etc/apache2/renderd.conf" /etc/apach2/conf.d/renderd.conf -sudo cp "etc/apache2/renderd-example-map.conf" \ - /etc/apache2/conf-enabled/renderd-example-map.conf - -# Add and activate mod_tile for Apache -echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" \ - | sudo tee --append /etc/apache2/mods-enabled/mod_tile.load - -# Install software -sudo make install -sudo make install-mod_tile - -# Start services -sudo systemctl --now enable apache2 -sudo renderd -f -``` - -Then you can visit: `http://localhost/example-map` \ No newline at end of file diff --git a/etc/apache2/renderd-example-map.conf b/etc/apache2/renderd-example-map.conf index 0d5b3d32..d4cbc255 100644 --- a/etc/apache2/renderd-example-map.conf +++ b/etc/apache2/renderd-example-map.conf @@ -1,10 +1,15 @@ Alias /renderd-example-map /usr/share/renderd/example-map +Redirect /renderd-example-map/leaflet/leaflet.css https://unpkg.com/leaflet/dist/leaflet.css +Redirect /renderd-example-map/leaflet/leaflet.min.js https://unpkg.com/leaflet/dist/leaflet.js Options +FollowSymLinks AllowOverride All - order allow,deny - allow from all + Order Allow,Deny + Allow from all + + Require all granted + Listen 8081 @@ -54,7 +59,7 @@ Listen 8081 ModTileMaxLoadMissing 5 # Socket where we connect to the rendering daemon - ModTileRenderdSocketName /run/renderd/renderd.sock + ModTileRenderdSocketName /var/run/renderd/renderd.sock # Options controlling the cache proxy expiry headers. All values are in seconds. #