networks:
  traefik-public:
    external: true
services:
  backend:
    build:
      args:
        INSTALL_DEV: "true"
        INSTALL_JUPYTER: "false"
      context: /root/video-maker/backend
      dockerfile: backend.dockerfile
    command: /start-reload.sh
    deploy:
      labels:
        traefik.constraint-label-stack: cloud.choozmo.com
        traefik.enable: "true"
        traefik.http.routers.ai-anchor-com-backend-http.rule: PathPrefix(`/api`) ||
          PathPrefix(`/docs`) || PathPrefix(`/redoc`)
        traefik.http.services.ai-anchor-com-backend.loadbalancer.server.port: '80'
    environment:
      BACKEND_CORS_ORIGINS: '["https://cloud.choozmo:8080", "http://cloud.choozmo.com:8080",
        "https://cloud.choozmo.com", "http://cloud.choozmo.com","http://172.105.219.42",
        "http://local.ai-anchor.com:5173", "http://local.ai-anchor.com:8080", "http://localhost",
        "http://localhost:4200", "http://localhost:3000", "http://localhost:5173",
        "http://localhost:8080", "https://localhost", "https://localhost:4200", "https://localhost:3000",
        "https://localhost:8080", "http://dev.ai-anchor.com:3000", "http://dev.ai-anchor.com:5173",
        "http://dev.ai-anchor.com:8080", "https://stag.ai-anchor.com", "https://ai-anchor.com",
        "http://local.dockertoolbox.tiangolo.com", "http://localhost.tiangolo.com"]'
      BACKEND_VIDEO_STORAGE: backend_storage/videos
      BACKEND_ZIP_STORAGE: backend_storage/zips
      CELERY_VIDEO_STORAGE: celery_storage/videos
      CELERY_ZIP_STORAGE: celery_storage/zips
      DOCKER_IMAGE_BACKEND: backend
      DOCKER_IMAGE_CELERYWORKER: gpuceleryworker
      DOCKER_IMAGE_FRONTEND: frontend
      DOMAIN: cloud.choozmo.com:8080
      EMAILS_FROM_EMAIL: info@ai-anchor.com
      FIRST_SUPERUSER: admin@ai-anchor.com
      FIRST_SUPERUSER_PASSWORD: password
      FLOWER_BASIC_AUTH: admin:password
      LOCAL_VIDEO_STORAGE: local_storage/videos
      LOCAL_ZIP_STORAGE: local_storage/zips
      MEMBERSHIP_STATUS: '["normal", "infinite"]'
      PGADMIN_DEFAULT_EMAIL: admin@ai-anchor.com
      PGADMIN_DEFAULT_PASSWORD: password
      PGADMIN_LISTEN_PORT: '5050'
      POSTGRES_DB: app
      POSTGRES_PASSWORD: password
      POSTGRES_SERVER: db
      POSTGRES_USER: postgres
      PROGRESS_STATE: '["waiting", "processing", "completed", "failed"]'
      PROJECT_NAME: AI anchor
      SECRET_KEY: 1df1f2180c7b2550e76a8ccf5e67a76e5321d8c2d3fee4a725f8b80baf9a0c91
      SENTRY_DSN: ''
      SERVER_ADDRESS: http://localhost
      SERVER_HOST: http://cloud.choozmo.com
      SERVER_NAME: cloud.choozmo.com
      SMTP_HOST: smtp.gmail.com
      SMTP_PASSWORD: hlmaxzjnvpeaulhw
      SMTP_PORT: '587'
      SMTP_TLS: "True"
      SMTP_USER: verify@choozmo.com
      STACK_NAME: ai-anchor-com
      TRAEFIK_PUBLIC_NETWORK: traefik-public
      TRAEFIK_PUBLIC_TAG: traefik-public
      TRAEFIK_TAG: ai-anchor.com
      USERS_OPEN_REGISTRATION: "True"
    image: backend:cloud
    labels:
      traefik.constraint-label-stack: cloud.choozmo.com
      traefik.enable: "true"
      traefik.http.routers.ai-anchor-com-backend-http.rule: PathPrefix(`/api`) ||
        PathPrefix(`/docs`) || PathPrefix(`/redoc`)
      traefik.http.services.ai-anchor-com-backend.loadbalancer.server.port: '80'
    volumes:
    - /root/video-maker/backend/app:/app:rw
    - /backend_storage/videos:/app/backend_storage/videos:rw
    - /backend_storage/zips:/app/backend_storage/zips:rw
  frontend:
    build:
      args:
        FRONTEND_ENV: dev
      context: /root/video-maker/frontend
    deploy:
      labels:
        traefik.constraint-label-stack: cloud.choozmo.com
        traefik.enable: "true"
        traefik.http.routers.ai-anchor-com-frontend-http.rule: PathPrefix(`/`)
        traefik.http.services.ai-anchor-com-frontend.loadbalancer.server.port: '80'
    image: frontend:cloud
    labels:
      traefik.constraint-label-stack: cloud.choozmo.com
      traefik.enable: "true"
      traefik.http.routers.ai-anchor-com-frontend-http.rule: PathPrefix(`/`)
      traefik.http.services.ai-anchor-com-frontend.loadbalancer.server.port: '80'
  proxy:
    command:
    - --providers.docker
    - --providers.docker.constraints=Label(`traefik.constraint-label-stack`, `cloud.choozmo.com`)
    - --providers.docker.exposedbydefault=false
    - --accesslog
    - --log
    - --api
    - --api.insecure=true
    deploy:
      labels:
        traefik.constraint-label: traefik-public
        traefik.docker.network: traefik-public
        traefik.enable: "true"
        traefik.http.middlewares.ai-anchor-com-https-redirect.redirectscheme.permanent: "true"
        traefik.http.middlewares.ai-anchor-com-https-redirect.redirectscheme.scheme: https
        traefik.http.middlewares.ai-anchor-com-www-redirect.redirectregex.regex: ^https?://(www.)?(cloud.choozmo.com)/(.*)
        traefik.http.middlewares.ai-anchor-com-www-redirect.redirectregex.replacement: https://cloud.choozmo.com/$${3}
        traefik.http.routers.ai-anchor-com-proxy-http.entrypoints: http
        traefik.http.routers.ai-anchor-com-proxy-http.middlewares: ai-anchor-com-www-redirect,ai-anchor-com-https-redirect
        traefik.http.routers.ai-anchor-com-proxy-http.rule: Host(`cloud.choozmo.com`)
          || Host(`www.cloud.choozmo.com`)
        traefik.http.routers.ai-anchor-com-proxy-https.entrypoints: https
        traefik.http.routers.ai-anchor-com-proxy-https.middlewares: ai-anchor-com-www-redirect
        traefik.http.routers.ai-anchor-com-proxy-https.rule: Host(`cloud.choozmo.com`)
          || Host(`www.cloud.choozmo.com`)
        traefik.http.routers.ai-anchor-com-proxy-https.tls: "true"
        traefik.http.routers.ai-anchor-com-proxy-https.tls.certresolver: le
        traefik.http.services.ai-anchor-com-proxy.loadbalancer.server.port: '80'
      placement:
        constraints:
        - node.role == manager
    image: traefik:v2.9
    labels:
      traefik.enable: "true"
      traefik.http.routers.ai-anchor-com-traefik-public-http.rule: Host(`cloud.choozmo.com`)
      traefik.http.services.ai-anchor-com-traefik-public.loadbalancer.server.port: '80'
    networks:
      default: {}
      traefik-public: {}
    ports:
    - published: 80
      target: 80
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock:rw
version: '3.3'

