docker-flow / docker-flow-swarm-listener

Docker Flow Swarm Listener
http://swarmlistener.dockerflow.com/
MIT License
68 stars 49 forks source link

nodeInfo missing on create service notif #37

Open nlevee opened 5 years ago

nlevee commented 5 years ago

Description

The nodeInfo parameter is not present in the service notification some times...

My docker-compose

version: '3.4'

services:
  flow-gateway:
    image: ***
    deploy:
      placement:
        constraints:
          - node.role == worker
      update_config:
        order: start-first
    ports:
      - '80'

  swarm-listener:
    image: dockerflow/docker-flow-swarm-listener:18.11.07-18
    deploy:
      placement:
        constraints:
          - node.role == manager
      update_config:
        order: start-first
    volumes:
        - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - 'DF_INCLUDE_NODE_IP_INFO=true'
      - 'DF_NOTIFY_CREATE_SERVICE_URL=http://flow-gateway/create-service.php'

Steps to reproduce the issue:

  1. Restart docker (dockerflow/docker-flow-swarm-listener:18.11.07-18)

Results received:

10.0.14.4 - - [15/Nov/2018:14:06:55 +0000] "GET /create-service.php?consulName=admin-http&distribute=true&port=80&replicas=2&scrapeNetwork=udm_webapp_default&serviceName=udm_webapp_webapp-admin-http&stackName=udm_webapp HTTP/1.1" 200 350 "-" "Go-http-client/1.1"

Results expected:

10.0.14.4 - - [15/Nov/2018:14:09:26 +0000] "GET /create-service.php?consulName=admin-http&distribute=true&nodeInfo=%5B%5B%22webapp-cluster-dn62%22%2C%2210.0.0.82%22%2C%22zouf5zgoxao4af8w7yo4wzskp%22%5D%2C%5B%22webapp-cluster-cgp5%22%2C%2210.0.0.78%22%2C%22pxmvw8hkpkcrxqs118gr0hkuu%22%5D%5D&port=80&replicas=2&scrapeNetwork=udm_webapp_default&serviceName=udm_webapp_webapp-admin-http&stackName=udm_webapp HTTP/1.1" 200 173 "-" "Go-http-client/1.1"
thomasjpfan commented 5 years ago

How is udm_webapp_webapp-admin-http defined?

nlevee commented 5 years ago

I use the label definition :

labels:
        com.df.consulName: 'admin-http'
        com.df.stackName: 'udm_webapp'
        com.df.scrapeNetwork: 'udm_webapp_default'
        com.df.notify: 'true'
        com.df.port: '80'

in my docker-compose.yml file

thomasjpfan commented 5 years ago

In your original post, you state that does sometimes happens. Are you able to pinpoint when exactly it happens?

nlevee commented 5 years ago

it's happen i think when a service is updated with

docker stack deploy --prune ...

nlevee commented 5 years ago

When I restart the listener every notification are send like this :

http://IP_GATEWAY/reconfigure.php?consulName=front-http&distribute=true&port=80&replicas=3&scrapeNetwork=***_webapp_default&serviceName=***_webapp_webapp-front-http&stackName=***_webapp

The nodeInfo is empty but the number of replicas is ok.

thomasjpfan commented 5 years ago

Is DFSL able to access the overlay network that the service is connected to?

nlevee commented 5 years ago

My swarm listener is in a stack separate from the others, exemple of my web stack :

version: '3.4'

services:
  front-gateway:
    image: varnish-consul-template:latest
    ports:
      - "80"
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "1"
    deploy:
      placement: *placement_worker_webapp
      mode: replicated
      replicas: 2
      labels:
        com.df.consulName: 'front-gateway'
        com.df.stackName: 'xxxxxx_webapp'
        com.df.scrapeNetwork: 'xxxxxx_webapp_default'
        com.df.notify: 'true'
        com.df.port: '80'
      restart_policy:
        condition: on-failure
      update_config:
        order: start-first
        delay: 10s
        parallelism: 1
      resources:
        reservations:
          memory: 1G

Is that a problem ?

thomasjpfan commented 5 years ago

Check that the front-gateway service is connected to the xxxxxx_webapp_default overlay network. (Also xxxxxx_webapp_default needs to be an overlay network).

nlevee commented 5 years ago

ok I try and give you feedback. Thanks