Files
mtusi2026lab5/.github/ci/stand-env.sh
T
ricoromaandClaude Opus 5.5 ff1a83b6ff feat: process attachments asynchronously with RabbitMQ and a worker
Upload answers 202 after staging, a queued job in PostgreSQL and a broker
confirm; a separate worker publishes the original and a thumbnail with
bounded retries. Adds the job and variant tables, the broker service, the
worker S3 user, cleanup and reconcile support for staging and variants,
the failure stand with broker and worker, bench and driver updates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 06:48:20 +03:00

40 lines
1.9 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Окружение шага job application (.github/workflows/application.yml),
# подключается через «.» из корня репозитория после make env_setup.
# Содержимое конфигов — в переменные для configs override
# .github/ci/compose.yml. $(cat …) срезает перевод строки в конце файла,
# поэтому он возвращается: копия побайтно равна файлу, а HAProxy без него
# конфиг не принимает («Missing LF on last line»). Значения не печатаются.
nl='
'
CI_CONFIG_TOML="$(cat config.toml)$nl"
CI_VALKEY_CONF="$(cat infra/valkey/valkey.conf)$nl"
CI_S3_BOOTSTRAP="$(cat infra/s3/bootstrap.sh)$nl"
CI_HAPROXY_CFG="$(cat infra/haproxy/haproxy.cfg)$nl"
CI_RABBITMQ_CONF="$(cat infra/rabbitmq/rabbitmq.conf)$nl"
export CI_CONFIG_TOML CI_VALKEY_CONF CI_S3_BOOTSTRAP CI_HAPROXY_CFG CI_RABBITMQ_CONF
# готовность стенда через LB: /health/ready отвечает 200 от API_REPLICAS
# (из .env, по умолчанию 2) разных реплик — X-Instance-Id. Срок 60 с:
# make replicas ждёт healthy контейнеров, а слот LB включается ещё через
# rise проверок
wait_replicas() {
want=$(sed -n 's/^API_REPLICAS=//p' .env)
want=${want:-2}
seen=""
deadline=$(($(date +%s) + 60))
while [ "$(date +%s)" -lt "$deadline" ]; do
reply=$(curl -s -o /dev/null -w '%{http_code} %header{x-instance-id}' \
"$BASE_URL/health/ready" || true)
case "$reply" in
"200 "?*) seen=$(printf '%s\n%s\n' "$seen" "${reply#200 }" | sort -u | grep .) ;;
esac
if [ "$(printf '%s\n' "$seen" | grep -c .)" -ge "$want" ]; then
echo "LB ready: $(printf '%s ' $seen)"
return 0
fi
sleep 0.5
done
echo "LB: $(printf '%s\n' "$seen" | grep -c .) of $want replicas ready in 60 s" >&2
return 1
}