feat(objectstorage): add Aliyun OSS support and auto-detect provider in deploy workflows

Introduces Aliyun OSS as an alternative to MinIO; deploy scripts and CI
workflows now read object_storage.provider from config and conditionally
include or skip MinIO resources in both Docker Compose and k3s paths.
Also adds ops scheduler domain and its migration tables.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-20 10:25:02 +08:00
parent 00eb514efc
commit 98f73c5bea
18 changed files with 901 additions and 34 deletions
+100 -7
View File
@@ -573,6 +573,90 @@ jobs:
docker_cmd compose "$@"
}
ensure_config_aliases() {
for yaml in config.yaml config.local.yaml ops-config.yaml ops-config.local.yaml; do
yml="${yaml%.yaml}.yml"
if [ ! -f "${release_dir}/deploy/${yaml}" ] && [ -f "${release_dir}/deploy/${yml}" ]; then
cp "${release_dir}/deploy/${yml}" "${release_dir}/deploy/${yaml}"
echo "Created ${yaml} from ${yml} for deployment mounts."
fi
done
if [ ! -f "${release_dir}/deploy/prompts.yml" ] && [ -f "${release_dir}/deploy/prompts.yaml" ]; then
cp "${release_dir}/deploy/prompts.yaml" "${release_dir}/deploy/prompts.yml"
echo "Created prompts.yml from prompts.yaml for deployment mounts."
fi
}
config_file_path() {
base="$1"
for file in "${release_dir}/deploy/${base}.yaml" "${release_dir}/deploy/${base}.yml"; do
if [ -f "${file}" ]; then
printf '%s' "${file}"
return 0
fi
done
}
read_object_storage_provider() {
provider="minio"
for file in "$(config_file_path config)" "$(config_file_path config.local)"; do
if [ -z "${file}" ] || [ ! -f "${file}" ]; then
continue
fi
next="$(
awk '
/^[[:space:]]*object_storage:[[:space:]]*$/ {
in_section=1
base=match($0, /[^[:space:]]/) - 1
next
}
in_section {
indent=match($0, /[^[:space:]]/) - 1
if ($0 ~ /^[[:space:]]*$/ || $0 ~ /^[[:space:]]*#/) {
next
}
if (indent <= base) {
in_section=0
next
}
if ($0 ~ /^[[:space:]]*provider[[:space:]]*:/) {
value=$0
sub(/^[[:space:]]*provider[[:space:]]*:[[:space:]]*/, "", value)
sub(/[[:space:]]+#.*$/, "", value)
gsub(/^["'\'']|["'\'']$/, "", value)
print value
}
}
' "${file}" | tail -1
)"
if [ -n "${next}" ]; then
provider="${next}"
fi
done
printf '%s' "$(printf '%s' "${provider}" | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]')"
}
use_minio_for_object_storage() {
case "$(read_object_storage_provider)" in
""|minio|mino)
return 0
;;
aliyun|aliyun_oss|aliyun-oss|oss)
return 1
;;
*)
return 0
;;
esac
}
compose_files() {
printf '%s\n' -f "${release_dir}/deploy/docker-compose.yaml"
if ! use_minio_for_object_storage; then
printf '%s\n' -f "${release_dir}/deploy/docker-compose.aliyun-oss.yaml"
fi
}
docker_login() {
if [ "${DOCKER_MODE}" = "sudo" ]; then
printf '%s\n' "${SUDO_PASSWORD}" | sudo -S -p "" -v
@@ -606,11 +690,20 @@ jobs:
fi
docker_login
ensure_config_aliases
provider="$(read_object_storage_provider)"
if use_minio_for_object_storage; then
echo "object_storage.provider=${provider}; deploying MinIO."
else
echo "object_storage.provider=${provider}; skipping MinIO."
export COMPOSE_PROFILES=""
docker_cmd rm -f geo-minio geo-minio-init >/dev/null 2>&1 || true
fi
IMAGE_REGISTRY="${REGISTRY_HOST}/${REGISTRY_OWNER}/${REGISTRY_IMAGE_PREFIX}" \
IMAGE_TAG="${IMAGE_TAG}" compose_cmd \
--env-file "${shared_dir}/.env" \
-f "${release_dir}/deploy/docker-compose.yaml" \
$(compose_files) \
config >/tmp/geo-rankly-compose-service.yaml
if [ "${RUN_MIGRATIONS}" = "true" ]; then
@@ -618,19 +711,19 @@ jobs:
IMAGE_REGISTRY="${REGISTRY_HOST}/${REGISTRY_OWNER}/${REGISTRY_IMAGE_PREFIX}" \
IMAGE_TAG="${IMAGE_TAG}" compose_cmd \
--env-file "${shared_dir}/.env" \
-f "${release_dir}/deploy/docker-compose.yaml" \
$(compose_files) \
rm -f -s migrate >/dev/null 2>&1 || true
IMAGE_REGISTRY="${REGISTRY_HOST}/${REGISTRY_OWNER}/${REGISTRY_IMAGE_PREFIX}" \
IMAGE_TAG="${IMAGE_TAG}" compose_cmd \
--env-file "${shared_dir}/.env" \
-f "${release_dir}/deploy/docker-compose.yaml" \
$(compose_files) \
pull migrate
IMAGE_REGISTRY="${REGISTRY_HOST}/${REGISTRY_OWNER}/${REGISTRY_IMAGE_PREFIX}" \
IMAGE_TAG="${IMAGE_TAG}" compose_cmd \
--env-file "${shared_dir}/.env" \
-f "${release_dir}/deploy/docker-compose.yaml" \
$(compose_files) \
up --no-build --force-recreate migrate
fi
@@ -638,14 +731,14 @@ jobs:
IMAGE_REGISTRY="${REGISTRY_HOST}/${REGISTRY_OWNER}/${REGISTRY_IMAGE_PREFIX}" \
IMAGE_TAG="${IMAGE_TAG}" compose_cmd \
--env-file "${shared_dir}/.env" \
-f "${release_dir}/deploy/docker-compose.yaml" \
$(compose_files) \
pull ${SERVICE_LIST}
echo "Restarting selected service(s): ${SERVICE_LIST}"
IMAGE_REGISTRY="${REGISTRY_HOST}/${REGISTRY_OWNER}/${REGISTRY_IMAGE_PREFIX}" \
IMAGE_TAG="${IMAGE_TAG}" compose_cmd \
--env-file "${shared_dir}/.env" \
-f "${release_dir}/deploy/docker-compose.yaml" \
$(compose_files) \
up -d --no-build --no-deps --force-recreate ${SERVICE_LIST}
ln -sfn "${release_dir}" "${DEPLOY_BASE}/current"
@@ -653,7 +746,7 @@ jobs:
IMAGE_REGISTRY="${REGISTRY_HOST}/${REGISTRY_OWNER}/${REGISTRY_IMAGE_PREFIX}" \
IMAGE_TAG="${IMAGE_TAG}" compose_cmd \
--env-file "${shared_dir}/.env" \
-f "${release_dir}/deploy/docker-compose.yaml" \
$(compose_files) \
ps ${SERVICE_LIST}
if [ "${KEEP_RELEASES}" -gt 0 ] 2>/dev/null; then