Skip to content

Certs in Secret are generated every minute #15

@Vad1mo

Description

@Vad1mo

I have setup docker-flow-proxy-letsencrypt to use docker secrets, everything is working except that the certs are generated on each redeploy or each minute(if there are requests).

Example:

Secret Name | Creation Date
whoami.exmaple.com.pem-20171225-235020 | 2017-12-26 00:50:20 
whoami.exmaple.com.pem-20171225-234920 | 2017-12-26 00:49:20 
whoami.exmaple.com.pem-20171225-234820 | 2017-12-26 00:48:20 

Alle secrets have different Private and Public Cert.

I created the Proxy relatively straight forward from the examples. Only difference is the network name proxy_net and the constraints on manager.

proxy-stack.yml

version: "3"
services:
  proxy:
    image: vfarcic/docker-flow-proxy
    ports:
      - 80:80
      - 443:443
    networks:
      - net
    environment:
      - LISTENER_ADDRESS=swarm-listener
      - MODE=swarm
      - SERVICE_NAME=proxy_proxy
    deploy:
      mode: global
      placement:
        constraints: [node.role == worker]

  swarm-listener:
    image: vfarcic/docker-flow-swarm-listener
    networks:
      - net
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DF_NOTIFY_CREATE_SERVICE_URL=http://proxy-le:8080/v1/docker-flow-proxy-letsencrypt/reconfigure
      - DF_NOTIFY_REMOVE_SERVICE_URL=http://proxy_proxy:8080/v1/docker-flow-proxy/remove
    deploy:
      placement:
        constraints: [node.role == manager]

  proxy-le:
    image: nib0r/docker-flow-proxy-letsencrypt
    networks:
      - net
    environment:
      - DF_PROXY_SERVICE_NAME=proxy_proxy
      - CERTBOT_OPTIONS=--staging
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      replicas: 1
      placement:
        constraints: [node.role == manager]      
      labels:
        - com.df.notify=true
        - com.df.distribute=true
        - com.df.servicePath=/.well-known/acme-challenge
        - com.df.port=8080
networks:
  net:

The sample application I am trying to deploy. The only difference here is that I force the redirect from http to https.

version: "3"
services:
  whoami:
    image: jwilder/whoami
    networks:
      - proxy_net
    deploy:
      replicas: 1
      labels:
        - com.df.notify=true
        - com.df.distribute=true
        - com.df.serviceDomain=whoami.exmaple.com
        #- com.df.servicePath=/
        #- com.df.srcPort=443
        - com.df.port=8000
        - com.df.httpsOnly=true
        - com.df.httpsRedirectCode=301        
        - com.df.letsencrypt.host=whoami.exmaple.com
        - com.df.letsencrypt.email=vb@8gears.com
networks:
  proxy_net:
    external: true

In the docs I found this Info Block about Certs

Info
Since many other types of information can be stored as secrets, Docker Flow Proxy assumes that secrets that should be used as certificates are prefixed with cert- or cert_. Secrets with any other naming convention will not be loaded as certificates.

Maybe this is the reason the flow proxy cant find the certs and recreates.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions