Я использую сервер плиток OpenStreetMap @ https://github.com/Overv/openstreetmap-tile-server для размещения собственного сервера плиток.
Я запускаю контейнер с помощью следующей команды, и он запускается без ошибок, однако, когда Я пытаюсь просмотреть веб-страницу на localhost: 8080 плитки карты не загружаются. Когда я просматриваю вкладку сети, я вижу, что они получают ошибку 404:
PS C:\Development\Uni> docker run -p 8080:80 -v openstreetmap-data:/var/lib/postgres/12/main -d overv/openstreetmap-tile-server run
Я получил копию журналов Docker, чтобы узнать, что там происходит:
+ '[' 1 -ne 1 ']'
+ '[' run = import ']'
+ '[' run = run ']'
+ rm -rf /tmp/hsperfdata_root
+ chown postgres:postgres /var/lib/postgresql -R
+ '[' '' == enabled ']'
+ '[' '' == 1 ']'
+ createPostgresConfig
+ cp /etc/postgresql/12/main/postgresql.custom.conf.tmpl /etc/postgresql/12/main/conf.d/postgresql.custom.conf
+ sudo -u postgres echo 'autovacuum = on'
+ cat /etc/postgresql/12/main/conf.d/postgresql.custom.conf
# Suggested minimal settings from
# https://ircama.github.io/osm-carto-tutorials/tile-server-ubuntu/
shared_buffers = 128MB
min_wal_size = 1GB
max_wal_size = 2GB
maintenance_work_mem = 256MB
# Suggested settings from
# https://github.com/openstreetmap/chef/blob/master/roles/tile.rb#L38-L45
max_connections = 250
temp_buffers = 32MB
work_mem = 128MB
wal_buffers = 1024kB
wal_writer_delay = 500ms
commit_delay = 10000
# checkpoint_segments = 60 # unrecognized in psql 10.7.1
max_wal_size = 2880MB
random_page_cost = 1.1
track_activity_query_size = 16384
autovacuum_vacuum_scale_factor = 0.05
autovacuum_analyze_scale_factor = 0.02
listen_addresses = '*'
autovacuum = on
+ service postgresql start
* Starting PostgreSQL 12 database server
...done.
+ service apache2 restart
* Restarting Apache httpd web server apache2
[Mon Apr 27 20:29:40.317813 2020] [tile:notice] [pid 68:tid 140528325397440] Loading tile config ajt at /tile/ for zooms 0 - 20 from tile directory /var/lib/mod_tile with extension .png and mime type image/png
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
...done.
+ setPostgresPassword
+ sudo -u postgres psql -c 'ALTER USER renderer PASSWORD '\''renderer'\'''
ERROR: role "renderer" does not exist
+ sed -i -E 's/num_threads=[0-9]+/num_threads=4/g' /usr/local/etc/renderd.conf
+ '[' disabled = enabled ']'
+ '[' disabled = 1 ']'
+ trap stop_handler SIGTERM
+ child=144
+ wait 144
+ sudo -u renderer renderd -f -c /usr/local/etc/renderd.conf
renderd[145]: Rendering daemon started
renderd[145]: Initiating request_queue
renderd[145]: Parsing section renderd
renderd[145]: Parsing render section 0
renderd[145]: Parsing section mapnik
renderd[145]: Parsing section ajt
renderd[145]: config renderd: unix socketname=/var/run/renderd/renderd.sock
renderd[145]: config renderd: num_threads=4
renderd[145]: config renderd: num_slaves=0
renderd[145]: config renderd: tile_dir=/var/lib/mod_tile
renderd[145]: config renderd: stats_file=/var/run/renderd/renderd.stats
renderd[145]: config mapnik: plugins_dir=/usr/lib/mapnik/3.0/input
renderd[145]: config mapnik: font_dir=/usr/share/fonts
renderd[145]: config mapnik: font_dir_recurse=1
renderd[145]: config renderd(0): Active
renderd[145]: config renderd(0): unix socketname=/var/run/renderd/renderd.sock
renderd[145]: config renderd(0): num_threads=4
renderd[145]: config renderd(0): tile_dir=/var/lib/mod_tile
renderd[145]: config renderd(0): stats_file=/var/run/renderd/renderd.stats
renderd[145]: config map 0: name(ajt) file(/home/renderer/src/openstreetmap-carto/mapnik.xml) uri(/tile/) htcp() host(localhost)
renderd[145]: Initialising unix server socket on /var/run/renderd/renderd.sock
renderd[145]: Created server socket 3
renderd[145]: Renderd is using mapnik version 3.0.19
renderd[145]: DEBUG: Loading font: /usr/share/fonts/truetype/noto/NotoSansDisplay-Italic.ttf
...
...
...
renderd[145]: DEBUG: Loading font: /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Running in foreground mode...
renderd[145]: Starting stats thread
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[145]: Loading parameterization function for
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[145]: Loading parameterization function for
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[145]: Loading parameterization function for
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[145]: Loading parameterization function for
Mapnik LOG> 2020-04-27 20:29:41: warning: unable to find face-name 'Noto Serif Tibetan Regular' in FontSet 'fontset-0'
...
...
...
Mapnik LOG> 2020-04-27 20:29:41: warning: unable to find face-name 'unifont Medium' in FontSet 'fontset-2'
renderd[145]: An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL: role "renderer" does not exist
Connection string: ' dbname=gis connect_timeout=4'
encountered during parsing of layer 'landcover-low-zoom' in Layer at line 825 of '/home/renderer/src/openstreetmap-carto/mapnik.xml'
renderd[145]: An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL: role "renderer" does not exist
Connection string: ' dbname=gis connect_timeout=4'
encountered during parsing of layer 'landcover-low-zoom' in Layer at line 825 of '/home/renderer/src/openstreetmap-carto/mapnik.xml'
renderd[145]: An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL: role "renderer" does not exist
Connection string: ' dbname=gis connect_timeout=4'
encountered during parsing of layer 'landcover-low-zoom' in Layer at line 825 of '/home/renderer/src/openstreetmap-carto/mapnik.xml'
renderd[145]: An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL: role "renderer" does not exist
Connection string: ' dbname=gis connect_timeout=4'
encountered during parsing of layer 'landcover-low-zoom' in Layer at line 825 of '/home/renderer/src/openstreetmap-carto/mapnik.xml'
Надеюсь, кто-то может понять это больше, чем я, но я заметил, что следующие строки выглядят подозрительно:
+ sudo -u postgres psql -c 'ALTER USER renderer PASSWORD '\''renderer'\'''
ERROR: role "renderer" does not exist
renderd[145]: An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL: role "renderer" does not exist
Connection string: ' dbname=gis connect_timeout=4'
encountered during parsing of layer 'landcover-low-zoom' in Layer at line 825 of '/home/renderer/src/openstreetmap-carto/mapnik.xml'
Я думаю, что это проблема с установкой Docker, так что это Docker файл для справки (также я использую Docker для Windows):
FROM ubuntu:18.04
# Based on
# https://switch2osm.org/manually-building-a-tile-server-18-04-lts/
# Set up environment
ENV TZ=UTC
ENV AUTOVACUUM=on
ENV UPDATES=disabled
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install dependencies
RUN apt-get update \
&& apt-get install wget gnupg2 lsb-core -y \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb [ trusted=yes ] https://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y apt-transport-https ca-certificates
RUN apt-get install -y curl \
&& wget --quiet -O - https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y nodejs
RUN apt-get install -y --no-install-recommends \
apache2 \
apache2-dev \
autoconf \
build-essential \
bzip2 \
cmake \
cron \
fonts-noto-cjk \
fonts-noto-hinted \
fonts-noto-unhinted \
gcc \
gdal-bin \
git-core \
libagg-dev \
libboost-filesystem-dev \
libboost-system-dev \
libbz2-dev \
libcairo-dev \
libcairomm-1.0-dev \
libexpat1-dev \
libfreetype6-dev \
libgdal-dev \
libgeos++-dev \
libgeos-dev \
libgeotiff-epsg \
libicu-dev \
liblua5.3-dev \
libmapnik-dev \
libpq-dev \
libproj-dev \
libprotobuf-c0-dev \
libtiff5-dev \
libtool \
libxml2-dev \
lua5.3 \
make \
mapnik-utils \
node-gyp \
osmium-tool \
osmosis \
postgis \
postgresql-12 \
postgresql-contrib-12 \
postgresql-server-dev-12 \
protobuf-c-compiler \
python3-mapnik \
python3-lxml \
python3-psycopg2 \
python3-shapely \
sudo \
tar \
ttf-unifont \
unzip \
wget \
zlib1g-dev \
&& apt-get clean autoclean \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
# Set up PostGIS
RUN wget https://download.osgeo.org/postgis/source/postgis-3.0.0.tar.gz -O postgis.tar.gz \
&& mkdir -p postgis_src \
&& tar -xvzf postgis.tar.gz --strip 1 -C postgis_src \
&& rm postgis.tar.gz \
&& cd postgis_src \
&& ./configure && make && make install \
&& cd .. && rm -rf postgis_src
# Set up renderer user
RUN adduser --disabled-password --gecos "" renderer
# Install latest osm2pgsql
RUN mkdir -p /home/renderer/src \
&& cd /home/renderer/src \
&& git clone https://github.com/openstreetmap/osm2pgsql.git \
&& cd /home/renderer/src/osm2pgsql \
&& rm -rf .git \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make -j $(nproc) \
&& make install \
&& mkdir /nodes \
&& chown renderer:renderer /nodes \
&& rm -rf /home/renderer/src/osm2pgsql
# Install mod_tile and renderd
RUN mkdir -p /home/renderer/src \
&& cd /home/renderer/src \
&& git clone -b switch2osm https://github.com/SomeoneElseOSM/mod_tile.git \
&& cd mod_tile \
&& ./autogen.sh \
&& ./configure \
&& make -j $(nproc) \
&& make -j $(nproc) install \
&& make -j $(nproc) install-mod_tile \
&& ldconfig \
&& cd ..
# Configure stylesheet
RUN mkdir -p /home/renderer/src \
&& cd /home/renderer/src \
&& git clone https://github.com/gravitystorm/openstreetmap-carto.git \
&& git -C openstreetmap-carto checkout v4.23.0 \
&& cd openstreetmap-carto \
&& rm -rf .git \
&& npm install -g carto@0.18.2 \
&& carto project.mml > mapnik.xml \
&& scripts/get-shapefiles.py \
&& rm /home/renderer/src/openstreetmap-carto/data/*.zip
# Configure renderd
RUN sed -i 's/renderaccount/renderer/g' /usr/local/etc/renderd.conf \
&& sed -i 's/\/truetype//g' /usr/local/etc/renderd.conf \
&& sed -i 's/hot/tile/g' /usr/local/etc/renderd.conf
# Configure Apache
RUN mkdir /var/lib/mod_tile \
&& chown renderer /var/lib/mod_tile \
&& mkdir /var/run/renderd \
&& chown renderer /var/run/renderd \
&& 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 \
&& a2enconf mod_tile && a2enconf mod_headers
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 \
&& ln -sf /dev/stderr /var/log/apache2/error.log
# Configure PosgtreSQL
COPY postgresql.custom.conf.tmpl /etc/postgresql/12/main/
RUN chown -R postgres:postgres /var/lib/postgresql \
&& chown postgres:postgres /etc/postgresql/12/main/postgresql.custom.conf.tmpl \
&& echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/12/main/pg_hba.conf \
&& echo "host all all ::/0 md5" >> /etc/postgresql/12/main/pg_hba.conf
# Copy update scripts
COPY openstreetmap-tiles-update-expire /usr/bin/
RUN chmod +x /usr/bin/openstreetmap-tiles-update-expire \
&& mkdir /var/log/tiles \
&& chmod a+rw /var/log/tiles \
&& ln -s /home/renderer/src/mod_tile/osmosis-db_replag /usr/bin/osmosis-db_replag \
&& echo "* * * * * renderer openstreetmap-tiles-update-expire\n" >> /etc/crontab
# Install trim_osc.py helper script
RUN mkdir -p /home/renderer/src \
&& cd /home/renderer/src \
&& git clone https://github.com/zverik/regional \
&& cd regional \
&& git checkout 612fe3e040d8bb70d2ab3b133f3b2cfc6c940520 \
&& rm -rf .git \
&& chmod u+x /home/renderer/src/regional/trim_osc.py
# Start running
COPY run.sh /
COPY indexes.sql /
ENTRYPOINT ["/run.sh"]
CMD []
EXPOSE 80 5432