BaseAdresseNationale / addok-docker

Conteneurs Addok pour Docker
151 stars 28 forks source link

Host addok on Docker Swarm #15

Closed frinux closed 1 year ago

frinux commented 5 years ago

I'm trying to run addok (server + redis) on a Docker Swarm, but I have a stability problem.

Here is my docker-compose:

version: '3.4'
services:

  addok:
    image: etalab/addok
    ports:
      - "7878:7878"
    volumes:
      - /home/ubuntu/addok-data/addok.conf:/etc/addok/addok.conf
      - /home/ubuntu/addok-data/addok.db:/data/addok.db
    environment:
      WORKERS: 1
      WORKER_TIMEOUT: 30
      LOG_QUERIES: 0
      LOG_NOT_FOUND: 0
      SLOW_QUERIES: 200
      REDIS_HOST: addok-redis
    deploy:
      mode: global
      placement:
        constraints:
          - node.role == worker
          - node.labels.app-adressedatagouv == True
      restart_policy:
        condition: on-failure
      labels:
        - traefik.enable=true
        - traefik.frontend.rule=Host:adressedatagouv.myurl.com
        - traefik.port=7878
        - traefik.docker.network=my_proxy_network
        - traefik.backend=adressedatagouv
    depends_on:
      - addok-redis
    networks:
      - my_proxy_network

  addok-redis:
    image: etalab/addok-redis
    volumes:
      - /home/ubuntu/addok-data/dump.rdb:/data/dump.rdb
    ports:
      - "6379:6379"
    deploy:
      mode: global
      placement:
        constraints:
          - node.role == worker
          - node.labels.app-adressedatagouv == True
      restart_policy:
        condition: on-failure
    networks:
      - my_proxy_network

networks:
  my_proxy_network:
    external: true

Application is hosted behind a traefik proxy server, all of them on the same network.

When application starts, it is running fine. But after some hours, Addok stills respond but with an empty result set:

{
  "type": "FeatureCollection",
  "version": "draft",
  "features": [],
  "attribution": "BAN",
  "licence": "ODbL 1.0",
  "query": "1 rue de la paix paris",
  "limit": 5
}

I must then update the Docker service, and it is going back to normal.

Is there any way to understand what is going on with this particular service? Some debug logs we could activate?

Thanks

jdesboeufs commented 5 years ago

I'm not familiar with Docker Swarm. Can you give me some commands to reproduce?

Each addok instance must be thin-coupled with its redis storage, on the same host.

frinux commented 5 years ago

It's hard to reproduce, as the moment it happens seems to be "random" Not sure if it is related to Docker Swarm: the 2 containers are running on the same host, the only difference would be the traefik proxy, I doubt it comes from here. The docker-compose.yml file is almost the same as the example. It would be useful to understand why addok returns no error but also no result, while it was returning results a few seconds ago. Is there any "debug mode"?

jdesboeufs commented 1 year ago

This project is rebooted. I close for the moment, feel free to re-open!