mpherg / blynk-server

Docker image that runs the Blynk server
MIT License
26 stars 53 forks source link

docker-compose file with traefik #7

Open gerisse opened 6 years ago

gerisse commented 6 years ago

hi i would like use your docker image with tje reverse proxy traefik (https://traefik.io/). i tried another image with this proxy , but it always was with one port redirection. It ran well. Like this image uses multiple ports, i don't know how to build my docker-compose file. Do you have an idea to do this ? thanks a lot best regards

mpherg commented 6 years ago

I've never used Traefik, but it looks pretty cool. Can you post an example docker-compose.yml that you've tried?

gerisse commented 6 years ago

this runs :

version: '2' services: proxy: image: traefik networks:

networks: traefik: external: name: traefik

This github project was my source : https://github.com/pabardina/docker-traefik-gitlab

wanoo commented 6 years ago

I have the web admin working with this proxy, but i didn't have the android apps to work with traefik, if it's a direct connexion it's working, so strange

version: "2"

services:
  blynk:
    image: mpherg/blynk-server:latest
    container_name: blynk
    restart: unless-stopped
    expose:
      - 8080
      - 8441
      - 9443
    volumes:
      - config:/data
    networks:
      - web
    labels:
      - "traefik.docker.network=web"
      - "traefik.enable=true"
      - "traefik.frontend.rule=Host:blynk.exemple.org"
      - "traefik.port=9443"
      - "traefik.protocol=https"

volumes:
  config:

networks:
  web:
    external: true
mpherg commented 6 years ago

@wanoo do you have a separate docker-compose.yml for the traefik container? I don't see it in your post. As-is it looks like I need to go create the web external network, which is fine, but I think it is more useful if we can also see your traefik configuration.

Thanks!

wanoo commented 6 years ago

of course :

version: '2.1'

services:
  traefik:
    image: traefik:1.6.5
    restart: always
    ports:
      - 80:80
      - 443:443
    networks:
      - web
      - default
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.toml:/traefik.toml
      - ./acme.json:/acme.json
    container_name: traefik
    hostname: traefik
    labels:
      - "traefik.enable=true"
      - "traefik.backend=traefik"
      - "traefik.frontend.rule=Host:monitor.exemple.org"
      - "traefik.port=8080"
      - "traefik.docker.network=web"

networks:
  web:
    external: true

You have to understand with traefik i have acces to the admin ui, but with the app no connexion, if i open the port 9443 on the blynk docker and NAT, on my firewall, the connexion with the app work.

I tried with caddy and nginx same issue.

Thanks