FacilMap / facilmap

FacilMap is a privacy-friendly, open-source versatile online map that combines different services based on OpenStreetMap and makes it easy to find places, plan trips and add markers, lines and routes to custom maps with live collaboration.
https://facilmap.org/
GNU Affero General Public License v3.0
324 stars 21 forks source link

Traefik ready Docker Compose with healthcheck #237

Closed vabene1111 closed 9 months ago

vabene1111 commented 1 year ago

hi everyone, i just had some problems setting this up despite the great documentation so after getting it working I tought i would share my config.

This features


version: "2.1"
services:
  db:
    image: mariadb
    environment:
      MYSQL_DATABASE: facilmap
      MYSQL_USER: facilmap
      MYSQL_PASSWORD: password
      MYSQL_RANDOM_ROOT_PASSWORD: "true"
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - ./mysqldata:/var/lib/mysql

  facilmap:
    image: facilmap/facilmap
    links:
      - db
    depends_on:
      db:
        condition: service_healthy
    environment:
      USER_AGENT: My FacilMap (https://facilmap.example.org/, facilmap@example.org)
      DB_TYPE: mysql
      DB_HOST: db
      DB_NAME: facilmap
      DB_USER: facilmap
      DB_PASSWORD: password
      ORS_TOKEN: # Get an API key on https://go.openrouteservice.org/ (needed for routing)
      MAPBOX_TOKEN: # Get an API key on https://www.mapbox.com/signup/ (needed for routing)
      MAPZEN_TOKEN: # Get an API key on https://mapzen.com/developers/sign_up (needed for elevation info)
      MAXMIND_USER_ID: # Sign up here https://www.maxmind.com/en/geolite2/signup (needed for geoip lookup to show initial map state)
      MAXMIND_LICENSE_KEY:
    restart: unless-stopped
    labels: # traefik example labels
      - "traefik.enable=true"
      - "traefik.http.routers.maps.rule=Host(`url.example.com`)"
      - "traefik.http.routers.maps.entrypoints=entrypoint"
      - "traefik.http.routers.maps.tls.certresolver=certresolver"
    networks:
      - default
      - traefik

networks:
  default:
  traefik: # This is your external traefik network
    external: true
vabene1111 commented 1 year ago

this issue can either just be closed or if you want be linked in the docs or whatever you prefer, the search will find it if anyone has the same problem i guess :)

also thanks for the great tool, have been looking for something like this for a while.

cdauth commented 9 months ago

Thank you for these tips! In fact, I also ran into these problems when I tried to set up an integration test infrastructure for FacilMap.

I have now added the database healthchecks to the example docker configuration in the FacilMap docs (it will be published with the next release of FacilMap). Also, in the next release the FacilMap docker image itself will have a healthcheck already included.