version: '3'

services:
  server:
    image: git.app.juetan.cn/appnify/server:latest
    networks:
      - public
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]
      labels:
        - traefik.enable=true
        - traefik.http.routers.aserver.rule=Host(`appnify.app.juetan.cn`) && PathPrefix(`/api`, `/upload`)
        - traefik.http.routers.aserver.entrypoints=websecure
        - traefik.http.routers.aserver.tls=true
        - traefik.http.routers.aserver.tls.certresolver=acmer
        - traefik.http.routers.aserver.middlewares=tohttps@docker
        - traefik.http.services.aserver1.loadbalancer.server.port=3030

  web:
    image: git.app.juetan.cn/appnify/web:latest
    networks:
      - public
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]
      labels:
        - traefik.enable=true
        - traefik.http.routers.aweb.rule=Host(`appnify.app.juetan.cn`)
        - traefik.http.routers.aweb.entrypoints=websecure
        - traefik.http.routers.aweb.tls=true
        - traefik.http.routers.aweb.tls.certresolver=acmer
        - traefik.http.routers.aweb.middlewares=tohttps@docker
        - traefik.http.services.aweb1.loadbalancer.server.port=80

networks:
  public:
    external: true