Overv / openstreetmap-tile-server

Docker file for a minimal effort OpenStreetMap tile server
Apache License 2.0
1.2k stars 482 forks source link

Trying to Serve Tiles for North America [Help Needed -- First Time Setup] #432

Open TopHatProductions115new opened 2 weeks ago

TopHatProductions115new commented 2 weeks ago

I'm trying to serve tiles for the North America region (~15GB OSM PBF). My setup is an Arch-based VM, with the the openstreetmap-tile-server container running on Docker Compose. Here are the specs for the VM:

I've been searching for info on benchmarks and expected performance (especially for the initial import command). Something tells me that I'm not going about this correctly. I saw at least one source state that running this on HDDs, instead of SSDs, could make the process take days, in opposed to hours. Furthermore, I'm currently running on Xeons from mid-2011.

Given the potentially sub-optimal setup, I would still like some pointers on how I can improve performance for this instance. My current compose file is included, for your review/feedback:

# Compose file draft, created with instruction from:
# https://github.com/Overv/openstreetmap-tile-server
# https://github.com/Overv/openstreetmap-tile-server/blob/master/docker-compose.yml
# https://github.com/Overv/openstreetmap-tile-server/issues/22#issuecomment-493975963
# https://github.com/Overv/openstreetmap-tile-server/issues/72#issuecomment-538284128

version: "3"

services:

    osm-tile-server:
        image: overv/openstreetmap-tile-server:latest
        container_name: osm-tile-server
        hostname: osm-tile-server
        restart: always
    # First, import the OSM PBF file into the PostgreSQL database
    #   command: "import"
    # Then, run the tile server to serve the processed tiles
    #   command: "run"
        volumes:
            - /path/to/OSM/tileserver/downloads/north-america-latest.osm.pbf:/data/region.osm.pbf
            - /path/to/OSM/tileserver/database:/data/database
            - /path/to/OSM/tileserver/tiles:/data/tiles
        ports:
            - REAL_PORT_NUMBER:80
        environment:
            UPDATES: "disabled"
            THREADS: 8
            FLAT_NODES: "enabled"
            ALLOW_CORS: enabled
            OSM2PGSQL_EXTRA_ARGS: "-C 4096"
        # The next 2 variables should be unnecessary if you already run OSRM
        #   DOWNLOAD_PBF: "https://download.geofabrik.de/north-america-latest.osm.pbf"
        # The next variable only applies if you allow for automatic updates
        #   DOWNLOAD_POLY: "https://download.geofabrik.de/north-america.poly"
    # It is a docker-compose specific service option
        shm-size: 256M
        networks:
            docker_files_Docker_Ten:
                ipv4_address: a.local.IP.address

networks:
    docker_files_Docker_Ten:
        external: true

Please note that I do have a hardware upgrade planned for the future. However I still would like to (attempt to) optimize things beforehand.