Skip to content

Commit 3079e77

Browse files
author
longbingljw
authored
fix:setup-mysql-env.sh (#48)
1 parent 24e84c7 commit 3079e77

File tree

2 files changed

+9
-48
lines changed

2 files changed

+9
-48
lines changed

docker/docker-compose.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
# or docker-compose-template.yaml and regenerate this file.
55
# ==================================================================
66

7-
# ==================================================================
8-
# ATTENTION: This file is used for Redis cache.
9-
# If you want to use MySQL cache, please use docker-compose-mysql.yaml.
10-
# ==================================================================
11-
127
x-shared-env: &shared-api-worker-env
138
CONSOLE_API_URL: ${CONSOLE_API_URL:-}
149
CONSOLE_WEB_URL: ${CONSOLE_WEB_URL:-}
@@ -747,7 +742,7 @@ services:
747742

748743
# The DifySandbox
749744
sandbox:
750-
image: langgenius/dify-sandbox:0.2.12dock
745+
image: langgenius/dify-sandbox:0.2.12
751746
restart: always
752747
environment:
753748
# The DifySandbox configurations

docker/setup-mysql-env.sh

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -217,52 +217,18 @@ update_env "COMPOSE_PROFILES" "$COMPOSE_PROFILES"
217217
update_env "VECTOR_STORE" "oceanbase"
218218
update_env "PIP_MIRROR_URL" "https://pypi.tuna.tsinghua.edu.cn/simple"
219219

220-
# Redis configuration
221-
USE_REDIS=$(get_user_input "Use Redis for caching?(Now suggest to use Redis) Y or N:" "Y")
222-
223-
if [ "$USE_REDIS" == "Y" ]; then
224-
print_message "info" "Configuring Redis cache..."
225-
226-
# Check if docker-compose-redis.yaml exists
227-
if [ -f "docker-compose-redis.yaml" ]; then
228-
print_message "info" "Found docker-compose-redis.yaml, copying to docker-compose.yaml"
229-
cp docker-compose-redis.yaml docker-compose.yaml
230-
231-
# Set environment to use Redis
232-
update_env "CACHE_SCHEME" "redis"
233-
update_env "CELERY_BROKER_URL" "redis://:difyai123456@redis:6379/1"
234-
235-
print_message "success" "Redis cache configuration completed."
236-
print_message "info" "Use 'docker-compose up -d' to start services with Redis."
237-
else
238-
print_message "error" "ERROR: docker-compose-redis.yaml not found!"
239-
print_message "info" "Please create docker-compose-redis.yaml with Redis service configuration."
240-
exit 1
241-
fi
242-
update_env "OCEANBASE_CLUSTER_NAME" "difyai-redis"
243-
else
244-
print_message "info" "Using MySQL cache as default."
245-
# Copy MySQL configuration to docker-compose.yaml
246-
if [ -f "docker-compose-mysql.yaml" ]; then
247-
print_message "info" "Found docker-compose-mysql.yaml, copying to docker-compose.yaml"
248-
cp docker-compose-mysql.yaml docker-compose.yaml
249-
fi
250-
print_message "info" "Using MySQL cache as default."
251-
update_env "CACHE_SCHEME" "mysql"
252-
253-
254-
# Update CELERY_BROKER_URL for MySQL cache with proper URL encoding
255-
# URL encode the username to handle special characters like @
256-
ENCODED_USERNAME=$(echo "$DB_USERNAME" | sed 's/@/%40/g')
257-
CELERY_BROKER_URL="sqla+mysql+pymysql://${ENCODED_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}"
258-
update_env "CELERY_BROKER_URL" "$CELERY_BROKER_URL"
259-
print_message "success" "CELERY_BROKER_URL updated for MySQL cache."
260-
fi
220+
# Redis configuration (Using Redis as cache)
221+
print_message "info" "Configuring Redis cache..."
222+
223+
# Set environment to use Redis
224+
update_env "CACHE_SCHEME" "redis"
225+
update_env "CELERY_BROKER_URL" "redis://:difyai123456@redis:6379/1"
226+
227+
print_message "success" "Redis cache configuration completed."
261228

262229
print_message "success" "\nDatabase parameters are written into .env successfully."
263230

264231
print_message "success" "\nConnect to metadata database:"
265232
print_message "success" "\n mysql -h$DB_HOST -P$DB_PORT -u$DB_USERNAME -p$DB_PASSWORD -D$DB_DATABASE"
266233

267234

268-

0 commit comments

Comments
 (0)