Задать вопрос
  • Почему Cannot resolve keyword 'china_code' into field?

    @kkolorid Автор вопроса
    Разобрался.

    from asia_cars.calc import *
    from asia_cars.functions import *


    Эти импорты после импортов моделей и сериалайзеров давали конфликты имен между подприложениями
    Ответ написан
    Комментировать
  • Как поднять Telegram WebHook с Aiogram + WebApps на Docker?

    @kkolorid Автор вопроса
    Сильно помог Traefik. Но остановился на добавлнеии веб составляющей.

    docker-compose.yml
    version: '3.7'
    
    services:
    
      db:
        image: mysql:5.7
        environment:
          MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
          MYSQL_DATABASE: ${MYSQL_DATABASE}
          MYSQL_USER: ${MYSQL_USERNAME}
          MYSQL_PASSWORD: ${MYSQL_USER_PASSWORD}
        ports:
          - "6033:3306"
        restart: on-failure
        volumes:
          - dbdata:/var/lib/mysql
    
      phpmyadmin:
        image: phpmyadmin/phpmyadmin
        links:
          - db
        environment:
          PMA_HOST: db
          PMA_PORT: 3306
          PMA_ARBITRARY: 1
        restart: on-failure
        ports:
          - 8081:80
    
      bot:
        container_name: bot
        build: .
        command: sh -c "python bot.py"
        depends_on:
          - db
          - phpmyadmin
        env_file:
          - ./.env
        ports:
          - 5000:5000
        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.registry.rule=Host(`bot.free-shop24.ru`)"
          - "traefik.http.routers.registry.entrypoints=websecure"
          - "traefik.http.routers.registry.tls.certresolver=myresolver"
          - "traefik.http.routers.registry.middlewares=traefik-compress"
    
      web:
        container_name: web
        build: ./flask
        depends_on:
          - db
          - phpmyadmin
        ports:
          - 5001:5001
        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.registry.rule=Host(`web.free-shop24.ru`)"
          - "traefik.http.routers.registry.entrypoints=websecure"
          - "traefik.http.routers.registry.tls.certresolver=myresolver"
          - "traefik.http.routers.registry.middlewares=traefik-compress"
        restart: unless-stopped
    
      traefik:
        image: "traefik:v2.4"
        container_name: "traefik"
        command:
          - "--api.insecure=true"
          - "--providers.docker=true"
          - "--providers.docker.exposedbydefault=false"
          - "--entrypoints.web.address=:80"
          - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
          - "--entrypoints.websecure.address=:443"
          - "--certificatesresolvers.myresolver.acme.httpchallenge=true"
          - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
          - "--certificatesresolvers.myresolver.acme.email=jump.or.jump@gmail.com"
          - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
        ports:
          - "80:80"
          - "443:443"
          - "8080:8080"
        networks:
          - bot_default
        volumes:
          - "letsencrypt:/letsencrypt"
          - "/var/run/docker.sock:/var/run/docker.sock:ro"
        labels:
          - "traefik.http.middlewares.traefik-compress.compress=true"
          - "traefik.enable=true"
          - "traefik.http.routers.traefik.rule=Host(`free-shop24.ru`)"
          - "traefik.http.routers.traefik.entrypoints=websecure"
          - "traefik.http.routers.traefik.tls.certresolver=myresolver"
          - "traefik.http.routers.traefik.service=api@internal"
          - "traefik.http.routers.traefik.middlewares=traefik-compress"
    
    volumes:
      letsencrypt:
      dbdata:
    
    networks:
      bot_default:
        external: true


    Бот уже отвечает по поддомену "bot.", но вот добавленный ".web" под Flask дает: service \"web-bot\" error: unable to find the IP address for the container \"/web\": the server is ignored
    Ответ написан
    Комментировать