fix(images): normalize shell scripts to LF line endings
CodeQL Advanced / Analyze (actions) (push) Canceled after 0s
CodeQL Advanced / Analyze (java-kotlin) (push) Canceled after 0s
CodeQL Advanced / Analyze (javascript-typescript) (push) Canceled after 0s
CodeQL Advanced / Analyze (python) (push) Canceled after 0s
Docker Image Build & Push / manifest (push) Canceled after 0s
Docker Image Build & Push / build-and-push-arm (push) Canceled after 0s
Docker Image Build & Push / build-and-push-amd (push) Canceled after 0s
Docker Image Build & Push / manifest (push) Canceled after 0s
Docker Image Build & Push / build-and-push-arm (push) Canceled after 0s
Docker Image Build & Push / build-and-push-amd (push) Canceled after 0s
Docker Image Build & Push / manifest (push) Canceled after 0s
Docker Image Build & Push / build-and-push-arm (push) Canceled after 0s
Docker Image Build & Push / build-and-push-amd (push) Canceled after 0s
Docker Image Build & Push / manifest (push) Canceled after 0s
Docker Image Build & Push / build-and-push-arm (push) Canceled after 0s
Docker Image Build & Push / build-and-push-amd (push) Canceled after 0s
Docker Image Build & Push / manifest (push) Canceled after 0s
Docker Image Build & Push / build-and-push-arm (push) Canceled after 0s
Docker Image Build & Push / build-and-push-amd (push) Canceled after 0s
Docker Image Build & Push / manifest (push) Canceled after 0s
Docker Image Build & Push / build-and-push-arm (push) Canceled after 0s
Docker Image Build & Push / build-and-push-amd (push) Canceled after 0s
Python Backend Docker Image CI / Build and Push Backend Python Docker Image (push) Canceled after 0s
Backend Docker Image CI / Build and Push Backend Docker Image (push) Canceled after 0s
Database Docker Image CI / Build and Push Database Docker Image (push) Canceled after 0s
Frontend Docker Image CI / Build and Push Frontend Docker Image (push) Canceled after 0s
Gateway Docker Image CI / Build and Push Gateway Docker Image (push) Canceled after 0s
Runtime Docker Image CI / Build and Push Runtime Docker Image (push) Canceled after 0s

database image crashed at start: CRLF shebang in start.sh made the kernel
look for interpreter '/bin/bash\r'. Other image Dockerfiles mask this with
dos2unix at build time, but scripts/images/database/Dockerfile does not.
Convert all tracked .sh files to LF and pin eol=lf via .gitattributes.
This commit is contained in:
apescale
2026-08-31 06:43:31 +08:00
parent 98b52fdb31
commit 54e067ed54
16 changed files with 1321 additions and 1319 deletions
+8 -8
View File
@@ -1,8 +1,8 @@
#!/bin/bash
set -e
umask 0022
echo "Starting main application..."
exec "$@"
#!/bin/bash
set -e
umask 0022
echo "Starting main application..."
exec "$@"
@@ -1,97 +1,97 @@
#!/bin/bash
set -euo pipefail
run_once=false
if [ "${1:-}" = "--once" ]; then
run_once=true
shift
fi
LOG_ROOT="${1:-${LOG_ROTATION_PATH:-/tmp/ray}}"
LOG_ROTATION_MAX_SIZE="${LOG_ROTATION_MAX_SIZE:-100MB}"
LOG_ROTATION_BACKUP_COUNT="${LOG_ROTATION_BACKUP_COUNT:-30}"
LOG_ROTATION_INTERVAL_SECONDS="${LOG_ROTATION_INTERVAL_SECONDS:-300}"
parse_size_bytes() {
local value
value="$(printf '%s' "$1" | tr '[:lower:]' '[:upper:]')"
value="${value// /}"
case "$value" in
*GB) echo $((${value%GB} * 1024 * 1024 * 1024)) ;;
*G) echo $((${value%G} * 1024 * 1024 * 1024)) ;;
*MB) echo $((${value%MB} * 1024 * 1024)) ;;
*M) echo $((${value%M} * 1024 * 1024)) ;;
*KB) echo $((${value%KB} * 1024)) ;;
*K) echo $((${value%K} * 1024)) ;;
*B) echo "${value%B}" ;;
*) echo "$value" ;;
esac
}
file_size_bytes() {
wc -c < "$1" | tr -d ' '
}
backup_path() {
local file="$1"
local index="$2"
local ext="${file##*.}"
local stem="${file%.$ext}"
echo "${stem}.${index}.${ext}"
}
is_backup_file() {
local name
name="$(basename "$1")"
[[ "$name" =~ \.[0-9]+\.(log|out|err)$ ]]
}
rotate_file() {
local file="$1"
local max_bytes="$2"
local backup_count="$3"
[ -f "$file" ] || return 0
is_backup_file "$file" && return 0
local current_size
current_size="$(file_size_bytes "$file")"
[ "$current_size" -lt "$max_bytes" ] && return 0
rm -f "$(backup_path "$file" "$backup_count")"
local index
for ((index = backup_count - 1; index >= 1; index--)); do
local src dst
src="$(backup_path "$file" "$index")"
dst="$(backup_path "$file" "$((index + 1))")"
[ -f "$src" ] && mv "$src" "$dst"
done
cp -p "$file" "$(backup_path "$file" 1)"
: > "$file"
}
rotate_once() {
[ -d "$LOG_ROOT" ] || return 0
local max_bytes
max_bytes="$(parse_size_bytes "$LOG_ROTATION_MAX_SIZE")"
while IFS= read -r -d '' file; do
rotate_file "$file" "$max_bytes" "$LOG_ROTATION_BACKUP_COUNT"
done < <(
find "$LOG_ROOT" -type f \( -name '*.log' -o -name '*.out' -o -name '*.err' \) -print0 2>/dev/null || true
)
}
if [ "$run_once" = true ]; then
rotate_once
exit 0
fi
while true; do
rotate_once
sleep "$LOG_ROTATION_INTERVAL_SECONDS"
done
#!/bin/bash
set -euo pipefail
run_once=false
if [ "${1:-}" = "--once" ]; then
run_once=true
shift
fi
LOG_ROOT="${1:-${LOG_ROTATION_PATH:-/tmp/ray}}"
LOG_ROTATION_MAX_SIZE="${LOG_ROTATION_MAX_SIZE:-100MB}"
LOG_ROTATION_BACKUP_COUNT="${LOG_ROTATION_BACKUP_COUNT:-30}"
LOG_ROTATION_INTERVAL_SECONDS="${LOG_ROTATION_INTERVAL_SECONDS:-300}"
parse_size_bytes() {
local value
value="$(printf '%s' "$1" | tr '[:lower:]' '[:upper:]')"
value="${value// /}"
case "$value" in
*GB) echo $((${value%GB} * 1024 * 1024 * 1024)) ;;
*G) echo $((${value%G} * 1024 * 1024 * 1024)) ;;
*MB) echo $((${value%MB} * 1024 * 1024)) ;;
*M) echo $((${value%M} * 1024 * 1024)) ;;
*KB) echo $((${value%KB} * 1024)) ;;
*K) echo $((${value%K} * 1024)) ;;
*B) echo "${value%B}" ;;
*) echo "$value" ;;
esac
}
file_size_bytes() {
wc -c < "$1" | tr -d ' '
}
backup_path() {
local file="$1"
local index="$2"
local ext="${file##*.}"
local stem="${file%.$ext}"
echo "${stem}.${index}.${ext}"
}
is_backup_file() {
local name
name="$(basename "$1")"
[[ "$name" =~ \.[0-9]+\.(log|out|err)$ ]]
}
rotate_file() {
local file="$1"
local max_bytes="$2"
local backup_count="$3"
[ -f "$file" ] || return 0
is_backup_file "$file" && return 0
local current_size
current_size="$(file_size_bytes "$file")"
[ "$current_size" -lt "$max_bytes" ] && return 0
rm -f "$(backup_path "$file" "$backup_count")"
local index
for ((index = backup_count - 1; index >= 1; index--)); do
local src dst
src="$(backup_path "$file" "$index")"
dst="$(backup_path "$file" "$((index + 1))")"
[ -f "$src" ] && mv "$src" "$dst"
done
cp -p "$file" "$(backup_path "$file" 1)"
: > "$file"
}
rotate_once() {
[ -d "$LOG_ROOT" ] || return 0
local max_bytes
max_bytes="$(parse_size_bytes "$LOG_ROTATION_MAX_SIZE")"
while IFS= read -r -d '' file; do
rotate_file "$file" "$max_bytes" "$LOG_ROTATION_BACKUP_COUNT"
done < <(
find "$LOG_ROOT" -type f \( -name '*.log' -o -name '*.out' -o -name '*.err' \) -print0 2>/dev/null || true
)
}
if [ "$run_once" = true ]; then
rotate_once
exit 0
fi
while true; do
rotate_once
sleep "$LOG_ROTATION_INTERVAL_SECONDS"
done
+32 -32
View File
@@ -1,32 +1,32 @@
#!/bin/bash
set -euo pipefail
LOG_DIR="${POSTGRES_LOG_DIR:-/var/log/deepdata/database}"
LOG_ROTATION_BACKUP_COUNT="${LOG_ROTATION_BACKUP_COUNT:-30}"
LOG_ROTATION_INTERVAL_SECONDS="${LOG_ROTATION_INTERVAL_SECONDS:-300}"
prune_once() {
[ -d "$LOG_DIR" ] || return 0
mapfile -t files < <(
find "$LOG_DIR" -maxdepth 1 -type f -name 'postgresql-*.log' -printf '%T@ %p\n' 2>/dev/null \
| sort -rn \
| sed 's/^[^ ]* //'
)
local index
for ((index = LOG_ROTATION_BACKUP_COUNT; index < ${#files[@]}; index++)); do
rm -f "${files[$index]}"
done
}
if [ "${1:-}" = "--once" ]; then
prune_once
exit 0
fi
while true; do
prune_once
sleep "$LOG_ROTATION_INTERVAL_SECONDS"
done
#!/bin/bash
set -euo pipefail
LOG_DIR="${POSTGRES_LOG_DIR:-/var/log/deepdata/database}"
LOG_ROTATION_BACKUP_COUNT="${LOG_ROTATION_BACKUP_COUNT:-30}"
LOG_ROTATION_INTERVAL_SECONDS="${LOG_ROTATION_INTERVAL_SECONDS:-300}"
prune_once() {
[ -d "$LOG_DIR" ] || return 0
mapfile -t files < <(
find "$LOG_DIR" -maxdepth 1 -type f -name 'postgresql-*.log' -printf '%T@ %p\n' 2>/dev/null \
| sort -rn \
| sed 's/^[^ ]* //'
)
local index
for ((index = LOG_ROTATION_BACKUP_COUNT; index < ${#files[@]}; index++)); do
rm -f "${files[$index]}"
done
}
if [ "${1:-}" = "--once" ]; then
prune_once
exit 0
fi
while true; do
prune_once
sleep "$LOG_ROTATION_INTERVAL_SECONDS"
done
+7 -7
View File
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
/usr/local/bin/prune-postgres-logs.sh &
exec docker-entrypoint.sh "$@"
#!/bin/bash
set -e
/usr/local/bin/prune-postgres-logs.sh &
exec docker-entrypoint.sh "$@"
+92 -92
View File
@@ -1,92 +1,92 @@
#!/bin/bash
set -euo pipefail
LOG_DIR="${NGINX_LOG_DIR:-/var/log/deepdata/frontend}"
LOG_ROTATION_MAX_SIZE="${LOG_ROTATION_MAX_SIZE:-100MB}"
LOG_ROTATION_BACKUP_COUNT="${LOG_ROTATION_BACKUP_COUNT:-30}"
LOG_ROTATION_INTERVAL_SECONDS="${LOG_ROTATION_INTERVAL_SECONDS:-300}"
parse_size_bytes() {
local value
value="$(printf '%s' "$1" | tr '[:lower:]' '[:upper:]')"
value="${value// /}"
case "$value" in
*GB) echo $((${value%GB} * 1024 * 1024 * 1024)) ;;
*G) echo $((${value%G} * 1024 * 1024 * 1024)) ;;
*MB) echo $((${value%MB} * 1024 * 1024)) ;;
*M) echo $((${value%M} * 1024 * 1024)) ;;
*KB) echo $((${value%KB} * 1024)) ;;
*K) echo $((${value%K} * 1024)) ;;
*B) echo "${value%B}" ;;
*) echo "$value" ;;
esac
}
file_size_bytes() {
wc -c < "$1" | tr -d ' '
}
backup_path() {
local file="$1"
local index="$2"
local ext="${file##*.}"
local stem="${file%.$ext}"
echo "${stem}.${index}.${ext}"
}
rotate_file() {
local file="$1"
local max_bytes="$2"
local backup_count="$3"
[ -f "$file" ] || return 1
local current_size
current_size="$(file_size_bytes "$file")"
[ "$current_size" -lt "$max_bytes" ] && return 1
rm -f "$(backup_path "$file" "$backup_count")"
local index
for ((index = backup_count - 1; index >= 1; index--)); do
local src dst
src="$(backup_path "$file" "$index")"
dst="$(backup_path "$file" "$((index + 1))")"
[ -f "$src" ] && mv "$src" "$dst"
done
mv "$file" "$(backup_path "$file" 1)"
install -o nginx -g nginx -m 0644 /dev/null "$file"
return 0
}
rotate_once() {
mkdir -p "$LOG_DIR"
touch "$LOG_DIR/access.log" "$LOG_DIR/error.log"
chown -R nginx:nginx "$LOG_DIR" 2>/dev/null || true
local max_bytes
max_bytes="$(parse_size_bytes "$LOG_ROTATION_MAX_SIZE")"
local rotated=false
for file in "$LOG_DIR/access.log" "$LOG_DIR/error.log"; do
if rotate_file "$file" "$max_bytes" "$LOG_ROTATION_BACKUP_COUNT"; then
rotated=true
fi
done
if [ "$rotated" = true ]; then
nginx -s reopen || true
fi
}
if [ "${1:-}" = "--once" ]; then
rotate_once
exit 0
fi
while true; do
rotate_once
sleep "$LOG_ROTATION_INTERVAL_SECONDS"
done
#!/bin/bash
set -euo pipefail
LOG_DIR="${NGINX_LOG_DIR:-/var/log/deepdata/frontend}"
LOG_ROTATION_MAX_SIZE="${LOG_ROTATION_MAX_SIZE:-100MB}"
LOG_ROTATION_BACKUP_COUNT="${LOG_ROTATION_BACKUP_COUNT:-30}"
LOG_ROTATION_INTERVAL_SECONDS="${LOG_ROTATION_INTERVAL_SECONDS:-300}"
parse_size_bytes() {
local value
value="$(printf '%s' "$1" | tr '[:lower:]' '[:upper:]')"
value="${value// /}"
case "$value" in
*GB) echo $((${value%GB} * 1024 * 1024 * 1024)) ;;
*G) echo $((${value%G} * 1024 * 1024 * 1024)) ;;
*MB) echo $((${value%MB} * 1024 * 1024)) ;;
*M) echo $((${value%M} * 1024 * 1024)) ;;
*KB) echo $((${value%KB} * 1024)) ;;
*K) echo $((${value%K} * 1024)) ;;
*B) echo "${value%B}" ;;
*) echo "$value" ;;
esac
}
file_size_bytes() {
wc -c < "$1" | tr -d ' '
}
backup_path() {
local file="$1"
local index="$2"
local ext="${file##*.}"
local stem="${file%.$ext}"
echo "${stem}.${index}.${ext}"
}
rotate_file() {
local file="$1"
local max_bytes="$2"
local backup_count="$3"
[ -f "$file" ] || return 1
local current_size
current_size="$(file_size_bytes "$file")"
[ "$current_size" -lt "$max_bytes" ] && return 1
rm -f "$(backup_path "$file" "$backup_count")"
local index
for ((index = backup_count - 1; index >= 1; index--)); do
local src dst
src="$(backup_path "$file" "$index")"
dst="$(backup_path "$file" "$((index + 1))")"
[ -f "$src" ] && mv "$src" "$dst"
done
mv "$file" "$(backup_path "$file" 1)"
install -o nginx -g nginx -m 0644 /dev/null "$file"
return 0
}
rotate_once() {
mkdir -p "$LOG_DIR"
touch "$LOG_DIR/access.log" "$LOG_DIR/error.log"
chown -R nginx:nginx "$LOG_DIR" 2>/dev/null || true
local max_bytes
max_bytes="$(parse_size_bytes "$LOG_ROTATION_MAX_SIZE")"
local rotated=false
for file in "$LOG_DIR/access.log" "$LOG_DIR/error.log"; do
if rotate_file "$file" "$max_bytes" "$LOG_ROTATION_BACKUP_COUNT"; then
rotated=true
fi
done
if [ "$rotated" = true ]; then
nginx -s reopen || true
fi
}
if [ "${1:-}" = "--once" ]; then
rotate_once
exit 0
fi
while true; do
rotate_once
sleep "$LOG_ROTATION_INTERVAL_SECONDS"
done
+62 -62
View File
@@ -1,62 +1,62 @@
#!/bin/bash
function set_proxy_protocol() {
if [ "${REAL_IP_MODE}" != "proxy_protocol" ]; then
echo "REAL_IP_MODE is ${REAL_IP_MODE}, no need to update nginx configuration file."
return 0
fi
sed -i 's/listen 3000;/listen 3000 proxy_protocol;/' /opt/frontend/http_backend.conf
sed -i 's/listen 3000 ssl;/listen 3000 ssl proxy_protocol;/' /opt/frontend/https_backend.conf
sed -i '/access_log.*main/a\ set_real_ip_from 0.0.0.0/0;' /opt/frontend/nginx.conf
sed -i '/access_log.*main/a\ real_ip_header proxy_protocol;' /opt/frontend/nginx.conf
echo "Nginx configuration file updated."
}
mkdir -p /var/log/deepdata/frontend
touch /var/log/deepdata/frontend/access.log /var/log/deepdata/frontend/error.log
chown -R nginx:nginx /var/log/deepdata/frontend 2>/dev/null || true
/usr/local/bin/rotate-nginx-logs.sh &
if [ -f "/cert/server.pem" ]; then
cp /cert/server.pem /etc/nginx/cert/server.pem
chown nginx:nginx /etc/nginx/cert/server.pem
fi
if [ -f "/cert/server.key" ]; then
# Private key MUST be encrypted. Plaintext keys are not accepted.
if grep -q "ENCRYPTED" /cert/server.key 2>/dev/null; then
if [ -z "$CERT_PASS" ]; then
echo "ERROR: CERT_PASS is required to decrypt the private key"
exit 1
fi
echo "$CERT_PASS" | openssl pkey -in /cert/server.key -out /etc/nginx/cert/server.key -passin stdin
chmod 600 /etc/nginx/cert/server.key
else
echo "ERROR: /cert/server.key is not encrypted. Please encrypt it before deployment."
exit 1
fi
chown nginx:nginx /etc/nginx/cert/server.key
fi
set_proxy_protocol
cp /opt/frontend/nginx.conf /etc/nginx/nginx.conf
if [ -f "/etc/nginx/cert/server.pem" ]; then
cp /opt/frontend/https_backend.conf /etc/nginx/conf.d/default.conf
cp /opt/frontend/routes.inc /etc/nginx/conf.d/routes.inc
echo "Switching to HTTPS config"
else
cp /opt/frontend/http_backend.conf /etc/nginx/conf.d/default.conf
cp /opt/frontend/routes.inc /etc/nginx/conf.d/routes.inc
if [ -n "$DOMAIN" ]; then
cron
certbot --nginx "-d ${DOMAIN//,/ -d }"
echo "Switching to HTTPS config, Domain: $DOMAIN"
echo "0 0 1 * * root /usr/local/bin/certbot renew --quiet" | tee /etc/cron.d/certbot-renew
chmod 0644 /etc/cron.d/certbot-renew
else
echo "Switching to HTTP config"
fi
fi
exec nginx -g "daemon off;"
#!/bin/bash
function set_proxy_protocol() {
if [ "${REAL_IP_MODE}" != "proxy_protocol" ]; then
echo "REAL_IP_MODE is ${REAL_IP_MODE}, no need to update nginx configuration file."
return 0
fi
sed -i 's/listen 3000;/listen 3000 proxy_protocol;/' /opt/frontend/http_backend.conf
sed -i 's/listen 3000 ssl;/listen 3000 ssl proxy_protocol;/' /opt/frontend/https_backend.conf
sed -i '/access_log.*main/a\ set_real_ip_from 0.0.0.0/0;' /opt/frontend/nginx.conf
sed -i '/access_log.*main/a\ real_ip_header proxy_protocol;' /opt/frontend/nginx.conf
echo "Nginx configuration file updated."
}
mkdir -p /var/log/deepdata/frontend
touch /var/log/deepdata/frontend/access.log /var/log/deepdata/frontend/error.log
chown -R nginx:nginx /var/log/deepdata/frontend 2>/dev/null || true
/usr/local/bin/rotate-nginx-logs.sh &
if [ -f "/cert/server.pem" ]; then
cp /cert/server.pem /etc/nginx/cert/server.pem
chown nginx:nginx /etc/nginx/cert/server.pem
fi
if [ -f "/cert/server.key" ]; then
# Private key MUST be encrypted. Plaintext keys are not accepted.
if grep -q "ENCRYPTED" /cert/server.key 2>/dev/null; then
if [ -z "$CERT_PASS" ]; then
echo "ERROR: CERT_PASS is required to decrypt the private key"
exit 1
fi
echo "$CERT_PASS" | openssl pkey -in /cert/server.key -out /etc/nginx/cert/server.key -passin stdin
chmod 600 /etc/nginx/cert/server.key
else
echo "ERROR: /cert/server.key is not encrypted. Please encrypt it before deployment."
exit 1
fi
chown nginx:nginx /etc/nginx/cert/server.key
fi
set_proxy_protocol
cp /opt/frontend/nginx.conf /etc/nginx/nginx.conf
if [ -f "/etc/nginx/cert/server.pem" ]; then
cp /opt/frontend/https_backend.conf /etc/nginx/conf.d/default.conf
cp /opt/frontend/routes.inc /etc/nginx/conf.d/routes.inc
echo "Switching to HTTPS config"
else
cp /opt/frontend/http_backend.conf /etc/nginx/conf.d/default.conf
cp /opt/frontend/routes.inc /etc/nginx/conf.d/routes.inc
if [ -n "$DOMAIN" ]; then
cron
certbot --nginx "-d ${DOMAIN//,/ -d }"
echo "Switching to HTTPS config, Domain: $DOMAIN"
echo "0 0 1 * * root /usr/local/bin/certbot renew --quiet" | tee /etc/cron.d/certbot-renew
chmod 0644 /etc/cron.d/certbot-renew
else
echo "Switching to HTTP config"
fi
fi
exec nginx -g "daemon off;"
+5 -5
View File
@@ -1,6 +1,6 @@
#!/bin/bash
set -e
echo "Starting main application..."
#!/bin/bash
set -e
echo "Starting main application..."
exec "$@"
+35 -35
View File
@@ -1,35 +1,35 @@
#!/bin/bash
set -e
# 1. 初始化环境 (原有的逻辑:注入用户自定义算子)
if [ -d "/opt/runtime/user" ]; then
cp -r /opt/runtime/user/* /opt/runtime/deepdata/ops/user 2>/dev/null || true
fi
# 2. 根据 RAY_MODE 环境变量决定启动模式
if [ "${RAY_MODE}" = "head" ]; then
echo "🚀 Starting Ray Head..."
# ✅ 修复 Head 分支:
# Ray 2.x 已废弃 CLI 参数 --redis-address,改为自动读取环境变量 RAY_REDIS_ADDRESS。
# 只要确保 docker-compose.yml 中配置了 RAY_REDIS_ADDRESS 环境变量即可。
exec ray start --head \
--port=${RAY_HEAD_PORT:-6379} \
--redis-password=${RAY_REDIS_PASSWORD} \
--dashboard-host=0.0.0.0 \
--block
elif [ "${RAY_MODE}" = "worker" ]; then
echo "🚀 Starting Ray Worker connecting to ${RAY_HEAD_ADDRESS}..."
# ✅ 修复 Worker 分支:
# Ray 2.x 移除了 --worker 参数。只要不传 --head,默认即为 Worker 模式。
exec ray start \
--address=${RAY_HEAD_ADDRESS} \
--redis-password=${RAY_REDIS_PASSWORD} \
--num-cpus=${NUM_CPUS:-4} \
--block
else
echo "🔧 Starting Runtime (Legacy Mode / Job Execution)..."
# 默认行为:执行 docker-compose.yml command 传入的指令,或 Ray Job 的入口点
exec "$@"
fi
#!/bin/bash
set -e
# 1. 初始化环境 (原有的逻辑:注入用户自定义算子)
if [ -d "/opt/runtime/user" ]; then
cp -r /opt/runtime/user/* /opt/runtime/deepdata/ops/user 2>/dev/null || true
fi
# 2. 根据 RAY_MODE 环境变量决定启动模式
if [ "${RAY_MODE}" = "head" ]; then
echo "🚀 Starting Ray Head..."
# ✅ 修复 Head 分支:
# Ray 2.x 已废弃 CLI 参数 --redis-address,改为自动读取环境变量 RAY_REDIS_ADDRESS。
# 只要确保 docker-compose.yml 中配置了 RAY_REDIS_ADDRESS 环境变量即可。
exec ray start --head \
--port=${RAY_HEAD_PORT:-6379} \
--redis-password=${RAY_REDIS_PASSWORD} \
--dashboard-host=0.0.0.0 \
--block
elif [ "${RAY_MODE}" = "worker" ]; then
echo "🚀 Starting Ray Worker connecting to ${RAY_HEAD_ADDRESS}..."
# ✅ 修复 Worker 分支:
# Ray 2.x 移除了 --worker 参数。只要不传 --head,默认即为 Worker 模式。
exec ray start \
--address=${RAY_HEAD_ADDRESS} \
--redis-password=${RAY_REDIS_PASSWORD} \
--num-cpus=${NUM_CPUS:-4} \
--block
else
echo "🔧 Starting Runtime (Legacy Mode / Job Execution)..."
# 默认行为:执行 docker-compose.yml command 传入的指令,或 Ray Job 的入口点
exec "$@"
fi
+12 -12
View File
@@ -1,12 +1,12 @@
#!/bin/bash
set -e
cp -r /opt/runtime/user/* /opt/runtime/deepdata/ops/user
if [ "${LOG_ROTATION_ENABLED:-true}" = "true" ]; then
LOG_ROTATION_PATH="${LOG_ROTATION_PATH:-/tmp/ray}" /usr/local/bin/log-rotate-copytruncate.sh "${LOG_ROTATION_PATH:-/tmp/ray}" &
fi
echo "Starting main application..."
exec "$@"
#!/bin/bash
set -e
cp -r /opt/runtime/user/* /opt/runtime/deepdata/ops/user
if [ "${LOG_ROTATION_ENABLED:-true}" = "true" ]; then
LOG_ROTATION_PATH="${LOG_ROTATION_PATH:-/tmp/ray}" /usr/local/bin/log-rotate-copytruncate.sh "${LOG_ROTATION_PATH:-/tmp/ray}" &
fi
echo "Starting main application..."
exec "$@"