mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-12-06 04:18:35 +08:00
* feat(deploy): support opt-in PostgreSQL in production Compose * fix(deploy): include PostgreSQL logs on startup failure * docs(deploy): document bundled PostgreSQL in the env example * fix(deploy): stop bundled PostgreSQL after its env file is removed * fix(deploy): give the bundled PostgreSQL Gateway a database-scoped login * fix(deploy): include the selected PostgreSQL service in production logs --------- Co-authored-by: Totoro-qaq <279883115+Totoro-qaq@users.noreply.github.com>
26 lines
1.2 KiB
Bash
26 lines
1.2 KiB
Bash
# Shared by the production startup and log commands. Compose parses the chosen
|
|
# dotenv file, including interpolation and the calling shell's overrides.
|
|
compose_dotenv_json_value() {
|
|
local key="$1" env_file="$2" rendered
|
|
shift 2
|
|
if ! rendered="$(printf 'services:\n probe:\n image: scratch\n environment:\n DEER_FLOW_PROBE_VALUE: ${%s}\n' "$key" \
|
|
| "$@" --env-file "$env_file" --project-directory "$DOCKER_DIR" -f - config --format json 2>&1)"; then
|
|
printf 'docker compose could not resolve %s from %s:\n%s\n' "$key" "$env_file" "$rendered" >&2
|
|
return 1
|
|
fi
|
|
printf '%s\n' "$rendered" | sed -n 's/^[[:space:]]*"DEER_FLOW_PROBE_VALUE": "\(.*\)",\{0,1\}$/\1/p' | head -n 1
|
|
}
|
|
|
|
compose_postgres_mode() {
|
|
local env_file="$1" mode="${DEER_FLOW_COMPOSE_POSTGRES-}"
|
|
shift
|
|
if [ -z "${DEER_FLOW_COMPOSE_POSTGRES+x}" ] && [ -f "$env_file" ] && grep -qF DEER_FLOW_COMPOSE_POSTGRES "$env_file"; then
|
|
mode="$(compose_dotenv_json_value DEER_FLOW_COMPOSE_POSTGRES "$env_file" "$@")" || return 1
|
|
fi
|
|
case "$mode" in
|
|
1) printf '1\n' ;;
|
|
0|"") printf '0\n' ;;
|
|
*) echo "DEER_FLOW_COMPOSE_POSTGRES must be 1, 0, or empty" >&2; return 1 ;;
|
|
esac
|
|
}
|