Closed paulcx closed 4 months ago
Hey @paulcx! 👋 I'm here to assist you with any bugs, questions, or contributions while you wait for a human maintainer. Let's work together to resolve any issues you're encountering.
To resolve the redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused
error when upgrading to Dify version 0.6.12 on a self-hosted Docker setup, ensure that the Redis container is running properly. Follow these steps:
Clone the Dify source code to your local machine if you haven't already:
git clone https://github.com/langgenius/dify.git
Navigate to the Dify source code's Docker directory:
cd dify/docker
Pull the latest changes from the repository:
git pull origin main
Bring down the existing Docker containers:
docker compose down
Pull the latest images:
docker compose pull
Start the Docker containers:
docker compose up -d
Verify that all containers, including Redis, are running:
docker compose ps
Ensure that the redis
container is listed with a status of "Up". If the Redis container is not running, there may be an issue with the Docker setup or the Redis configuration.
Additionally, check the docker-compose.yaml
file to ensure that the Redis service is correctly configured. Here is an example configuration for the Redis service:
redis:
image: redis:6-alpine
restart: always
volumes:
- ./volumes/redis/data:/data
command: redis-server --requirepass ${REDIS_PASSWORD:-difyai123456}
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
# uncomment to expose redis port to host
# ports:
# - "6379:6379"
Make sure the REDIS_PASSWORD
environment variable is set correctly in your .env
file or Docker Compose environment variables. If you have exposed the Redis port to the host, ensure that the port mapping is correct and not conflicting with other services [1][2][3][4].
To continue talking to Dosu, mention @dosu.
does it related to env file? i used the default env file middleware.env
Yes, the issue could be related to the .env
file. Ensure that your .env
file includes the correct configurations for the Redis container. Here is an example configuration for the .env
file to ensure the Redis container runs correctly in a self-hosted Docker setup for Dify version 0.6.12:
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=difyai123456
REDIS_DB=0
REDIS_USERNAME=
REDIS_USE_SSL=false
These settings should match the Redis service configuration in your docker-compose.middleware.yaml
file:
services:
# The redis cache.
redis:
image: redis:6-alpine
restart: always
volumes:
# Mount the redis data directory to the container.
- ./volumes/redis/data:/data
# Set the redis password when startup redis server.
command: redis-server --requirepass ${REDIS_PASSWORD:-difyai123456}
ports:
- "6379:6379"
Make sure to replace difyai123456
with a strong password of your choice. After updating the .env
file, restart your Docker containers:
docker compose down
docker compose up -d
Then, verify that all containers, including Redis, are running:
docker compose ps
This should help resolve the connection error [1][2][3][4].
To continue talking to Dosu, mention @dosu.
what is the difference of use between docker-compose.middleware.yaml and docker-compose.yaml? which one should be used to upgrade?
Actually, redis server works fine but somehow worker can connect redis server. it should be something wrong with the config?
The differences between docker-compose.middleware.yaml
and docker-compose.yaml
in the Dify repository are primarily in formatting and presentation. Both files contain the same services and configurations, so functionally, they are identical [1][2].
For upgrading, you can use either docker-compose.middleware.yaml
or docker-compose.yaml
as they both define the same services and configurations. However, ensure that the .env
file you are using matches the configurations in the chosen docker-compose
file.
Since your Redis server works fine but the worker cannot connect to it, double-check the following:
Environment Variables: Ensure that the environment variables in your .env
file are correctly set and match the Redis configuration.
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=difyai123456
Service Configuration: Verify that the Redis service configuration in your docker-compose
file is correct.
services:
redis:
image: redis:6-alpine
restart: always
volumes:
- ./volumes/redis/data:/data
command: redis-server --requirepass ${REDIS_PASSWORD:-difyai123456}
ports:
- "6379:6379"
Network Configuration: Ensure that all services are on the same Docker network and can communicate with each other.
Container Status: Verify that all containers, including the worker and Redis, are running and healthy.
docker compose ps
By ensuring these configurations are correct, you should be able to resolve the connection issue between the worker and the Redis server.
To continue talking to Dosu, mention @dosu.
also have similar issue - docker @ windows run with
@echo off cd dify/docker call git pull origin main call docker compose down call docker compose pull call docker compose up -d --remove-orphans
then output bunch of warnings
(...)
using default env file warning gone but now
2024-06-28 22:30:39 ssrf_proxy-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:30:41 ssrf_proxy-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:30:44 ssrf_proxy-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:30:46 ssrf_proxy-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:30:48 ssrf_proxy-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:30:50 ssrf_proxy-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:30:54 ssrf_proxy-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:31:01 ssrf_proxy-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:31:14 ssrf_proxy-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:31:40 ssrf_proxy-1 | sh: 1: /docker-entrypoint.sh: not found
and
2024-06-28 22:30:46 nginx-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:30:47 nginx-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:30:49 nginx-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:30:53 nginx-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:30:59 nginx-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:31:12 nginx-1 | sh: 1: /docker-entrypoint.sh: not found 2024-06-28 22:31:38 nginx-1 | sh: 1: /docker-entrypoint.sh: not found
2 volumes are created but are 0 byte files
I also could not start DIFY 0.6.12 with the following error.
/docker-entrypoint.sh: not found
I was able to start it successfully by using docker-legacy.
cd docker-legacy
docker compose -p dify up -d
Since docker-legacy/volumes is the initial state, DIFY will start on the first signup screen.
@damadorPL
"docker\nginx\docker-entrypoint.sh" "docker\ssrf_proxy\docker-entrypoint.sh"
Converting these two files from CRLF to LF will resolve the issue.
You can use "Notepad++". Open the file, go to Edit, EOL Conversion, select UNIX (LF), and save the file. Don't forget to run "docker compose up -d" again.
I spent quite some time figuring this out, not sure if it counts as a bug?
what is the difference of use between docker-compose.middleware.yaml and docker-compose.yaml? which one should be used to upgrade?
Actually, redis server works fine but somehow worker can connect redis server. it should be something wrong with the config?
docker-compose.middleware.yaml
is used for self hosted (source code).
In your case, you should use docker-compose.yaml
to start the container instead.
@damadorPL
“docker\nginx\docker-entrypoint.sh” “docker\ssrf_proxy\docker-entrypoint.sh”
将这两个文件从 CRLF 转换为 LF 将解决该问题。
您可以使用“Notepad++”。打开文件,转到编辑、EOL 转换,选择 UNIX (LF),然后保存文件。 别忘了再次运行“docker compose up -d”。
我花了很长时间来解决这个问题,不确定这是否算是一个错误?
可以解决nginx,ssrf_proxy的docker无法启动问题
On windows, if git config core.autocrlf is true (default), the above problem occurs and DIFY cannot be started.
You can manually edit file CRLF -> LF as described above, or changing the git config and pulling should solve the problem.
git config --global core.autocrlf false
@damadorPL
"docker\nginx\docker-entrypoint.sh" "docker\ssrf_proxy\docker-entrypoint.sh"
Converting these two files from CRLF to LF will resolve the issue.
You can use "Notepad++". Open the file, go to Edit, EOL Conversion, select UNIX (LF), and save the file. Don't forget to run "docker compose up -d" again.
I spent quite some time figuring this out, not sure if it counts as a bug?
It works finally, great ! Thanks a lot !
all 0.6.12 containers are started but got this issue at (http://localhost/install) page ?
I guess @MWang-TS you need to attach the screenshot of web console.
I guess @MWang-TS you need to attach the screenshot of web console.
The screenshot above is the interface for initializing the administrator user password ,after I click [Setting up an admin account] from signin page.
+1
❌ Actual Behavior redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
+1
❌ Actual Behavior redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
@KevinLoveGitHub It happens when you have other redis server started in you machine. You can turn this off. And start the application again. Also please pull the latest code.
+1 ❌ Actual Behavior redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
@KevinLoveGitHub It happens when you have other redis server started in you machine. You can turn this off. And start the application again. Also please pull the latest code.
The server is not running redis service. It will be correct if it is reduced to 0.6.11
Self Checks
Dify version
0.6.12
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Copy the docker/.env.example file to a new file named .env and customize it as needed. Run docker compose up to start the services.
✔️ Expected Behavior
upgrade
❌ Actual Behavior
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.