Problema ao atualizar o Dify #20347

Closed
opened 2026-02-21 20:06:57 -05:00 by yindo · 1 comment
Owner

Originally created by @johncosta2021 on GitHub (Nov 16, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

Qualquer Versão

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Hi, how are you?
So, I'm having trouble deploying to the Dify Stack.
On the first Dify installation, the Stack works perfectly. When I need to deploy to a more recent version, it shows the following error: "502 Bad Gateway
nginx/1.29.3".

I already asked ChatGbt for help and their answer was: "The nginx container started before the plugin_daemon container and ends up not finding the plugin_daemon".

I can even solve the problem by doing a workaround, like starting the Dify Stack without the nginx container and then, after a few minutes, adding the nginx container. I would like to solve this problem without having to do this whole procedure, just clicking "deploy".

I will leave the stack I use so you can check for possible problems. Remember that some information is incomplete for security reasons.

Image
  api:
    image: langgenius/dify-api:latest
    volumes:
      - storage_data:/app/api/storage
    networks:
      - traefik_public
      - digital_network
    environment:
      - MODE=api
      - LOG_LEVEL=INFO
      - SECRET_KEY=e5787297a068ec2fb50c862d
      #- DIFY_INNER_API_KEY=QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691iy
      - PLUGIN_DAEMON_KEY=QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691i
      - CONSOLE_WEB_URL=https://dify.meu_dominio.com
      - INIT_PASSWORD=
      - CONSOLE_API_URL=
      - SERVICE_API_URL=
      - FILES_URL=
      ## Url Dify
      - APP_WEB_URL=https://dify.meu_dominio.com
      - PLUGIN_DAEMON_URL=http://plugin_daemon:5002
      ## Dados Postgres
      - MIGRATION_ENABLED=true
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_DATABASE=difydb
      ## Dados Redis
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - REDIS_USE_SSL=false
      - REDIS_DB=0
      - CELERY_BROKER_URL=redis://redis:6379/1
      ## Liberar acesso a todos os ip
      - WEB_API_CORS_ALLOW_ORIGINS=*
      - CONSOLE_CORS_ALLOW_ORIGINS=*
      ## Dados sobre armazenamento s3
      - STORAGE_TYPE=local
      - STORAGE_LOCAL_PATH=storage
      - S3_ENDPOINT=miniobackend.meu_dominio.com
      - S3_BUCKET_NAME=dify
      - S3_ACCESS_KEY= <acess_key>
      - S3_SECRET_KEY= <secret_key>
      ## Dados Weaviate
      - VECTOR_STORE=weaviate
      - WEAVIATE_ENDPOINT=http://weaviate:8080
      - WEAVIATE_API_KEY=e5787297a068ec2
      - WEAVIATE_CLIENT_TIMEOUT=20
      ## Dados do Email
      - MAIL_TYPE=smtp
      - MAIL_DEFAULT_SEND_FROM=email@gmail.com (eg=no-reply email@gmail.com) #atenção
      - SMTP_SERVER=ssmtp-relay.brevo.com
      - SMTP_PORT=587
      - SMTP_USERNAME=email@gmail.com
      - SMTP_PASSWORD=S0yxnf9XIVZ3WNCr
      ## Sentry
      - SENTRY_DSN=
      - SENTRY_TRACES_SAMPLE_RATE=1.0
      - SENTRY_PROFILES_SAMPLE_RATE=1.0

    command: >
      sh -c "flask db stamp head && flask db upgrade && gunicorn --bind 0.0.0.0:5000 'app:create_app()'"

    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.role == manager
      resources:
        limits:
          cpus: "1"
          memory: 1024M

  worker:
    image: langgenius/dify-api:latest
    volumes:
      - storage_data:/app/api/storage
    networks:
      - traefik_public
      - digital_network
    environment:
      - MODE=worker
      - LOG_LEVEL=INFO
      - SECRET_KEY=e5787297a068e
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_DATABASE=difydb
      ## Dados Redis
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - REDIS_USE_SSL=false
      - REDIS_DB=0
      - CELERY_BROKER_URL=redis://redis:6379/1
      ## Dados Weaviate
      - STORAGE_TYPE=local
      - STORAGE_LOCAL_PATH=storage
      - VECTOR_STORE=weaviate
      - WEAVIATE_ENDPOINT=http://weaviate:8080
      - WEAVIATE_API_KEY=e5787297a068ec2fb
      - WEAVIATE_CLIENT_TIMEOUT=20
      ## Dados do Email
      - MAIL_TYPE=smtp
      - MAIL_DEFAULT_SEND_FROM=email@gmail.com (eg=no-reply email@gmail.com)
      - SMTP_SERVER=smtp-relay.brevo.com
      - SMTP_PORT=587
      - SMTP_USERNAME=email@gmail.com
      - SMTP_PASSWORD=S0yxnf9

    depends_on:
      - postgres
      - redis
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.role == manager
      resources:
        limits:
          cpus: "0.5"
          memory: 1024M

  plugin_daemon:
    image: langgenius/dify-plugin-daemon:0.3.0-local
    volumes:
      - storage_data:/app/storage
    networks:
      - traefik_public
      - digital_network
    environment:
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_DATABASE=difydb
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - REDIS_USE_SSL=false
      - REDIS_DB=0
      - SERVER_PORT=5002
      - SERVER_KEY=QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691
      - MAX_PLUGIN_PACKAGE_SIZE=52428800
      - PPROF_ENABLED=false
      - DIFY_INNER_API_URL=http://api:5001
      - DIFY_INNER_API_KEY=QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691
      - PLUGIN_REMOTE_INSTALLING_HOST=0.0.0.0
      - PLUGIN_REMOTE_INSTALLING_PORT=5003
      - PLUGIN_WORKING_PATH=/app/storage/cwd
      - FORCE_VERIFYING_SIGNATURE=true
      - PYTHON_ENV_INIT_TIMEOUT=120
      - PLUGIN_MAX_EXECUTION_TIMEOUT=600
      - PLUGIN_STORAGE_TYPE=local
      - PLUGIN_STORAGE_LOCAL_ROOT=/app/storage
      - PLUGIN_INSTALLED_PATH=plugin
      - PLUGIN_PACKAGE_CACHE_PATH=plugin_packages
      - PLUGIN_MEDIA_CACHE_PATH=assets
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.role == manager
      resources:
        limits:
          cpus: "0.5"
          memory: 1024M

  web:
    image: langgenius/dify-web:latest # Versão do Dify
    networks:
      - traefik_public
      - digital_network
    environment:
      - EDITION=SELF_HOSTED
      - CONSOLE_API_URL=
      # Url Dify
      - APP_API_URL=dify.meu_dominio.com
      - SENTRY_DSN=
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.role == manager
      resources:
        limits:
          cpus: "1"
          memory: 1024M

  #nginx
  nginx:
    image: nginx:latest
    entrypoint: ["sh", "-c", "sleep 60 && chmod +x /docker-entrypoint.sh && /docker-entrypoint.sh"] # Atrasar 60 segundos para subir
    volumes:
      - /root/nginx/nginx.conf.template:/etc/nginx/nginx.conf.template
      - /root/nginx/proxy.conf.template:/etc/nginx/proxy.conf.template
      - /root/nginx/conf.d:/etc/nginx/conf.d
      - /root/nginx/docker-entrypoint.sh:/docker-entrypoint.sh
      - /root/nginx/ssl:/etc/ssl
    networks:
      - traefik_public
      - digital_network
    environment:
      - NGINX_SSL_CERT_FILENAME=dify.crt
      - NGINX_SSL_CERT_KEY_FILENAME=dify.key
      - NGINX_SSL_PROTOCOLS=TLSv1.1 TLSv1.2 TLSv1.3
      - NGINX_WORKER_PROCESSES=auto
      - NGINX_CLIENT_MAX_BODY_SIZE=15M
      - NGINX_KEEPALIVE_TIMEOUT=65
      - NGINX_PROXY_READ_TIMEOUT=3600s
      - NGINX_PROXY_SEND_TIMEOUT=3600s
      - NGINX_SERVER_NAME=_
      - NGINX_PORT=80

    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.role == manager
      resources:
        limits:
          cpus: "0.5"
          memory: 2048M
      labels:
        - traefik.enable=true
        - traefik.http.routers.nginx.rule=Host(`dify.meu_dominio.com`) # Url do Dify
        - traefik.http.routers.nginx.entrypoints=websecure
        - traefik.http.routers.nginx.tls.certresolver=le
        - traefik.http.services.nginx.loadbalancer.server.port=80
        - traefik.http.services.nginx.loadbalancer.passHostHeader=true
        - traefik.http.routers.nginx.service=nginx

  weaviate:
    image: semitechnologies/weaviate:1.19.0
    volumes:
      - weaviate_data:/var/lib/weaviate
    environment:
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
      PERSISTENCE_DATA_PATH: /var/lib/weaviate
      DEFAULT_VECTORIZER_MODULE: none
      CLUSTER_HOSTNAME: node1
      AUTHENTICATION_APIKEY_ENABLED: 'true'
      AUTHENTICATION_APIKEY_ALLOWED_KEYS: e5787297a068ec2fb50c8
      AUTHORIZATION_ADMINLIST_ENABLED: 'true'
      AUTHORIZATION_ADMINLIST_USERS: hello@dify.ai
    networks:
      - traefik_public
      - digital_network
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.role == manager
      resources:
        limits:
          cpus: "1"
          memory: 2048M

volumes:
  storage_data:
    external: true
    name: storage_data
  weaviate_data:
    external: true
    name: weaviate_data

networks:
  traefik_public:
    external: true
  digital_network:
    external: true

✔️ Expected Behavior

Resolver o problema ao fazer o Deploy na Stack do Dify.

Actual Behavior

No response

Originally created by @johncosta2021 on GitHub (Nov 16, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version Qualquer Versão ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Hi, how are you? So, I'm having trouble deploying to the Dify Stack. On the first Dify installation, the Stack works perfectly. When I need to deploy to a more recent version, it shows the following error: "502 Bad Gateway nginx/1.29.3". I already asked ChatGbt for help and their answer was: "The nginx container started before the plugin_daemon container and ends up not finding the plugin_daemon". I can even solve the problem by doing a workaround, like starting the Dify Stack without the nginx container and then, after a few minutes, adding the nginx container. I would like to solve this problem without having to do this whole procedure, just clicking "deploy". I will leave the stack I use so you can check for possible problems. Remember that some information is incomplete for security reasons. <img width="1179" height="188" alt="Image" src="https://github.com/user-attachments/assets/19ea9d2a-e5c0-4cef-b4a2-1b6f238f247d" /> ```services: api: image: langgenius/dify-api:latest volumes: - storage_data:/app/api/storage networks: - traefik_public - digital_network environment: - MODE=api - LOG_LEVEL=INFO - SECRET_KEY=e5787297a068ec2fb50c862d #- DIFY_INNER_API_KEY=QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691iy - PLUGIN_DAEMON_KEY=QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691i - CONSOLE_WEB_URL=https://dify.meu_dominio.com - INIT_PASSWORD= - CONSOLE_API_URL= - SERVICE_API_URL= - FILES_URL= ## Url Dify - APP_WEB_URL=https://dify.meu_dominio.com - PLUGIN_DAEMON_URL=http://plugin_daemon:5002 ## Dados Postgres - MIGRATION_ENABLED=true - DB_USERNAME=postgres - DB_PASSWORD=postgres - DB_HOST=postgres - DB_PORT=5432 - DB_DATABASE=difydb ## Dados Redis - REDIS_HOST=redis - REDIS_PORT=6379 - REDIS_USE_SSL=false - REDIS_DB=0 - CELERY_BROKER_URL=redis://redis:6379/1 ## Liberar acesso a todos os ip - WEB_API_CORS_ALLOW_ORIGINS=* - CONSOLE_CORS_ALLOW_ORIGINS=* ## Dados sobre armazenamento s3 - STORAGE_TYPE=local - STORAGE_LOCAL_PATH=storage - S3_ENDPOINT=miniobackend.meu_dominio.com - S3_BUCKET_NAME=dify - S3_ACCESS_KEY= <acess_key> - S3_SECRET_KEY= <secret_key> ## Dados Weaviate - VECTOR_STORE=weaviate - WEAVIATE_ENDPOINT=http://weaviate:8080 - WEAVIATE_API_KEY=e5787297a068ec2 - WEAVIATE_CLIENT_TIMEOUT=20 ## Dados do Email - MAIL_TYPE=smtp - MAIL_DEFAULT_SEND_FROM=email@gmail.com (eg=no-reply email@gmail.com) #atenção - SMTP_SERVER=ssmtp-relay.brevo.com - SMTP_PORT=587 - SMTP_USERNAME=email@gmail.com - SMTP_PASSWORD=S0yxnf9XIVZ3WNCr ## Sentry - SENTRY_DSN= - SENTRY_TRACES_SAMPLE_RATE=1.0 - SENTRY_PROFILES_SAMPLE_RATE=1.0 command: > sh -c "flask db stamp head && flask db upgrade && gunicorn --bind 0.0.0.0:5000 'app:create_app()'" deploy: mode: replicated replicas: 1 placement: constraints: - node.role == manager resources: limits: cpus: "1" memory: 1024M worker: image: langgenius/dify-api:latest volumes: - storage_data:/app/api/storage networks: - traefik_public - digital_network environment: - MODE=worker - LOG_LEVEL=INFO - SECRET_KEY=e5787297a068e - DB_USERNAME=postgres - DB_PASSWORD=postgres - DB_HOST=postgres - DB_PORT=5432 - DB_DATABASE=difydb ## Dados Redis - REDIS_HOST=redis - REDIS_PORT=6379 - REDIS_USE_SSL=false - REDIS_DB=0 - CELERY_BROKER_URL=redis://redis:6379/1 ## Dados Weaviate - STORAGE_TYPE=local - STORAGE_LOCAL_PATH=storage - VECTOR_STORE=weaviate - WEAVIATE_ENDPOINT=http://weaviate:8080 - WEAVIATE_API_KEY=e5787297a068ec2fb - WEAVIATE_CLIENT_TIMEOUT=20 ## Dados do Email - MAIL_TYPE=smtp - MAIL_DEFAULT_SEND_FROM=email@gmail.com (eg=no-reply email@gmail.com) - SMTP_SERVER=smtp-relay.brevo.com - SMTP_PORT=587 - SMTP_USERNAME=email@gmail.com - SMTP_PASSWORD=S0yxnf9 depends_on: - postgres - redis deploy: mode: replicated replicas: 1 placement: constraints: - node.role == manager resources: limits: cpus: "0.5" memory: 1024M plugin_daemon: image: langgenius/dify-plugin-daemon:0.3.0-local volumes: - storage_data:/app/storage networks: - traefik_public - digital_network environment: - DB_USERNAME=postgres - DB_PASSWORD=postgres - DB_HOST=postgres - DB_PORT=5432 - DB_DATABASE=difydb - REDIS_HOST=redis - REDIS_PORT=6379 - REDIS_USE_SSL=false - REDIS_DB=0 - SERVER_PORT=5002 - SERVER_KEY=QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691 - MAX_PLUGIN_PACKAGE_SIZE=52428800 - PPROF_ENABLED=false - DIFY_INNER_API_URL=http://api:5001 - DIFY_INNER_API_KEY=QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691 - PLUGIN_REMOTE_INSTALLING_HOST=0.0.0.0 - PLUGIN_REMOTE_INSTALLING_PORT=5003 - PLUGIN_WORKING_PATH=/app/storage/cwd - FORCE_VERIFYING_SIGNATURE=true - PYTHON_ENV_INIT_TIMEOUT=120 - PLUGIN_MAX_EXECUTION_TIMEOUT=600 - PLUGIN_STORAGE_TYPE=local - PLUGIN_STORAGE_LOCAL_ROOT=/app/storage - PLUGIN_INSTALLED_PATH=plugin - PLUGIN_PACKAGE_CACHE_PATH=plugin_packages - PLUGIN_MEDIA_CACHE_PATH=assets deploy: mode: replicated replicas: 1 placement: constraints: - node.role == manager resources: limits: cpus: "0.5" memory: 1024M web: image: langgenius/dify-web:latest # Versão do Dify networks: - traefik_public - digital_network environment: - EDITION=SELF_HOSTED - CONSOLE_API_URL= # Url Dify - APP_API_URL=dify.meu_dominio.com - SENTRY_DSN= deploy: mode: replicated replicas: 1 placement: constraints: - node.role == manager resources: limits: cpus: "1" memory: 1024M #nginx nginx: image: nginx:latest entrypoint: ["sh", "-c", "sleep 60 && chmod +x /docker-entrypoint.sh && /docker-entrypoint.sh"] # Atrasar 60 segundos para subir volumes: - /root/nginx/nginx.conf.template:/etc/nginx/nginx.conf.template - /root/nginx/proxy.conf.template:/etc/nginx/proxy.conf.template - /root/nginx/conf.d:/etc/nginx/conf.d - /root/nginx/docker-entrypoint.sh:/docker-entrypoint.sh - /root/nginx/ssl:/etc/ssl networks: - traefik_public - digital_network environment: - NGINX_SSL_CERT_FILENAME=dify.crt - NGINX_SSL_CERT_KEY_FILENAME=dify.key - NGINX_SSL_PROTOCOLS=TLSv1.1 TLSv1.2 TLSv1.3 - NGINX_WORKER_PROCESSES=auto - NGINX_CLIENT_MAX_BODY_SIZE=15M - NGINX_KEEPALIVE_TIMEOUT=65 - NGINX_PROXY_READ_TIMEOUT=3600s - NGINX_PROXY_SEND_TIMEOUT=3600s - NGINX_SERVER_NAME=_ - NGINX_PORT=80 deploy: mode: replicated replicas: 1 placement: constraints: - node.role == manager resources: limits: cpus: "0.5" memory: 2048M labels: - traefik.enable=true - traefik.http.routers.nginx.rule=Host(`dify.meu_dominio.com`) # Url do Dify - traefik.http.routers.nginx.entrypoints=websecure - traefik.http.routers.nginx.tls.certresolver=le - traefik.http.services.nginx.loadbalancer.server.port=80 - traefik.http.services.nginx.loadbalancer.passHostHeader=true - traefik.http.routers.nginx.service=nginx weaviate: image: semitechnologies/weaviate:1.19.0 volumes: - weaviate_data:/var/lib/weaviate environment: QUERY_DEFAULTS_LIMIT: 25 AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false' PERSISTENCE_DATA_PATH: /var/lib/weaviate DEFAULT_VECTORIZER_MODULE: none CLUSTER_HOSTNAME: node1 AUTHENTICATION_APIKEY_ENABLED: 'true' AUTHENTICATION_APIKEY_ALLOWED_KEYS: e5787297a068ec2fb50c8 AUTHORIZATION_ADMINLIST_ENABLED: 'true' AUTHORIZATION_ADMINLIST_USERS: hello@dify.ai networks: - traefik_public - digital_network deploy: mode: replicated replicas: 1 placement: constraints: - node.role == manager resources: limits: cpus: "1" memory: 2048M volumes: storage_data: external: true name: storage_data weaviate_data: external: true name: weaviate_data networks: traefik_public: external: true digital_network: external: true ``` ### ✔️ Expected Behavior Resolver o problema ao fazer o Deploy na Stack do Dify. ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 20:06:57 -05:00
yindo closed this issue 2026-02-21 20:06:57 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 17, 2025):

Hi, @johncosta2021. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported a "502 Bad Gateway" error during self-hosted Dify Stack updates via Docker.
  • The error is due to the nginx container starting before the plugin_daemon container.
  • Your current workaround is manually restarting the nginx container.
  • You requested a solution for proper startup dependency handling to enable seamless one-click deployment.
  • No further comments or updates have been provided since your report.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here.
  • If I don’t hear back within 15 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Dec 17, 2025): Hi, @johncosta2021. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported a "502 Bad Gateway" error during self-hosted Dify Stack updates via Docker. - The error is due to the nginx container starting before the plugin_daemon container. - Your current workaround is manually restarting the nginx container. - You requested a solution for proper startup dependency handling to enable seamless one-click deployment. - No further comments or updates have been provided since your report. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of Dify by commenting here. - If I don’t hear back within 15 days, I will automatically close this issue. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20347