Working docker configs for ORS and POI

Hi!

I got ORS and POI services working ok, here is my working configs:

OpenPOIservice / docker-compose.yml as follows:

version: "2.2"

volumes:
 postgis-data:

networks:
 poi_network:

services:
 api:
  container_name: ops-api
  build: .
  volumes:
  - ./osm:/deploy/app/osm
  - ./ops_settings_docker.yml:/deploy/app/openpoiservice/server/ops_settings.yml
  - ./categories_docker.yml:/deploy/app/openpoiservice/server/categories/categories.yml
  ports:
   - "5000:5000"
  depends_on:
    db:
      condition: service_healthy
  mem_limit: 28g
  networks:
   - poi_network

 # Don't forget to change the host name inside ops_settings_docker.yml by the one given to docker container.
 # Also port should be set to 5432 (default value) inside the same file since they are on the same network
 db:
  container_name: ops-db
  image: postgis/postgis:16-3.4
  volumes:
   - postgis-data:/var/lib/postgresql
  environment:
   # If you need to create multiple database you can add coma separated databases eg gis,data
   - POSTGRES_DB=gis
   - POSTGRES_USER=gis_admin    # Here it's important to keep the same name as the one configured inside ops_settings_docker.yml
   - POSTGRES_PASSWORD=admin        # Here it's important to keep the same name as the one configured inside ops_settings_docker.yml
   - POSTGRES_DBNAME=gis        # Here it's important to keep the same name as the one configured inside ops_settings_docker.yml
   - ALLOW_IP_RANGE=0.0.0.0/0
  ports:
   - 5432:5432
  healthcheck:
      test: ["CMD-SHELL", "pg_isready", "-d", "${POSTGRES_DB}"]
      interval: 10s
      timeout: 10s
      retries: 10
  restart: on-failure
  networks:
   - poi_network

 # These two services will not start by default and can be run as necessary:
 # docker-compose up init
 # docker-compose up update
 init:
  container_name: ops-init
  build: .
  environment:
   - INIT_DB=1
  volumes:
  - ./osm:/deploy/app/osm
  - ./import-log.json:/deploy/app/import-log.json
  - ./ops_settings_docker.yml:/deploy/app/openpoiservice/server/ops_settings.yml
  - ./categories_docker.yml:/deploy/app/openpoiservice/server/categories/categories.yml
  depends_on:
    db:
      condition: service_healthy
  mem_limit: 28g
  networks:
   - poi_network
  profiles:
   - init

 update:
  container_name: ops-update
  build: .
  environment:
   - UPDATE_DB=1
  volumes:
  - ./osm:/deploy/app/osm
  - ./import-log.json:/deploy/app/import-log.json
  - ./ops_settings_docker.yml:/deploy/app/openpoiservice/server/ops_settings.yml
  - ./categories_docker.yml:/deploy/app/openpoiservice/server/categories/categories.yml
  depends_on:
    db:
      condition: service_healthy
  mem_limit: 28g
  networks:
   - poi_network
  profiles:
   - update

 test:
  container_name: ops-test
  build: .
  environment:
   - TESTING=True
  volumes:
   - ./osm:/deploy/app/osm
   - ./osm_test:/deploy/app/osm_test
   - ./ops_settings_docker.yml:/deploy/app/openpoiservice/server/ops_settings.yml
   - ./categories_docker.yml:/deploy/app/openpoiservice/server/categories/categories.yml
  depends_on:
    db:
      condition: service_healthy
  mem_limit: 8g
  networks:
   - poi_network

openrouteservice / docker-compose.yml as follows:

# Docker Compose file for the openrouteservice (ORS) application
# Documentation and examples can be found on https://giscience.github.io/openrouteservice/run-instance/running-with-docker
version: '3.8'

services:
  # ----------------- ORS application configuration ------------------- #
  ors-app:
    # Activate the following lines to build the container from the repository
    # You have to add --build to the docker compose command to do so
    build:
      context: ./
    container_name: ors-app
    ports:
      - "8082:8082"  # Expose the ORS API on port 8080
      - "9001:9001"  # Expose additional port for monitoring (optional)
    image: openrouteservice/openrouteservice:nightly
    # Advanced option! If you different ids to 0:0 and 1000:1000, you have to rebuild the container with the build args UID,GID.
    # The user command is useful if you want easier bind mount access or better security.
    #user: "1000:1000" # Run "mkdir -p ors-docker/config ors-docker/elevation_cache ors-docker/files ors-docker/graphs ors-docker/logs && sudo chown -R 1000:1000 ors" before starting the container!
    volumes:  # Mount relative directories. ONLY for local container runtime. To switch to docker managed volumes see 'Docker Volumes configuration' section below.
      - ./ors-docker:/home/ors  # Mount the ORS application directory (for logs, graphs, elevation_cache, etc.) into its own directory
      #- ./graphs:/home/ors/graphs  # Mount graphs directory individually
      #- ./elevation_cache:/home/ors/elevation_cache  # Mount elevation cache directory individually
      #- ./config:/home/ors/config  # Mount configuration directory individually
      #- ./logs:/home/ors/logs  # Mount logs directory individually
      #- ./files:/home/ors/files  # Mount files directory individually
    environment:
      REBUILD_GRAPHS: False  # Set to True to rebuild graphs on container start.
      CONTAINER_LOG_LEVEL: DEBUG  # Log level for the container. Possible values: DEBUG, INFO, WARNING, ERROR, CRITICAL
      # If you don't want the default ors-config.yml you can specify a custom file name, that should match the file in
      # your 'config' volume mount.
      #ORS_CONFIG_LOCATION: /home/ors/config/my-ors-config.yml  # Location of your ORS configuration file in the docker container

      # ------------------ JAVA OPTS ------------------ #
      # Configure the memory settings for JAVA or pass additional opts
      # Fore more available ENV properties see Prepare CATALINA_OPTS and JAVA_OPTS
      # in https://github.com/GIScience/openrouteservice/blob/main/docker-entrypoint.sh
      XMS: 10g  # start RAM assigned to java
      XMX: 20g  # max RAM assigned to java. Rule of Thumb: <PBF-size> * <profiles> * 2
      # Example: 1.5 GB pbf size, two profiles (car and foot-walking)
      # -> 1.5 * 2 * 2 = 6. Set xmx to be AT LEAST `-Xmx6g`
      ADDITIONAL_JAVA_OPTS: ""  # further options you want to pass to the java command

      # ----------------- Properties configuration ------------------- #
      # Configure your whole container with only property ENVs.
      # These can be set alternatively or additionally to the yml configuration file.
      # Note, that any values set will override the corresponding values from the yml configuration file.
      # See the ors-config.env file for more options.
      # To have a configuration file-less container, uncomment at least the following properties.
      # The values are examples and provide the default configuration.
      #ors.engine.source_file: /home/ors/files/example-heidelberg.osm.gz
      #ors.engine.graphs_root_path: /home/ors/graphs
      #ors.engine.elevation.cache_path: /home/ors/elevation_cache
      #ors.engine.profiles.car.enabled: true

    # ----------------- ENV file configuration ------------------- #
    # Too many variables for your 'environment:' section?
    # Use an env_file with the ENV properties instead and define everything in there:
    # Values will be overwritten if set in the 'environment' section.
    #env_file: ors-config.env

    # ----------------- Healthcheck configuration ------------------- #
    # The healthcheck is disabled by default. Uncomment the following lines to enable it.
    # The healthcheck allows you to monitor the status of the ORS application.
    # Be careful with long graph builds, as the healthcheck will fail and show 'unhealthy' during this time.
    # This is especially useful if you run your ORS container in a production environment.
    #healthcheck:
    #  test: wget --no-verbose --tries=1 --spider http://localhost:8082/ors/v2/health || exit 1
    #  start_period: 1m
    #  interval: 10s
    #  timeout: 2s
    #  retries: 3
    #  disable: false

# ----------------- Docker Volumes configuration ------------------- #
# Define the Docker managed volumes for the ORS application. For more info on Docker Volumes see https://docs.docker.com/compose/compose-file/07-volumes/
# Volumes are used to persist the data and configuration of the ORS application.
# If you want to use volumes, uncomment the following lines and remove the ./ prefix from the volume paths in 'services.ors-app.volumes'.
#volumes:
#    graphs:
#    elevation_cache:
#    config:
#    logs:
#    files:
1 Like