mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 17:09:23 +08:00
fix(docker): improve IRIS data persistence with proper Durable %SYS (#31901)
Co-authored-by: Tomo Okuyama <tomo.okuyama@intersystems.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -662,13 +662,14 @@ services:
|
|||||||
- "${IRIS_SUPER_SERVER_PORT:-1972}:1972"
|
- "${IRIS_SUPER_SERVER_PORT:-1972}:1972"
|
||||||
- "${IRIS_WEB_SERVER_PORT:-52773}:52773"
|
- "${IRIS_WEB_SERVER_PORT:-52773}:52773"
|
||||||
volumes:
|
volumes:
|
||||||
- ./volumes/iris:/opt/iris
|
- ./volumes/iris:/durable
|
||||||
- ./iris/iris-init.script:/iris-init.script
|
- ./iris/iris-init.script:/iris-init.script
|
||||||
- ./iris/docker-entrypoint.sh:/custom-entrypoint.sh
|
- ./iris/docker-entrypoint.sh:/custom-entrypoint.sh
|
||||||
entrypoint: ["/custom-entrypoint.sh"]
|
entrypoint: ["/custom-entrypoint.sh"]
|
||||||
tty: true
|
tty: true
|
||||||
environment:
|
environment:
|
||||||
TZ: ${IRIS_TIMEZONE:-UTC}
|
TZ: ${IRIS_TIMEZONE:-UTC}
|
||||||
|
ISC_DATA_DIRECTORY: /durable/iris
|
||||||
|
|
||||||
# Oracle vector database
|
# Oracle vector database
|
||||||
oracle:
|
oracle:
|
||||||
|
|||||||
@@ -1348,13 +1348,14 @@ services:
|
|||||||
- "${IRIS_SUPER_SERVER_PORT:-1972}:1972"
|
- "${IRIS_SUPER_SERVER_PORT:-1972}:1972"
|
||||||
- "${IRIS_WEB_SERVER_PORT:-52773}:52773"
|
- "${IRIS_WEB_SERVER_PORT:-52773}:52773"
|
||||||
volumes:
|
volumes:
|
||||||
- ./volumes/iris:/opt/iris
|
- ./volumes/iris:/durable
|
||||||
- ./iris/iris-init.script:/iris-init.script
|
- ./iris/iris-init.script:/iris-init.script
|
||||||
- ./iris/docker-entrypoint.sh:/custom-entrypoint.sh
|
- ./iris/docker-entrypoint.sh:/custom-entrypoint.sh
|
||||||
entrypoint: ["/custom-entrypoint.sh"]
|
entrypoint: ["/custom-entrypoint.sh"]
|
||||||
tty: true
|
tty: true
|
||||||
environment:
|
environment:
|
||||||
TZ: ${IRIS_TIMEZONE:-UTC}
|
TZ: ${IRIS_TIMEZONE:-UTC}
|
||||||
|
ISC_DATA_DIRECTORY: /durable/iris
|
||||||
|
|
||||||
# Oracle vector database
|
# Oracle vector database
|
||||||
oracle:
|
oracle:
|
||||||
|
|||||||
@@ -1,28 +1,56 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Function to configure IRIS (idempotent - safe to run multiple times)
|
# IRIS configuration flag file (stored in durable directory to persist with data)
|
||||||
|
IRIS_CONFIG_DONE="/durable/.iris-configured"
|
||||||
|
|
||||||
|
# Function to wait for IRIS to be ready
|
||||||
|
wait_for_iris() {
|
||||||
|
echo "Waiting for IRIS to be ready..."
|
||||||
|
local max_attempts=30
|
||||||
|
local attempt=1
|
||||||
|
while [ "$attempt" -le "$max_attempts" ]; do
|
||||||
|
if iris qlist IRIS 2>/dev/null | grep -q "running"; then
|
||||||
|
echo "IRIS is ready."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "Attempt $attempt/$max_attempts: IRIS not ready yet, waiting..."
|
||||||
|
sleep 2
|
||||||
|
attempt=$((attempt + 1))
|
||||||
|
done
|
||||||
|
echo "ERROR: IRIS failed to start within expected time." >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to configure IRIS
|
||||||
configure_iris() {
|
configure_iris() {
|
||||||
echo "Running IRIS initialization..."
|
echo "Configuring IRIS for first-time setup..."
|
||||||
|
|
||||||
# Wait for IRIS to be fully started
|
# Wait for IRIS to be fully started
|
||||||
sleep 5
|
wait_for_iris
|
||||||
|
|
||||||
# Execute the initialization script
|
# Execute the initialization script
|
||||||
iris session IRIS < /iris-init.script
|
iris session IRIS < /iris-init.script
|
||||||
|
|
||||||
echo "IRIS initialization completed."
|
# Mark configuration as done
|
||||||
|
touch "$IRIS_CONFIG_DONE"
|
||||||
|
|
||||||
|
echo "IRIS configuration completed."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start IRIS for initialization
|
# Start IRIS in background for initial configuration if not already configured
|
||||||
echo "Starting IRIS for initialization..."
|
if [ ! -f "$IRIS_CONFIG_DONE" ]; then
|
||||||
iris start IRIS
|
echo "First-time IRIS setup detected. Starting IRIS for configuration..."
|
||||||
|
|
||||||
# Configure IRIS (idempotent)
|
# Start IRIS
|
||||||
configure_iris
|
iris start IRIS
|
||||||
|
|
||||||
# Stop IRIS
|
# Configure IRIS
|
||||||
iris stop IRIS quietly
|
configure_iris
|
||||||
|
|
||||||
|
# Stop IRIS
|
||||||
|
iris stop IRIS quietly
|
||||||
|
fi
|
||||||
|
|
||||||
# Run the original IRIS entrypoint
|
# Run the original IRIS entrypoint
|
||||||
exec /iris-main "$@"
|
exec /iris-main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user