Api Server doesn't work #4715

Closed
opened 2026-02-21 18:07:41 -05:00 by yindo · 20 comments
Owner

Originally created by @infoBrainSys on GitHub (Jul 22, 2024).

Self Checks

  • 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 (我已阅读并同意 Language Policy).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.14

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

plantfrom: x86
os: Synology

Run in Synology just exit .env file, set default port 5001 as 10000, then run docker-compose up everything looks fine, but api got some err:

INFO  [alembic.runtime.migration] Running upgrade 161cadc1af8d -> 408176b91ad3, 'add_max_active_requests'
Database migration successful!
Traceback (most recent call last):
  File "/app/api/.venv/bin/flask", line 8, in <module>
    sys.exit(main())
  File "/app/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 1105, in main
    cli.main()
  File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/app/api/commands.py", line 593, in upgrade_db
    lock.release()
  File "/app/api/.venv/lib/python3.10/site-packages/redis/lock.py", line 256, in release
    self.do_release(expected_token)
  File "/app/api/.venv/lib/python3.10/site-packages/redis/lock.py", line 262, in do_release
    raise LockNotOwnedError(
redis.exceptions.LockNotOwnedError: Cannot release a lock that's no longer owned
Running migrations
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
Preparing database migration...
Start database migration.
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
Database migration successful!
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
[2024-07-22 08:14:46 +0000] [20] [INFO] Starting gunicorn 22.0.0
[2024-07-22 08:14:46 +0000] [20] [INFO] Listening at: http://0.0.0.0:10000 (20)
[2024-07-22 08:14:46 +0000] [20] [INFO] Using worker: gevent
[2024-07-22 08:14:46 +0000] [33] [INFO] Booting worker with pid: 33

I can request the fronted:
image
but the service of api does not good.

✔️ Expected Behavior

Just running normal will be fine

Actual Behavior

No response

Originally created by @infoBrainSys on GitHub (Jul 22, 2024). ### Self Checks - [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 (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.14 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce plantfrom: x86 os: Synology Run in Synology just exit .env file, set default port 5001 as 10000, then run `docker-compose up` everything looks fine, but api got some err: ```bash INFO [alembic.runtime.migration] Running upgrade 161cadc1af8d -> 408176b91ad3, 'add_max_active_requests' Database migration successful! Traceback (most recent call last): File "/app/api/.venv/bin/flask", line 8, in <module> sys.exit(main()) File "/app/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 1105, in main cli.main() File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) File "/app/api/commands.py", line 593, in upgrade_db lock.release() File "/app/api/.venv/lib/python3.10/site-packages/redis/lock.py", line 256, in release self.do_release(expected_token) File "/app/api/.venv/lib/python3.10/site-packages/redis/lock.py", line 262, in do_release raise LockNotOwnedError( redis.exceptions.LockNotOwnedError: Cannot release a lock that's no longer owned Running migrations None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used. Preparing database migration... Start database migration. INFO [alembic.runtime.migration] Context impl PostgresqlImpl. INFO [alembic.runtime.migration] Will assume transactional DDL. Database migration successful! None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used. [2024-07-22 08:14:46 +0000] [20] [INFO] Starting gunicorn 22.0.0 [2024-07-22 08:14:46 +0000] [20] [INFO] Listening at: http://0.0.0.0:10000 (20) [2024-07-22 08:14:46 +0000] [20] [INFO] Using worker: gevent [2024-07-22 08:14:46 +0000] [33] [INFO] Booting worker with pid: 33 ``` I can request the fronted: ![image](https://github.com/user-attachments/assets/8d1328d7-320b-4031-88fb-ab54f6bb130f) but the service of api does not good. ### ✔️ Expected Behavior Just running normal will be fine ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:07:41 -05:00
yindo closed this issue 2026-02-21 18:07:41 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 22, 2024):

Hello, @infoBrainSys! I'm here to help you with any bugs, questions, or contributions you have for the repository. Let's work together to solve the issue you're facing.

To resolve the issue with the API server in your self-hosted Dify version 0.6.14 setup on a Synology x86 platform using Docker, where the API service is not functioning correctly and results in a 502 Bad Gateway error after changing the default port to 10000, you need to ensure that the port mapping in your docker-compose.yaml file is correctly configured.

Here is the relevant section of the docker-compose.yaml file with the port mapping updated to reflect the change to port 10000:

services:
  api:
    image: langgenius/dify-api:0.6.12
    restart: always
    environment:
      <<: *shared-api-worker-env
      MODE: api
    depends_on:
      - db
      - redis
    volumes:
      - ./volumes/app/storage:/app/api/storage
    ports:
      - "10000:10000"
    networks:
      - ssrf_proxy_network
      - default

Make sure that the ports section under the api service is uncommented and correctly maps the internal port to the external port 10000. This will expose the API service on port 10000.

Additionally, ensure that any other services or configurations that depend on the API service are updated to use the new port 10000.

After making these changes, restart your Docker containers to apply the new configuration:

docker-compose down
docker-compose up -d

If the issue persists, it might be due to Nginx forwarding the service to the wrong location. To fix this, follow these steps:

  1. Ensure the containers are running and get their IP addresses by running the following command with root privileges:

    docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
    
  2. In the output, find the lines corresponding to your web and API containers, for example:

    /docker-web-1: 172.19.0.5
    /docker-api-1: 172.19.0.7
    
  3. Open the dify/docker/nginx/conf.d directory and update the Nginx configuration file. Replace http://api:5001 with http://172.19.0.7:10000 and http://web:3000 with http://172.19.0.5:3000. Note that these IP addresses are examples; you must use the IP addresses obtained from the previous command.

  4. Restart the Nginx container or reload the configuration.

Additionally, ensure that the environment variables in your docker-compose.yaml file are correctly set to reflect the new port configuration. For example, you might need to update the SERVICE_API_URL and APP_API_URL environment variables to use the new port:

environment:
  SERVICE_API_URL: "http://api:10000"
  APP_API_URL: "http://api:10000"

These steps should resolve the 502 Bad Gateway error by correctly mapping the ports and ensuring the API service is accessible on the new port [1][2][3][4][5].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 22, 2024): <!-- Greeting --> Hello, @infoBrainSys! I'm here to help you with any bugs, questions, or contributions you have for the repository. Let's work together to solve the issue you're facing. <!-- Answer --> To resolve the issue with the API server in your self-hosted Dify version 0.6.14 setup on a Synology x86 platform using Docker, where the API service is not functioning correctly and results in a 502 Bad Gateway error after changing the default port to 10000, you need to ensure that the port mapping in your `docker-compose.yaml` file is correctly configured. Here is the relevant section of the `docker-compose.yaml` file with the port mapping updated to reflect the change to port 10000: ```yaml services: api: image: langgenius/dify-api:0.6.12 restart: always environment: <<: *shared-api-worker-env MODE: api depends_on: - db - redis volumes: - ./volumes/app/storage:/app/api/storage ports: - "10000:10000" networks: - ssrf_proxy_network - default ``` Make sure that the `ports` section under the `api` service is uncommented and correctly maps the internal port to the external port 10000. This will expose the API service on port 10000. Additionally, ensure that any other services or configurations that depend on the API service are updated to use the new port 10000. After making these changes, restart your Docker containers to apply the new configuration: ```sh docker-compose down docker-compose up -d ``` If the issue persists, it might be due to Nginx forwarding the service to the wrong location. To fix this, follow these steps: 1. Ensure the containers are running and get their IP addresses by running the following command with root privileges: ```sh docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ``` 2. In the output, find the lines corresponding to your web and API containers, for example: ``` /docker-web-1: 172.19.0.5 /docker-api-1: 172.19.0.7 ``` 3. Open the `dify/docker/nginx/conf.d` directory and update the Nginx configuration file. Replace `http://api:5001` with `http://172.19.0.7:10000` and `http://web:3000` with `http://172.19.0.5:3000`. Note that these IP addresses are examples; you must use the IP addresses obtained from the previous command. 4. Restart the Nginx container or reload the configuration. Additionally, ensure that the environment variables in your `docker-compose.yaml` file are correctly set to reflect the new port configuration. For example, you might need to update the `SERVICE_API_URL` and `APP_API_URL` environment variables to use the new port: ```yaml environment: SERVICE_API_URL: "http://api:10000" APP_API_URL: "http://api:10000" ``` These steps should resolve the 502 Bad Gateway error by correctly mapping the ports and ensuring the API service is accessible on the new port <sup>[[1]](https://github.com/langgenius/dify/blob/main/docker-legacy/docker-compose.yaml)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/learn-more/faq/install-faq.md)</sup><sup>[[3]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)</sup><sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/getting-started/install-self-hosted/environments.md)</sup><sup>[[5]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-orchestrate/llms-use-faq.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@infoBrainSys commented on GitHub (Jul 22, 2024):

你好!我在这里帮助您解决对存储库的任何错误、问题或贡献。让我们共同努力解决您面临的问题。

要解决在使用 Docker 的 Synology x86 平台上自托管 Dify 版本 0.6.14 设置中的 API 服务器问题,其中 API 服务无法正常运行,并在将默认端口更改为 10000 后导致 502 Bad Gateway 错误,您需要确保 docker-compose.yaml 文件中的端口映射已正确配置。

以下是 docker-compose.yaml 文件的相关部分,其中端口映射已更新,以反映对端口 10000 的更改:

services:
  api:
    image: langgenius/dify-api:0.6.12
    restart: always
    environment:
      <<: *shared-api-worker-env
      MODE: api
    depends_on:
      - db
      - redis
    volumes:
      - ./volumes/app/storage:/app/api/storage
    ports:
      - "10000:10000"
    networks:
      - ssrf_proxy_network
      - default

确保 api 服务下 ports 的部分未注释,并正确将内部端口映射到外部端口 10000。这将在端口 10000 上公开 API 服务。

此外,请确保更新依赖于 API 服务的任何其他服务或配置,以使用新的端口 10000。

进行这些更改后,重新启动 Docker 容器以应用新配置:

docker-compose down
docker-compose up -d

如果问题仍然存在,可能是由于 Nginx 将服务转发到错误的位置。若要解决此问题,请按照下列步骤操作:

  1. 确保容器正在运行,并通过使用 root 权限运行以下命令来获取其 IP 地址:
    docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
    
  2. 在输出中,找到与您的 Web 和 API 容器对应的行,例如:
    /docker-web-1: 172.19.0.5
    /docker-api-1: 172.19.0.7
    
  3. 打开目录 dify/docker/nginx/conf.d 并更新 Nginx 配置文件。 http://api:5001 替换为 http://172.19.0.7:10000 http://172.19.0.5:3000http://web:3000 。请注意,这些 IP 地址是示例;您必须使用从上一个命令获取的 IP 地址。
  4. 重新启动 Nginx 容器或重新加载配置。

此外,请确保 docker-compose.yaml 正确设置了文件中的环境变量,以反映新的端口配置。例如,您可能需要更新 SERVICE_API_URLAPP_API_URL 环境变量以使用新端口:

environment:
  SERVICE_API_URL: "http://api:10000"
  APP_API_URL: "http://api:10000"

这些步骤应通过正确映射端口并确保在新端口 [1] [2] [3] [4] [5] 上可访问 API 服务来解决 502 错误网关错误。

要继续与 Dosu 交谈,请提及 。

i just edit .env file for setting the variable, did'not edit docker-compose.yml file. is this right way? or i need to change something with docker-compose.yml file?

@infoBrainSys commented on GitHub (Jul 22, 2024): > 你好!我在这里帮助您解决对存储库的任何错误、问题或贡献。让我们共同努力解决您面临的问题。 > > 要解决在使用 Docker 的 Synology x86 平台上自托管 Dify 版本 0.6.14 设置中的 API 服务器问题,其中 API 服务无法正常运行,并在将默认端口更改为 10000 后导致 502 Bad Gateway 错误,您需要确保 `docker-compose.yaml` 文件中的端口映射已正确配置。 > > 以下是 `docker-compose.yaml` 文件的相关部分,其中端口映射已更新,以反映对端口 10000 的更改: > > ```yaml > services: > api: > image: langgenius/dify-api:0.6.12 > restart: always > environment: > <<: *shared-api-worker-env > MODE: api > depends_on: > - db > - redis > volumes: > - ./volumes/app/storage:/app/api/storage > ports: > - "10000:10000" > networks: > - ssrf_proxy_network > - default > ``` > > 确保 `api` 服务下 `ports` 的部分未注释,并正确将内部端口映射到外部端口 10000。这将在端口 10000 上公开 API 服务。 > > 此外,请确保更新依赖于 API 服务的任何其他服务或配置,以使用新的端口 10000。 > > 进行这些更改后,重新启动 Docker 容器以应用新配置: > > ```shell > docker-compose down > docker-compose up -d > ``` > > 如果问题仍然存在,可能是由于 Nginx 将服务转发到错误的位置。若要解决此问题,请按照下列步骤操作: > > 1. 确保容器正在运行,并通过使用 root 权限运行以下命令来获取其 IP 地址: > ```shell > docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' > ``` > 2. 在输出中,找到与您的 Web 和 API 容器对应的行,例如: > ``` > /docker-web-1: 172.19.0.5 > /docker-api-1: 172.19.0.7 > ``` > 3. 打开目录 `dify/docker/nginx/conf.d` 并更新 Nginx 配置文件。 `http://api:5001` 替换为 `http://172.19.0.7:10000` `http://172.19.0.5:3000` 和 `http://web:3000` 。请注意,这些 IP 地址是示例;您必须使用从上一个命令获取的 IP 地址。 > 4. 重新启动 Nginx 容器或重新加载配置。 > > 此外,请确保 `docker-compose.yaml` 正确设置了文件中的环境变量,以反映新的端口配置。例如,您可能需要更新 `SERVICE_API_URL` 和 `APP_API_URL` 环境变量以使用新端口: > > ```yaml > environment: > SERVICE_API_URL: "http://api:10000" > APP_API_URL: "http://api:10000" > ``` > > 这些步骤应通过正确映射端口并确保在新端口 [[1]](https://github.com/langgenius/dify/blob/main/docker-legacy/docker-compose.yaml) [[2]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/learn-more/faq/install-faq.md) [[3]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml) [[4]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/getting-started/install-self-hosted/environments.md) [[5]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-orchestrate/llms-use-faq.md) 上可访问 API 服务来解决 502 错误网关错误。 > > _要继续与 Dosu 交谈,请提及 。_ i just edit .env file for setting the variable, did'not edit docker-compose.yml file. is this right way? or i need to change something with docker-compose.yml file?
Author
Owner

@dosubot[bot] commented on GitHub (Jul 22, 2024):

You need to modify both the .env file and the docker-compose.yml file to change the default port for the API service from 5001 to 10000.

  1. Update the .env file:

    DIFY_PORT=10000
    
  2. Update the docker-compose.yml file:
    Uncomment and modify the ports section for the API service as follows:

    services:
      api:
        image: langgenius/dify-api:0.6.14
        restart: always
        environment:
          <<: *shared-api-worker-env
          MODE: api
        depends_on:
          - db
          - redis
        volumes:
          - ./volumes/app/storage:/app/api/storage
        ports:
          - "10000:5001"
        networks:
          - ssrf_proxy_network
          - default
    

This will map port 10000 on the host to port 5001 on the container. After making these changes, restart your Docker containers to apply the new configuration:

docker-compose down
docker-compose up -d

These steps should ensure that the API service is accessible on the new port [1][2][3].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 22, 2024): <!-- Answer --> You need to modify both the `.env` file and the `docker-compose.yml` file to change the default port for the API service from 5001 to 10000. 1. **Update the `.env` file**: ```env DIFY_PORT=10000 ``` 2. **Update the `docker-compose.yml` file**: Uncomment and modify the `ports` section for the API service as follows: ```yaml services: api: image: langgenius/dify-api:0.6.14 restart: always environment: <<: *shared-api-worker-env MODE: api depends_on: - db - redis volumes: - ./volumes/app/storage:/app/api/storage ports: - "10000:5001" networks: - ssrf_proxy_network - default ``` This will map port 10000 on the host to port 5001 on the container. After making these changes, restart your Docker containers to apply the new configuration: ```sh docker-compose down docker-compose up -d ``` These steps should ensure that the API service is accessible on the new port <sup>[[1]](https://github.com/langgenius/dify/blob/main/docker-legacy/docker-compose.yaml)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)</sup><sup>[[3]](https://github.com/langgenius/dify/blob/main/docker/.env.example)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@infoBrainSys commented on GitHub (Jul 22, 2024):

您需要修改 .env 文件和 docker-compose.yml 文件,以将 API 服务的默认端口从 5001 更改为 10000。

  1. 更新 .env 文件:
    DIFY_PORT=10000
    
  2. 更新 docker-compose.yml 文件:取消注释并修改 API 服务 ports 的部分,如下所示:
    services:
      api:
        image: langgenius/dify-api:0.6.14
        restart: always
        environment:
          <<: *shared-api-worker-env
          MODE: api
        depends_on:
          - db
          - redis
        volumes:
          - ./volumes/app/storage:/app/api/storage
        ports:
          - "10000:5001"
        networks:
          - ssrf_proxy_network
          - default
    

这会将主机上的端口 10000 映射到容器上的端口 5001。进行这些更改后,重新启动 Docker 容器以应用新配置:

docker-compose down
docker-compose up -d

这些步骤应确保在新端口 [1] [2] [3] 上可以访问 API 服务。

要继续与 Dosu 交谈,请提及 。

i will try this way. if st

You need to modify both the .env file and the docker-compose.yml file to change the default port for the API service from 5001 to 10000.

  1. Update the .env file:
    DIFY_PORT=10000
    
  2. Update the docker-compose.yml file:
    Uncomment and modify the ports section for the API service as follows:
    services:
      api:
        image: langgenius/dify-api:0.6.14
        restart: always
        environment:
          <<: *shared-api-worker-env
          MODE: api
        depends_on:
          - db
          - redis
        volumes:
          - ./volumes/app/storage:/app/api/storage
        ports:
          - "10000:5001"
        networks:
          - ssrf_proxy_network
          - default
    

This will map port 10000 on the host to port 5001 on the container. After making these changes, restart your Docker containers to apply the new configuration:

docker-compose down
docker-compose up -d

These steps should ensure that the API service is accessible on the new port [1][2][3].

To continue talking to Dosu, mention @dosu.

i followed you suggestion to edit those file but still not works.

docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:15:57 +0000] "GET /install HTTP/1.1" 200 5369 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:15:58 +0000] "GET /logo/logo-site.png HTTP/1.1" 200 5809 "https://dify.iscrooge.cn/install" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-db-1          | 2024-07-22 09:16:27.152 UTC [105] LOG:  checkpoint complete: wrote 328 buffers (2.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=32.581 s, sync=1.009 s, total=34.007 s; sync files=458, longest=0.524 s, average=0.003 s; distance=2622 kB, estimate=2622 kB
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:27 +0000] "GET / HTTP/1.1" 307 15 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:28 +0000] "GET /apps HTTP/1.1" 200 8273 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:30 +0000] "GET /_next/static/css/86b74559a1eda927.css HTTP/1.1" 200 2091 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:30 +0000] "GET /signin?_rsc=1k4yo HTTP/1.1" 200 869 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 2024/07/22 09:16:30 [error] 22#22: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.176.1, server: _, request: "GET /console/api/apps?page=1&limit=30&name= HTTP/1.1", upstream: "http://192.168.176.7:5001/console/api/apps?page=1&limit=30&name=", host: "dify.iscrooge.cn", referrer: "https://dify.iscrooge.cn/apps"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:30 +0000] "GET /console/api/apps?page=1&limit=30&name= HTTP/1.1" 502 559 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:30 +0000] "GET /console/api/workspaces/current? HTTP/1.1" 502 559 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 2024/07/22 09:16:30 [error] 20#20: *10 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.176.1, server: _, request: "GET /console/api/workspaces/current? HTTP/1.1", upstream: "http://192.168.176.7:5001/console/api/workspaces/current?", host: "dify.iscrooge.cn", referrer: "https://dify.iscrooge.cn/apps"
docker-nginx-1       | 2024/07/22 09:16:30 [error] 22#22: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.176.1, server: _, request: "GET /console/api/account/profile HTTP/1.1", upstream: "http://192.168.176.7:5001/console/api/account/profile", host: "dify.iscrooge.cn", referrer: "https://dify.iscrooge.cn/apps"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:30 +0000] "GET /console/api/account/profile HTTP/1.1" 502 559 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:31 +0000] "GET /logo/logo-site.png HTTP/1.1" 200 5809 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 2024/07/22 09:16:31 [error] 22#22: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.176.1, server: _, request: "GET /console/api/system-features HTTP/1.1", upstream: "http://192.168.176.7:5001/console/api/system-features", host: "dify.iscrooge.cn", referrer: "https://dify.iscrooge.cn/signin"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:31 +0000] "GET /console/api/system-features HTTP/1.1" 502 559 "https://dify.iscrooge.cn/signin" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:32 +0000] "GET /install?_rsc=xfno8 HTTP/1.1" 200 120 "https://dify.iscrooge.cn/signin" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
docker-nginx-1       | 192.168.176.1 - - [22/Jul/2024:09:16:32 +0000] "GET /favicon.ico HTTP/1.1" 200 6278 "https://dify.iscrooge.cn/signin" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233"
@infoBrainSys commented on GitHub (Jul 22, 2024): > 您需要修改 `.env` 文件和 `docker-compose.yml` 文件,以将 API 服务的默认端口从 5001 更改为 10000。 > > 1. 更新 `.env` 文件: > ```dotenv > DIFY_PORT=10000 > ``` > 2. 更新 `docker-compose.yml` 文件:取消注释并修改 API 服务 `ports` 的部分,如下所示: > ```yaml > services: > api: > image: langgenius/dify-api:0.6.14 > restart: always > environment: > <<: *shared-api-worker-env > MODE: api > depends_on: > - db > - redis > volumes: > - ./volumes/app/storage:/app/api/storage > ports: > - "10000:5001" > networks: > - ssrf_proxy_network > - default > ``` > > 这会将主机上的端口 10000 映射到容器上的端口 5001。进行这些更改后,重新启动 Docker 容器以应用新配置: > > ```shell > docker-compose down > docker-compose up -d > ``` > > 这些步骤应确保在新端口 [[1]](https://github.com/langgenius/dify/blob/main/docker-legacy/docker-compose.yaml) [[2]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml) [[3]](https://github.com/langgenius/dify/blob/main/docker/.env.example) 上可以访问 API 服务。 > > _要继续与 Dosu 交谈,请提及 。_ i will try this way. if st > You need to modify both the `.env` file and the `docker-compose.yml` file to change the default port for the API service from 5001 to 10000. > > 1. **Update the `.env` file**: > ```dotenv > DIFY_PORT=10000 > ``` > 2. **Update the `docker-compose.yml` file**: > Uncomment and modify the `ports` section for the API service as follows: > ```yaml > services: > api: > image: langgenius/dify-api:0.6.14 > restart: always > environment: > <<: *shared-api-worker-env > MODE: api > depends_on: > - db > - redis > volumes: > - ./volumes/app/storage:/app/api/storage > ports: > - "10000:5001" > networks: > - ssrf_proxy_network > - default > ``` > > This will map port 10000 on the host to port 5001 on the container. After making these changes, restart your Docker containers to apply the new configuration: > > ```shell > docker-compose down > docker-compose up -d > ``` > > These steps should ensure that the API service is accessible on the new port [[1]](https://github.com/langgenius/dify/blob/main/docker-legacy/docker-compose.yaml)[[2]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)[[3]](https://github.com/langgenius/dify/blob/main/docker/.env.example). > > _To continue talking to [Dosu](https://dosu.dev), mention @dosu._ i followed you suggestion to edit those file but still not works. ```bash docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:15:57 +0000] "GET /install HTTP/1.1" 200 5369 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:15:58 +0000] "GET /logo/logo-site.png HTTP/1.1" 200 5809 "https://dify.iscrooge.cn/install" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-db-1 | 2024-07-22 09:16:27.152 UTC [105] LOG: checkpoint complete: wrote 328 buffers (2.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=32.581 s, sync=1.009 s, total=34.007 s; sync files=458, longest=0.524 s, average=0.003 s; distance=2622 kB, estimate=2622 kB docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:27 +0000] "GET / HTTP/1.1" 307 15 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:28 +0000] "GET /apps HTTP/1.1" 200 8273 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:30 +0000] "GET /_next/static/css/86b74559a1eda927.css HTTP/1.1" 200 2091 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:30 +0000] "GET /signin?_rsc=1k4yo HTTP/1.1" 200 869 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 2024/07/22 09:16:30 [error] 22#22: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.176.1, server: _, request: "GET /console/api/apps?page=1&limit=30&name= HTTP/1.1", upstream: "http://192.168.176.7:5001/console/api/apps?page=1&limit=30&name=", host: "dify.iscrooge.cn", referrer: "https://dify.iscrooge.cn/apps" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:30 +0000] "GET /console/api/apps?page=1&limit=30&name= HTTP/1.1" 502 559 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:30 +0000] "GET /console/api/workspaces/current? HTTP/1.1" 502 559 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 2024/07/22 09:16:30 [error] 20#20: *10 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.176.1, server: _, request: "GET /console/api/workspaces/current? HTTP/1.1", upstream: "http://192.168.176.7:5001/console/api/workspaces/current?", host: "dify.iscrooge.cn", referrer: "https://dify.iscrooge.cn/apps" docker-nginx-1 | 2024/07/22 09:16:30 [error] 22#22: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.176.1, server: _, request: "GET /console/api/account/profile HTTP/1.1", upstream: "http://192.168.176.7:5001/console/api/account/profile", host: "dify.iscrooge.cn", referrer: "https://dify.iscrooge.cn/apps" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:30 +0000] "GET /console/api/account/profile HTTP/1.1" 502 559 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:31 +0000] "GET /logo/logo-site.png HTTP/1.1" 200 5809 "https://dify.iscrooge.cn/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 2024/07/22 09:16:31 [error] 22#22: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.176.1, server: _, request: "GET /console/api/system-features HTTP/1.1", upstream: "http://192.168.176.7:5001/console/api/system-features", host: "dify.iscrooge.cn", referrer: "https://dify.iscrooge.cn/signin" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:31 +0000] "GET /console/api/system-features HTTP/1.1" 502 559 "https://dify.iscrooge.cn/signin" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:32 +0000] "GET /install?_rsc=xfno8 HTTP/1.1" 200 120 "https://dify.iscrooge.cn/signin" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" docker-nginx-1 | 192.168.176.1 - - [22/Jul/2024:09:16:32 +0000] "GET /favicon.ico HTTP/1.1" 200 6278 "https://dify.iscrooge.cn/signin" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "106.228.7.233" ```
Author
Owner

@dosubot[bot] commented on GitHub (Jul 22, 2024):

It looks like the API service is still trying to connect to port 5001 internally, which is causing the 502 Bad Gateway errors. To resolve this, you need to ensure that the port mapping and environment variables are correctly set in both the .env file and the docker-compose.yml file.

  1. Update the .env file:

    DIFY_PORT=10000
    
  2. Update the docker-compose.yml file:
    Ensure the ports section for the API service maps the internal port 10000 to the external port 10000:

    services:
      api:
        image: langgenius/dify-api:0.6.14
        restart: always
        environment:
          <<: *shared-api-worker-env
          MODE: api
          DIFY_PORT: 10000
        depends_on:
          - db
          - redis
        volumes:
          - ./volumes/app/storage:/app/api/storage
        ports:
          - "10000:10000"
        networks:
          - ssrf_proxy_network
          - default
    
  3. Update Nginx Configuration:
    Ensure that Nginx is forwarding requests to the correct port. Open the dify/docker/nginx/conf.d directory and update the Nginx configuration file to reflect the new port:

    upstream api {
        server 172.19.0.7:10000;  # Replace with the correct IP address of the API container
    }
    
  4. Restart Docker Containers:
    After making these changes, restart your Docker containers to apply the new configuration:

    docker-compose down
    docker-compose up -d
    

These steps should ensure that the API service is accessible on the new port 10000 and resolve the 502 Bad Gateway errors [1][2][3].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 22, 2024): <!-- Answer --> It looks like the API service is still trying to connect to port 5001 internally, which is causing the 502 Bad Gateway errors. To resolve this, you need to ensure that the port mapping and environment variables are correctly set in both the `.env` file and the `docker-compose.yml` file. 1. **Update the `.env` file**: ```env DIFY_PORT=10000 ``` 2. **Update the `docker-compose.yml` file**: Ensure the `ports` section for the API service maps the internal port 10000 to the external port 10000: ```yaml services: api: image: langgenius/dify-api:0.6.14 restart: always environment: <<: *shared-api-worker-env MODE: api DIFY_PORT: 10000 depends_on: - db - redis volumes: - ./volumes/app/storage:/app/api/storage ports: - "10000:10000" networks: - ssrf_proxy_network - default ``` 3. **Update Nginx Configuration**: Ensure that Nginx is forwarding requests to the correct port. Open the `dify/docker/nginx/conf.d` directory and update the Nginx configuration file to reflect the new port: ```nginx upstream api { server 172.19.0.7:10000; # Replace with the correct IP address of the API container } ``` 4. **Restart Docker Containers**: After making these changes, restart your Docker containers to apply the new configuration: ```sh docker-compose down docker-compose up -d ``` These steps should ensure that the API service is accessible on the new port 10000 and resolve the 502 Bad Gateway errors <sup>[[1]](https://github.com/langgenius/dify/blob/main/docker/.env.example)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)</sup><sup>[[3]](https://github.com/langgenius/dify/blob/main/docker-legacy/docker-compose.yaml)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Jul 22, 2024):

This error indicates that you haven't exit all containers as expected, so you should run docker compose down first and pull the latest code, then you can modify. things and run docker compose up -d.

For current situation, I suggest you can remove all containers and start it over again.

@crazywoola commented on GitHub (Jul 22, 2024): This error indicates that you haven't exit all containers as expected, so you should run `docker compose down` first and pull the latest code, then you can modify. things and run `docker compose up -d`. For current situation, I suggest you can remove all containers and start it over again.
Author
Owner

@infoBrainSys commented on GitHub (Jul 22, 2024):

while i finished http://ip/install steps. then why shown this?

image

@infoBrainSys commented on GitHub (Jul 22, 2024): while i finished http://ip/install steps. then why shown this? ![image](https://github.com/user-attachments/assets/7f76483c-456f-47cf-82c5-476ed5d3e803)
Author
Owner

@crazywoola commented on GitHub (Jul 22, 2024):

Because the server failed to start it up. As I suggested, you should remove things under 'docker/volumns'

@crazywoola commented on GitHub (Jul 22, 2024): Because the server failed to start it up. As I suggested, you should remove things under 'docker/volumns'
Author
Owner

@infoBrainSys commented on GitHub (Jul 22, 2024):

Because the server failed to start it up. As I suggested, you should remove things under 'docker/volumns'

i will try now

@infoBrainSys commented on GitHub (Jul 22, 2024): > Because the server failed to start it up. As I suggested, you should remove things under 'docker/volumns' i will try now
Author
Owner

@infoBrainSys commented on GitHub (Jul 22, 2024):

Because the server failed to start it up. As I suggested, you should remove things under 'docker/volumns'
should i remove those file?
image

@infoBrainSys commented on GitHub (Jul 22, 2024): > Because the server failed to start it up. As I suggested, you should remove things under 'docker/volumns' should i remove those file? ![image](https://github.com/user-attachments/assets/50fdcc27-d301-4933-ac2c-9ab80f6ac608)
Author
Owner

@crazywoola commented on GitHub (Jul 22, 2024):

This means you haven't start the db correctly, therefore the api will fail to start as well.

@crazywoola commented on GitHub (Jul 22, 2024): This means you haven't start the db correctly, therefore the api will fail to start as well.
Author
Owner

@crazywoola commented on GitHub (Jul 22, 2024):

redis.exceptions.LockNotOwnedError: Cannot release a lock that's no longer owned

Please check the redis configuration as well, if you have redis server in your server, please turn it off. It will use the docker packed redis to start the application.

@crazywoola commented on GitHub (Jul 22, 2024): ``` redis.exceptions.LockNotOwnedError: Cannot release a lock that's no longer owned ``` Please check the redis configuration as well, if you have redis server in your server, please turn it off. It will use the docker packed redis to start the application.
Author
Owner

@infoBrainSys commented on GitHub (Jul 22, 2024):

redis.exceptions.LockNotOwnedError: Cannot release a lock that's no longer owned

请同时检查redis配置,如果您的服务器中有redis服务器,请将其关闭。它将使用 docker 打包的 redis 来启动应用程序。

db ready for accept conn, and no other redis server
image

docker-db-1          | PostgreSQL Database directory appears to contain a database; Skipping initialization
docker-db-1          |
docker-db-1          | 2024-07-22 14:26:28.480 UTC [1] LOG:  starting PostgreSQL 15.7 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit
docker-db-1          | 2024-07-22 14:26:28.481 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
docker-db-1          | 2024-07-22 14:26:28.481 UTC [1] LOG:  listening on IPv6 address "::", port 5432
docker-db-1          | 2024-07-22 14:26:29.055 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
docker-db-1          | 2024-07-22 14:26:29.266 UTC [35] LOG:  database system was shut down at 2024-07-22 14:25:53 UTC
docker-db-1          | 2024-07-22 14:26:29.267 UTC [36] FATAL:  the database system is starting up
docker-db-1          | 2024-07-22 14:26:29.793 UTC [1] LOG:  database system is ready to accept connections
docker-db-1          | 2024-07-22 14:28:14.662 UTC [1] LOG:  received fast shutdown request
docker-db-1          | 2024-07-22 14:28:14.746 UTC [1] LOG:  aborting any active transactions
docker-db-1          | 2024-07-22 14:28:14.746 UTC [506] FATAL:  the database system is shutting down
docker-db-1          | 2024-07-22 14:28:14.747 UTC [1] LOG:  background worker "logical replication launcher" (PID 39) exited with exit code 1
docker-db-1          | 2024-07-22 14:28:14.749 UTC [33] LOG:  shutting down
docker-db-1          | 2024-07-22 14:28:15.253 UTC [33] LOG:  checkpoint starting: shutdown immediate
docker-db-1          | 2024-07-22 14:28:16.669 UTC [512] FATAL:  the database system is shutting down
docker-db-1          | 2024-07-22 14:28:16.841 UTC [33] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.741 s, total=2.092 s; sync files=2, longest=0.582 s, average=0.371 s; distance=0 kB, estimate=0 kB
docker-db-1          | 2024-07-22 14:28:17.095 UTC [1] LOG:  database system is shut down
docker-db-1          |
docker-db-1          | PostgreSQL Database directory appears to contain a database; Skipping initialization
docker-db-1          |
docker-db-1          | 2024-07-22 14:28:51.888 UTC [1] LOG:  starting PostgreSQL 15.7 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit
docker-db-1          | 2024-07-22 14:28:51.888 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
docker-db-1          | 2024-07-22 14:28:51.888 UTC [1] LOG:  listening on IPv6 address "::", port 5432
docker-db-1          | 2024-07-22 14:28:52.598 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
docker-db-1          | 2024-07-22 14:28:53.195 UTC [34] LOG:  database system was shut down at 2024-07-22 14:28:16 UTC
docker-db-1          | 2024-07-22 14:28:53.655 UTC [1] LOG:  database system is ready to accept connections
@infoBrainSys commented on GitHub (Jul 22, 2024): > ``` > redis.exceptions.LockNotOwnedError: Cannot release a lock that's no longer owned > ``` > > 请同时检查redis配置,如果您的服务器中有redis服务器,请将其关闭。它将使用 docker 打包的 redis 来启动应用程序。 db ready for accept conn, and no other redis server ![image](https://github.com/user-attachments/assets/5891c7a4-1b26-4cce-86fd-57e0bc52490d) ```bash docker-db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization docker-db-1 | docker-db-1 | 2024-07-22 14:26:28.480 UTC [1] LOG: starting PostgreSQL 15.7 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit docker-db-1 | 2024-07-22 14:26:28.481 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 docker-db-1 | 2024-07-22 14:26:28.481 UTC [1] LOG: listening on IPv6 address "::", port 5432 docker-db-1 | 2024-07-22 14:26:29.055 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" docker-db-1 | 2024-07-22 14:26:29.266 UTC [35] LOG: database system was shut down at 2024-07-22 14:25:53 UTC docker-db-1 | 2024-07-22 14:26:29.267 UTC [36] FATAL: the database system is starting up docker-db-1 | 2024-07-22 14:26:29.793 UTC [1] LOG: database system is ready to accept connections docker-db-1 | 2024-07-22 14:28:14.662 UTC [1] LOG: received fast shutdown request docker-db-1 | 2024-07-22 14:28:14.746 UTC [1] LOG: aborting any active transactions docker-db-1 | 2024-07-22 14:28:14.746 UTC [506] FATAL: the database system is shutting down docker-db-1 | 2024-07-22 14:28:14.747 UTC [1] LOG: background worker "logical replication launcher" (PID 39) exited with exit code 1 docker-db-1 | 2024-07-22 14:28:14.749 UTC [33] LOG: shutting down docker-db-1 | 2024-07-22 14:28:15.253 UTC [33] LOG: checkpoint starting: shutdown immediate docker-db-1 | 2024-07-22 14:28:16.669 UTC [512] FATAL: the database system is shutting down docker-db-1 | 2024-07-22 14:28:16.841 UTC [33] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.741 s, total=2.092 s; sync files=2, longest=0.582 s, average=0.371 s; distance=0 kB, estimate=0 kB docker-db-1 | 2024-07-22 14:28:17.095 UTC [1] LOG: database system is shut down docker-db-1 | docker-db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization docker-db-1 | docker-db-1 | 2024-07-22 14:28:51.888 UTC [1] LOG: starting PostgreSQL 15.7 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit docker-db-1 | 2024-07-22 14:28:51.888 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 docker-db-1 | 2024-07-22 14:28:51.888 UTC [1] LOG: listening on IPv6 address "::", port 5432 docker-db-1 | 2024-07-22 14:28:52.598 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" docker-db-1 | 2024-07-22 14:28:53.195 UTC [34] LOG: database system was shut down at 2024-07-22 14:28:16 UTC docker-db-1 | 2024-07-22 14:28:53.655 UTC [1] LOG: database system is ready to accept connections ```
Author
Owner

@crazywoola commented on GitHub (Jul 22, 2024):

# ------------------------------
# Docker Compose Service Expose Host Port Configurations
# ------------------------------
EXPOSE_NGINX_PORT=80
EXPOSE_NGINX_SSL_PORT=443

https://github.com/langgenius/dify/blob/27c8deb4ec4dfa53873069206af92f320d1dca9b/docker/.env.example

Here are environment variables you might need to know. Make sure you can understand these variables before changing the ports to 10000.

You need to restore the changes as the bots suggests.

By following this doc You also needs to change this variables either.

# The backend URL of the console API,
# used to concatenate the authorization callback.
# If empty, it is the same domain.
# Example: https://api.console.dify.ai
CONSOLE_API_URL=

# The front-end URL of the console web,
# used to concatenate some front-end addresses and for CORS configuration use.
# If empty, it is the same domain.
# Example: https://console.dify.ai
CONSOLE_WEB_URL=

# Service API Url,
# used to display Service API Base Url to the front-end.
# If empty, it is the same domain.
# Example: https://api.dify.ai
SERVICE_API_URL=

# WebApp API backend Url,
# used to declare the back-end URL for the front-end API.
# If empty, it is the same domain.
# Example: https://api.app.dify.ai
APP_API_URL=

# WebApp Url,
# used to display WebAPP API Base Url to the front-end.
# If empty, it is the same domain.
# Example: https://app.dify.ai
APP_WEB_URL=

# File preview or download Url prefix.
# used to display File preview or download Url to the front-end or as Multi-model inputs;
# Url is signed and has expiration time.
FILES_URL=

The whole application is exposed to 80 by this environment variable EXPOSE_NGINX_PORT, you should not mess up the api service port because it's an internal port with the docker network.

@crazywoola commented on GitHub (Jul 22, 2024): ```bash # ------------------------------ # Docker Compose Service Expose Host Port Configurations # ------------------------------ EXPOSE_NGINX_PORT=80 EXPOSE_NGINX_SSL_PORT=443 ``` https://github.com/langgenius/dify/blob/27c8deb4ec4dfa53873069206af92f320d1dca9b/docker/.env.example Here are environment variables you might need to know. Make sure you can understand these variables before changing the ports to 10000. You need to restore the changes as the bots suggests. By following this [doc](https://docs.dify.ai/getting-started/install-self-hosted/environments) You also needs to change this variables either. ``` # The backend URL of the console API, # used to concatenate the authorization callback. # If empty, it is the same domain. # Example: https://api.console.dify.ai CONSOLE_API_URL= # The front-end URL of the console web, # used to concatenate some front-end addresses and for CORS configuration use. # If empty, it is the same domain. # Example: https://console.dify.ai CONSOLE_WEB_URL= # Service API Url, # used to display Service API Base Url to the front-end. # If empty, it is the same domain. # Example: https://api.dify.ai SERVICE_API_URL= # WebApp API backend Url, # used to declare the back-end URL for the front-end API. # If empty, it is the same domain. # Example: https://api.app.dify.ai APP_API_URL= # WebApp Url, # used to display WebAPP API Base Url to the front-end. # If empty, it is the same domain. # Example: https://app.dify.ai APP_WEB_URL= # File preview or download Url prefix. # used to display File preview or download Url to the front-end or as Multi-model inputs; # Url is signed and has expiration time. FILES_URL= ``` The whole application is exposed to 80 by this environment variable `EXPOSE_NGINX_PORT`, you should not mess up the api service port because it's an internal port with the docker network.
Author
Owner

@infoBrainSys commented on GitHub (Jul 22, 2024):

# ------------------------------
# Docker Compose Service Expose Host Port Configurations
# ------------------------------
EXPOSE_NGINX_PORT=80
EXPOSE_NGINX_SSL_PORT=443

https://github.com/langgenius/dify/blob/27c8deb4ec4dfa53873069206af92f320d1dca9b/docker/.env.example

以下是您可能需要了解的环境变量。在将端口更改为 10000 之前,请确保您可以理解这些变量。

您需要按照机器人的建议恢复更改。

通过遵循此文档,您还需要更改此变量。

# The backend URL of the console API,
# used to concatenate the authorization callback.
# If empty, it is the same domain.
# Example: https://api.console.dify.ai
CONSOLE_API_URL=

# The front-end URL of the console web,
# used to concatenate some front-end addresses and for CORS configuration use.
# If empty, it is the same domain.
# Example: https://console.dify.ai
CONSOLE_WEB_URL=

# Service API Url,
# used to display Service API Base Url to the front-end.
# If empty, it is the same domain.
# Example: https://api.dify.ai
SERVICE_API_URL=

# WebApp API backend Url,
# used to declare the back-end URL for the front-end API.
# If empty, it is the same domain.
# Example: https://api.app.dify.ai
APP_API_URL=

# WebApp Url,
# used to display WebAPP API Base Url to the front-end.
# If empty, it is the same domain.
# Example: https://app.dify.ai
APP_WEB_URL=

# File preview or download Url prefix.
# used to display File preview or download Url to the front-end or as Multi-model inputs;
# Url is signed and has expiration time.
FILES_URL=

整个应用程序通过这个环境变量 EXPOSE_NGINX_PORT 暴露给 80,你不应该弄乱 api 服务端口,因为它是 docker 网络的内部端口。

Now:just edited expose port of .env and docker-compose.yaml ,only open port 80、disable 443,Modify all the hanging volume paths to the created directory and assign permission 755.

  • .env
NGINX_PORT=80
# SSL settings are only applied when HTTPS_ENABLED is true
# NGINX_SSL_PORT=443
EXPOSE_NGINX_PORT=10080
# EXPOSE_NGINX_SSL_PORT=10443
  • docker-compose.yaml
  nginx:
    image: nginx:latest
    restart: always
    volumes:
      - ./nginx/nginx.conf.template:/etc/nginx/nginx.conf.template
      - ./nginx/proxy.conf.template:/etc/nginx/proxy.conf.template
      - ./nginx/https.conf.template:/etc/nginx/https.conf.template
      - ./nginx/conf.d:/etc/nginx/conf.d
      - ./nginx/docker-entrypoint.sh:/docker-entrypoint-mount.sh
      - ./nginx/ssl:/etc/ssl
    entrypoint: [ "sh", "-c", "cp /docker-entrypoint-mount.sh /docker-entrypoint.sh && sed -i 's/\r$$//' /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh && /docker-entrypoint.sh" ]
    environment:
      NGINX_SERVER_NAME: ${NGINX_SERVER_NAME:-_}
      NGINX_HTTPS_ENABLED: ${NGINX_HTTPS_ENABLED:-false}
      # NGINX_SSL_PORT: ${NGINX_SSL_PORT:-443}
      NGINX_PORT: ${NGINX_PORT:-80}
      # You're required to add your own SSL certificates/keys to the `./nginx/ssl` directory
      # and modify the env vars below in .env if HTTPS_ENABLED is true.
      NGINX_SSL_CERT_FILENAME: ${NGINX_SSL_CERT_FILENAME:-dify.crt}
      NGINX_SSL_CERT_KEY_FILENAME: ${NGINX_SSL_CERT_KEY_FILENAME:-dify.key}
      NGINX_SSL_PROTOCOLS: ${NGINX_SSL_PROTOCOLS:-TLSv1.1 TLSv1.2 TLSv1.3}
      NGINX_WORKER_PROCESSES: ${NGINX_WORKER_PROCESSES:-auto}
      NGINX_CLIENT_MAX_BODY_SIZE: ${NGINX_CLIENT_MAX_BODY_SIZE:-15M}
      NGINX_KEEPALIVE_TIMEOUT: ${NGINX_KEEPALIVE_TIMEOUT:-65}
      NGINX_PROXY_READ_TIMEOUT: ${NGINX_PROXY_READ_TIMEOUT:-3600s}
      NGINX_PROXY_SEND_TIMEOUT: ${NGINX_PROXY_SEND_TIMEOUT:-3600s}
    depends_on:
      - api
      - web
    ports:
      - "${EXPOSE_NGINX_PORT:-80}:${NGINX_PORT:-80}"
      # - "${EXPOSE_NGINX_SSL_PORT:-443}:${NGINX_SSL_PORT:-443}"

After running ps status.
image

Logs of container

docker logs docker-api-1

image

docker logs docker-nginx-1

image

docker logs docker-web-1

image

docker logs docker-db-1

image

docker logs docker-redis-1

image

docker logs docker-ssrf_proxy-1

image

sandbox and weaviate

image

@infoBrainSys commented on GitHub (Jul 22, 2024): > ```shell > # ------------------------------ > # Docker Compose Service Expose Host Port Configurations > # ------------------------------ > EXPOSE_NGINX_PORT=80 > EXPOSE_NGINX_SSL_PORT=443 > ``` > > https://github.com/langgenius/dify/blob/27c8deb4ec4dfa53873069206af92f320d1dca9b/docker/.env.example > > 以下是您可能需要了解的环境变量。在将端口更改为 10000 之前,请确保您可以理解这些变量。 > > 您需要按照机器人的建议恢复更改。 > > 通过遵循此文档,您还需要更改此变量。 > > ``` > # The backend URL of the console API, > # used to concatenate the authorization callback. > # If empty, it is the same domain. > # Example: https://api.console.dify.ai > CONSOLE_API_URL= > > # The front-end URL of the console web, > # used to concatenate some front-end addresses and for CORS configuration use. > # If empty, it is the same domain. > # Example: https://console.dify.ai > CONSOLE_WEB_URL= > > # Service API Url, > # used to display Service API Base Url to the front-end. > # If empty, it is the same domain. > # Example: https://api.dify.ai > SERVICE_API_URL= > > # WebApp API backend Url, > # used to declare the back-end URL for the front-end API. > # If empty, it is the same domain. > # Example: https://api.app.dify.ai > APP_API_URL= > > # WebApp Url, > # used to display WebAPP API Base Url to the front-end. > # If empty, it is the same domain. > # Example: https://app.dify.ai > APP_WEB_URL= > > # File preview or download Url prefix. > # used to display File preview or download Url to the front-end or as Multi-model inputs; > # Url is signed and has expiration time. > FILES_URL= > ``` > > 整个应用程序通过这个环境变量 `EXPOSE_NGINX_PORT` 暴露给 80,你不应该弄乱 api 服务端口,因为它是 docker 网络的内部端口。 Now:just edited expose port of `.env` and `docker-compose.yaml` ,only open port 80、disable 443,Modify all the hanging volume paths to the created directory and assign permission 755. - .env ```sh NGINX_PORT=80 # SSL settings are only applied when HTTPS_ENABLED is true # NGINX_SSL_PORT=443 EXPOSE_NGINX_PORT=10080 # EXPOSE_NGINX_SSL_PORT=10443 ``` - docker-compose.yaml ```yaml nginx: image: nginx:latest restart: always volumes: - ./nginx/nginx.conf.template:/etc/nginx/nginx.conf.template - ./nginx/proxy.conf.template:/etc/nginx/proxy.conf.template - ./nginx/https.conf.template:/etc/nginx/https.conf.template - ./nginx/conf.d:/etc/nginx/conf.d - ./nginx/docker-entrypoint.sh:/docker-entrypoint-mount.sh - ./nginx/ssl:/etc/ssl entrypoint: [ "sh", "-c", "cp /docker-entrypoint-mount.sh /docker-entrypoint.sh && sed -i 's/\r$$//' /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh && /docker-entrypoint.sh" ] environment: NGINX_SERVER_NAME: ${NGINX_SERVER_NAME:-_} NGINX_HTTPS_ENABLED: ${NGINX_HTTPS_ENABLED:-false} # NGINX_SSL_PORT: ${NGINX_SSL_PORT:-443} NGINX_PORT: ${NGINX_PORT:-80} # You're required to add your own SSL certificates/keys to the `./nginx/ssl` directory # and modify the env vars below in .env if HTTPS_ENABLED is true. NGINX_SSL_CERT_FILENAME: ${NGINX_SSL_CERT_FILENAME:-dify.crt} NGINX_SSL_CERT_KEY_FILENAME: ${NGINX_SSL_CERT_KEY_FILENAME:-dify.key} NGINX_SSL_PROTOCOLS: ${NGINX_SSL_PROTOCOLS:-TLSv1.1 TLSv1.2 TLSv1.3} NGINX_WORKER_PROCESSES: ${NGINX_WORKER_PROCESSES:-auto} NGINX_CLIENT_MAX_BODY_SIZE: ${NGINX_CLIENT_MAX_BODY_SIZE:-15M} NGINX_KEEPALIVE_TIMEOUT: ${NGINX_KEEPALIVE_TIMEOUT:-65} NGINX_PROXY_READ_TIMEOUT: ${NGINX_PROXY_READ_TIMEOUT:-3600s} NGINX_PROXY_SEND_TIMEOUT: ${NGINX_PROXY_SEND_TIMEOUT:-3600s} depends_on: - api - web ports: - "${EXPOSE_NGINX_PORT:-80}:${NGINX_PORT:-80}" # - "${EXPOSE_NGINX_SSL_PORT:-443}:${NGINX_SSL_PORT:-443}" ``` After running ps status. ![image](https://github.com/user-attachments/assets/7d165bc7-0886-4e15-a606-ebd3c7bef62d) ## Logs of container ### `docker logs docker-api-1` ![image](https://github.com/user-attachments/assets/e4ad9d6d-f7e3-4b83-a0a7-8e361201feae) ### `docker logs docker-nginx-1` ![image](https://github.com/user-attachments/assets/98a05bf9-23d8-49f3-a63f-c4b11b49d42b) ### `docker logs docker-web-1` ![image](https://github.com/user-attachments/assets/f8edc294-6a64-46d3-8b43-bb1fd19402b9) ### `docker logs docker-db-1` ![image](https://github.com/user-attachments/assets/e2bd6783-6008-4805-a38a-ae496b985f41) ### `docker logs docker-redis-1` ![image](https://github.com/user-attachments/assets/7949565e-a593-4e67-925b-a5691332da2a) ### `docker logs docker-ssrf_proxy-1` ![image](https://github.com/user-attachments/assets/3235c965-13f6-4b73-9484-445b7c22b766) ### `sandbox and weaviate` ![image](https://github.com/user-attachments/assets/1719b10d-d86e-4f9b-beba-e50488e07180)
Author
Owner

@mfl828 commented on GitHub (Jan 5, 2025):

Did you solve the problem? I had a similar problem, but it didn't work out in the end!

@mfl828 commented on GitHub (Jan 5, 2025): Did you solve the problem? I had a similar problem, but it didn't work out in the end!
Author
Owner

@yumu7777777 commented on GitHub (Apr 2, 2025):

你解决问题了吗?我也遇到过类似的问题,但最后还是没能解决!

您好,您这边解决了吗,我这边在群晖部署也遇到这个问题

@yumu7777777 commented on GitHub (Apr 2, 2025): > 你解决问题了吗?我也遇到过类似的问题,但最后还是没能解决! 您好,您这边解决了吗,我这边在群晖部署也遇到这个问题
Author
Owner

@infoBrainSys commented on GitHub (Apr 2, 2025):

你解决问题了吗?我也遇到过类似的问题,但最后还是没能解决!

您好,您这边解决了吗,我这边在群晖部署也遇到这个问题

我重新装在新ubuntu服务器了,群晖安装这个确实不怎么方便。文件权限太麻烦了。

@infoBrainSys commented on GitHub (Apr 2, 2025): > > 你解决问题了吗?我也遇到过类似的问题,但最后还是没能解决! > > 您好,您这边解决了吗,我这边在群晖部署也遇到这个问题 我重新装在新ubuntu服务器了,群晖安装这个确实不怎么方便。文件权限太麻烦了。
Author
Owner

@yumu7777777 commented on GitHub (Apr 2, 2025):

你解决问题了吗?我也遇到过类似的问题,但最后还是没能解决!

您好,您这边解决了吗,我这边在群晖部署也遇到这个问题

我重新装在新ubuntu服务器了,群晖安装这个确实不怎么方便。文件权限太麻烦了。

好的好的,您这边新ubuntu 服务器能连接互联网吗

@yumu7777777 commented on GitHub (Apr 2, 2025): > > > 你解决问题了吗?我也遇到过类似的问题,但最后还是没能解决! > > > > > > 您好,您这边解决了吗,我这边在群晖部署也遇到这个问题 > > 我重新装在新ubuntu服务器了,群晖安装这个确实不怎么方便。文件权限太麻烦了。 好的好的,您这边新ubuntu 服务器能连接互联网吗
Author
Owner

@infoBrainSys commented on GitHub (Apr 2, 2025):

你解决问题了吗?我也遇到过类似的问题,但最后还是没能解决!

您好,您这边解决了吗,我这边在群晖部署也遇到这个问题

我重新装在新ubuntu服务器了,群晖安装这个确实不怎么方便。文件权限太麻烦了。

好的好的,您这边新ubuntu 服务器能连接互联网吗

肯定联网啊,不联网怎么用,远程调用

@infoBrainSys commented on GitHub (Apr 2, 2025): > > > > 你解决问题了吗?我也遇到过类似的问题,但最后还是没能解决! > > > > > > > > > 您好,您这边解决了吗,我这边在群晖部署也遇到这个问题 > > > > > > 我重新装在新ubuntu服务器了,群晖安装这个确实不怎么方便。文件权限太麻烦了。 > > 好的好的,您这边新ubuntu 服务器能连接互联网吗 肯定联网啊,不联网怎么用,远程调用
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4715