diff --git a/.github/workflows/secrets-toolkit.yml b/.github/workflows/secrets-toolkit.yml new file mode 100644 index 0000000..734c0a9 --- /dev/null +++ b/.github/workflows/secrets-toolkit.yml @@ -0,0 +1,30 @@ +name: Secrets Toolkit + +on: + pull_request: + paths: + - "scripts/secrets-*.sh" + - "scripts/tests/**" + - "secrets/**" + - ".github/workflows/secrets-toolkit.yml" + push: + branches: + - "feature/secrets-collect" + paths: + - "scripts/secrets-*.sh" + - "scripts/tests/**" + - "secrets/**" + - ".github/workflows/secrets-toolkit.yml" + +jobs: + verify: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install shellcheck + run: sudo apt-get update && sudo apt-get install -y shellcheck + + - name: Run toolkit checks + run: bash scripts/tests/run-all.sh diff --git a/scripts/secrets-collect.sh b/scripts/secrets-collect.sh new file mode 100755 index 0000000..227cc4e --- /dev/null +++ b/scripts/secrets-collect.sh @@ -0,0 +1,367 @@ +#!/bin/bash +# Collect pulled/local secrets into Bitwarden-ready value blocks. +# Values are written only to .secrets-recovery/bitwarden-blocks.txt. +set -euo pipefail + +umask 077 + +ROOT_DIR="${SECRETS_ROOT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" +RECOVERY_DIR="${SECRETS_RECOVERY_DIR:-${ROOT_DIR}/.secrets-recovery}" +PULLED_DIR="${SECRETS_PULLED_DIR:-${RECOVERY_DIR}/pulled}" +MAPPING_FILE="${SECRETS_COLLECT_MAPPING_FILE:-${ROOT_DIR}/secrets/collect-mapping.yaml}" +OUTPUT_FILE="${SECRETS_OUTPUT_FILE:-${RECOVERY_DIR}/bitwarden-blocks.txt}" + +usage() { + cat <&2 + usage >&2 + exit 2 +fi + +if [[ ! -d "${PULLED_DIR}" ]]; then + cat >&2 <&2 + exit 1 +fi + +mkdir -p "${RECOVERY_DIR}" + +flatten_path() { + local raw_path="$1" + local flattened="${raw_path#/}" + flattened="${flattened//\//__}" + printf '%s' "${flattened}" +} + +expand_local_path() { + local raw_path="$1" + case "${raw_path}" in + "~") + printf '%s' "${HOME}" + ;; + ~/*) + printf '%s/%s' "${HOME}" "${raw_path#~/}" + ;; + *) + printf '%s' "${raw_path}" + ;; + esac +} + +pulled_file_path() { + local server="$1" + local remote_file="$2" + printf '%s/%s/%s' "${PULLED_DIR}" "${server}" "$(flatten_path "${remote_file}")" +} + +trim_string() { + local value="$1" + value="${value#"${value%%[![:space:]]*}"}" + value="${value%"${value##*[![:space:]]}"}" + printf '%s' "${value}" +} + +strip_matching_quotes() { + local value="$1" + if [[ "${value}" == \"*\" && "${value}" == *\" ]]; then + value="${value:1:${#value}-2}" + elif [[ "${value}" == \'*\' && "${value}" == *\' ]]; then + value="${value:1:${#value}-2}" + fi + printf '%s' "${value}" +} + +lookup_assignment_value() { + local file_path="$1" + local key="$2" + local line + local value + + if [[ ! -f "${file_path}" ]]; then + return 1 + fi + + line="$(awk -v key="${key}" ' + BEGIN { + pattern = "^[[:space:]]*" key "=" + } + $0 ~ pattern { + result = $0 + } + END { + if (result != "") { + print result + } else { + exit 1 + } + } + ' "${file_path}")" || return 1 + + value="${line#*=}" + value="$(trim_string "${value}")" + value="${value%\\}" + value="$(trim_string "${value}")" + value="$(strip_matching_quotes "${value}")" + printf '%s' "${value}" +} + +extract_postgres_password() { + local url_value="$1" + + python3 - "$url_value" <<'PY' +import sys +from urllib.parse import unquote, urlparse + +url = sys.argv[1] +parsed = urlparse(url) +password = parsed.password +if password is None: + sys.exit(1) +print(unquote(password), end="") +PY +} + +parse_mapping() { + awk ' + function trim(value) { + gsub(/^[[:space:]]+|[[:space:]]+$/, "", value) + gsub(/^"|"$/, "", value) + return value + } + function value_after_colon() { + sub(/^[^:]+:[[:space:]]*/, "") + return trim($0) + } + function reset_record() { + bw_item = tag = optional = source_type = server = file = path = var = extract = vars = lines = "" + in_vars = 0 + in_lines = 0 + } + function flush_record() { + if (bw_item != "") { + print bw_item "\037" tag "\037" optional "\037" source_type "\037" server "\037" file "\037" path "\037" var "\037" extract "\037" vars "\037" lines + } + } + /^- bw_item:/ { + flush_record() + reset_record() + bw_item = value_after_colon() + next + } + /^ tag:/ { tag = value_after_colon(); next } + /^ optional:/ { optional = value_after_colon(); next } + /^ source:/ { next } + /^ type:/ { source_type = value_after_colon(); in_vars = 0; in_lines = 0; next } + /^ server:/ { server = value_after_colon(); in_vars = 0; in_lines = 0; next } + /^ file:/ { file = value_after_colon(); in_vars = 0; in_lines = 0; next } + /^ path:/ { path = value_after_colon(); in_vars = 0; in_lines = 0; next } + /^ var:/ { var = value_after_colon(); in_vars = 0; in_lines = 0; next } + /^ extract:/ { extract = value_after_colon(); in_vars = 0; in_lines = 0; next } + /^ vars:/ { in_vars = 1; in_lines = 0; next } + /^ lines:/ { in_lines = 1; in_vars = 0; next } + in_vars && /^ - / { + value = $0 + sub(/^ -[[:space:]]*/, "", value) + value = trim(value) + vars = vars (vars == "" ? "" : ",") value + next + } + in_lines && /^ - / { + value = $0 + sub(/^ -[[:space:]]*/, "", value) + value = trim(value) + lines = lines (lines == "" ? "" : "\034") value + next + } + !/^ - / { + in_vars = 0 + in_lines = 0 + } + BEGIN { reset_record() } + END { flush_record() } + ' "${MAPPING_FILE}" +} + +write_block() { + local out_file="$1" + local item_name="$2" + local tag_name="$3" + local body="$4" + + { + printf '### %s [%s]\n' "${item_name}" "${tag_name}" + printf '%s\n' "${body}" + printf '\n' + } >> "${out_file}" +} + +emit_missing_notice() { + local out_file="$1" + shift + local missing_items=("$@") + local joined + + if [[ "${#missing_items[@]}" -eq 0 ]]; then + return + fi + + joined="$(printf '%s, ' "${missing_items[@]}")" + joined="${joined%, }" + + { + printf '# PARTIAL: %s\n' "${joined}" + printf '\n' + } >> "${out_file}" +} + +tmp_output="$(mktemp "${RECOVERY_DIR}/bitwarden-blocks.XXXXXX")" +trap 'rm -f "${tmp_output}"' EXIT +chmod 600 "${tmp_output}" + +written_count=0 +missing_items=() + +while IFS=$'\037' read -r bw_item tag optional source_type server file path var extract vars_csv lines_raw; do + [[ -n "${bw_item}" ]] || continue + + source_file="" + block_body="" + + case "${source_type}" in + env_file) + source_file="$(pulled_file_path "${server}" "${file}")" + if ! block_value="$(lookup_assignment_value "${source_file}" "${var}")"; then + if [[ "${optional}" == "true" ]]; then + missing_items+=("${bw_item}") + fi + echo "Missing ${bw_item}: ${source_file} -> ${var}" >&2 + continue + fi + block_body="${var}=${block_value}" + ;; + env_file_group) + source_file="$(pulled_file_path "${server}" "${file}")" + if [[ ! -f "${source_file}" ]]; then + if [[ "${optional}" == "true" ]]; then + missing_items+=("${bw_item}") + fi + echo "Missing ${bw_item}: ${source_file}" >&2 + continue + fi + + block_lines=() + IFS=',' read -r -a vars_list <<< "${vars_csv}" + for member_var in "${vars_list[@]}"; do + if ! member_value="$(lookup_assignment_value "${source_file}" "${member_var}")"; then + if [[ "${optional}" == "true" ]]; then + missing_items+=("${bw_item}") + fi + echo "Missing ${bw_item}: ${source_file} -> ${member_var}" >&2 + block_lines=() + break + fi + block_lines+=("${member_var}=${member_value}") + done + + if [[ "${#block_lines[@]}" -eq 0 ]]; then + continue + fi + + block_body="$(printf '%s\n' "${block_lines[@]}")" + block_body="${block_body%$'\n'}" + ;; + extract_from_url) + source_file="$(pulled_file_path "${server}" "${file}")" + if ! url_value="$(lookup_assignment_value "${source_file}" "${var}")"; then + if [[ "${optional}" == "true" ]]; then + missing_items+=("${bw_item}") + fi + echo "Missing ${bw_item}: ${source_file} -> ${var}" >&2 + continue + fi + if [[ "${extract}" != "postgres_password" ]]; then + echo "Unsupported extract kind '${extract}' for ${bw_item}" >&2 + exit 1 + fi + if ! extracted_value="$(extract_postgres_password "${url_value}")"; then + if [[ "${optional}" == "true" ]]; then + missing_items+=("${bw_item}") + fi + echo "Missing ${bw_item}: unable to extract password from ${var}" >&2 + continue + fi + block_body="${var}=${url_value}"$'\n'"# extracted password -> ${extracted_value}" + ;; + whole_file) + source_file="$(pulled_file_path "${server}" "${file}")" + if [[ ! -f "${source_file}" ]]; then + if [[ "${optional}" == "true" ]]; then + missing_items+=("${bw_item}") + fi + echo "Missing ${bw_item}: ${source_file}" >&2 + continue + fi + block_body="$(<"${source_file}")" + ;; + local_file) + source_file="$(expand_local_path "${path}")" + if [[ ! -f "${source_file}" ]]; then + if [[ "${optional}" == "true" ]]; then + missing_items+=("${bw_item}") + fi + echo "Missing ${bw_item}: ${source_file}" >&2 + continue + fi + block_body="$(<"${source_file}")" + ;; + literal_lines) + IFS=$'\034' read -r -a literal_lines <<< "${lines_raw}" + block_body="$(printf '%s\n' "${literal_lines[@]}")" + block_body="${block_body%$'\n'}" + ;; + *) + echo "Unsupported source type '${source_type}' for ${bw_item}" >&2 + exit 1 + ;; + esac + + write_block "${tmp_output}" "${bw_item}" "${tag}" "${block_body}" + written_count=$((written_count + 1)) +done < <(parse_mapping) + +if [[ "${#missing_items[@]}" -gt 0 ]]; then + emit_missing_notice "${tmp_output}" "${missing_items[@]}" +fi +mv "${tmp_output}" "${OUTPUT_FILE}" +trap - EXIT + +chmod 600 "${OUTPUT_FILE}" +echo "${written_count} items written to ${OUTPUT_FILE}" diff --git a/scripts/secrets-pull.sh b/scripts/secrets-pull.sh index d471063..4936b00 100755 --- a/scripts/secrets-pull.sh +++ b/scripts/secrets-pull.sh @@ -3,6 +3,8 @@ # Values are written only to local gitignored files and are never printed. set -euo pipefail +umask 077 + ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" RECOVERY_DIR="${ROOT_DIR}/.secrets-recovery" TARGETS_FILE="${RECOVERY_DIR}/targets.env" @@ -98,10 +100,28 @@ remote_find_files() { ssh "${SSH_ARGS[@]}" bash -s -- "${roots[@]}" <<'REMOTE' set -euo pipefail +find_root_files() { + local root="$1" + local depth=3 + + case "${root}" in + /opt/assrep/core/deploy|/opt/assrep/core/deploy/*) + depth=5 + ;; + /opt/assrep|/opt/assrep/*|/opt/alert-agent|/opt/alert-agent/*) + depth=4 + ;; + esac + + find "${root}" -maxdepth "${depth}" -type f \ + \( -name "*.env" -o -name ".env" -o -name "*.json" -o -name "docker-compose.yml" -o -name "compose.yml" -o -name "db-backup.sh" -o -name "db-backup-alert.sh" \) \ + 2>/dev/null || true +} + for root in "$@"; do [[ -n "${root}" ]] || continue [[ -e "${root}" ]] || continue - find "${root}" -maxdepth 3 -type f \( -name "*.env" -o -name ".env" \) 2>/dev/null || true + find_root_files "${root}" done if [[ -f /etc/assrep/opencode-auth.json ]]; then @@ -110,6 +130,23 @@ fi REMOTE } +capture_remote_output() { + local target="$1" + local output_file="$2" + local command="$3" + + split_ssh_args "${target}" + # shellcheck disable=SC2029 + ssh "${SSH_ARGS[@]}" "${command}" > "${output_file}" || true + + if [[ ! -s "${output_file}" ]]; then + rm -f "${output_file}" + return 1 + fi + + chmod 600 "${output_file}" +} + copy_remote_file() { local target="$1" local remote_file="$2" @@ -158,10 +195,31 @@ pull_server() { done } +capture_generated_file() { + local label="$1" + local target="$2" + local pseudo_path="$3" + local command="$4" + local dest_dir="${PULLED_DIR}/${label}" + local dest_file + + dest_file="${dest_dir}/$(flatten_path "${pseudo_path}")" + + mkdir -p "${dest_dir}" + if capture_remote_output "${target}" "${dest_file}" "${command}"; then + echo " ${dest_file}" + fi +} + mkdir -p "${PULLED_DIR}" -pull_server "staging" "${STAGING_SSH}" "${STAGING_DEPLOY_PATH}" /etc/assrep /opt /srv -pull_server "ops" "${OPS_SSH}" "${OPS_CONFIG_PATH}" /etc/assrep /opt /srv +pull_server "staging" "${STAGING_SSH}" "${STAGING_DEPLOY_PATH}" /etc/assrep /opt/assrep /usr/local/bin /srv +echo "Generated captures from staging:" +capture_generated_file "staging" "${STAGING_SSH}" "/__generated/root-crontab.txt" "crontab -l 2>/dev/null || true" + +pull_server "ops" "${OPS_SSH}" "${OPS_CONFIG_PATH}" /etc/assrep /opt/assrep /opt/alert-agent /usr/local/bin /srv +echo "Generated captures from ops:" +capture_generated_file "ops" "${OPS_SSH}" "/__generated/docker-inspect-grafana.env" "docker inspect grafana --format '{{range .Config.Env}}{{println .}}{{end}}' 2>/dev/null || true" cat <&2 + exit 1 +} + +assert_contains() { + local file_path="$1" + local expected="$2" + if ! grep -Fq "${expected}" "${file_path}"; then + fail "expected '${expected}' in ${file_path}" + fi +} + +make_fixture_tree() { + local tmp_dir="$1" + mkdir -p "${tmp_dir}/.secrets-recovery/pulled/ops" "${tmp_dir}/.secrets-recovery/pulled/staging" +} + +run_collect() { + local tmp_dir="$1" + local mapping_file="$2" + SECRETS_ROOT_DIR="${tmp_dir}" \ + SECRETS_RECOVERY_DIR="${tmp_dir}/.secrets-recovery" \ + SECRETS_PULLED_DIR="${tmp_dir}/.secrets-recovery/pulled" \ + SECRETS_COLLECT_MAPPING_FILE="${mapping_file}" \ + SECRETS_OUTPUT_FILE="${tmp_dir}/.secrets-recovery/bitwarden-blocks.txt" \ + "${SCRIPT_PATH}" >/dev/null +} + +test_simple_var() { + local tmp_dir + tmp_dir="$(mktemp -d)" + trap 'rm -rf "${tmp_dir}"' RETURN + + make_fixture_tree "${tmp_dir}" + printf 'AGENT_BOT_TOKEN=test123\n' > "${tmp_dir}/.secrets-recovery/pulled/ops/etc__assrep__alert-bridge.env" + cat > "${tmp_dir}/mapping.yaml" <<'EOF' +- bw_item: ops/AGENT_BOT_TOKEN + tag: secret + source: + type: env_file + server: ops + file: /etc/assrep/alert-bridge.env + var: AGENT_BOT_TOKEN +EOF + + run_collect "${tmp_dir}" "${tmp_dir}/mapping.yaml" + assert_contains "${tmp_dir}/.secrets-recovery/bitwarden-blocks.txt" "### ops/AGENT_BOT_TOKEN [secret]" + assert_contains "${tmp_dir}/.secrets-recovery/bitwarden-blocks.txt" "AGENT_BOT_TOKEN=test123" +} + +test_extract_from_url() { + local tmp_dir + tmp_dir="$(mktemp -d)" + trap 'rm -rf "${tmp_dir}"' RETURN + + make_fixture_tree "${tmp_dir}" + printf 'DATABASE_URL=postgresql://postgres:s3cr3t@postgres:5432/glitchtip\n' > "${tmp_dir}/.secrets-recovery/pulled/ops/etc__assrep__glitchtip.env" + cat > "${tmp_dir}/mapping.yaml" <<'EOF' +- bw_item: ops/GLITCHTIP_DB_PASSWORD + tag: secret + source: + type: extract_from_url + server: ops + file: /etc/assrep/glitchtip.env + var: DATABASE_URL + extract: postgres_password +EOF + + run_collect "${tmp_dir}" "${tmp_dir}/mapping.yaml" + assert_contains "${tmp_dir}/.secrets-recovery/bitwarden-blocks.txt" "DATABASE_URL=postgresql://postgres:s3cr3t@postgres:5432/glitchtip" + assert_contains "${tmp_dir}/.secrets-recovery/bitwarden-blocks.txt" "# extracted password -> s3cr3t" +} + +test_config_group() { + local tmp_dir + tmp_dir="$(mktemp -d)" + trap 'rm -rf "${tmp_dir}"' RETURN + + make_fixture_tree "${tmp_dir}" + cat > "${tmp_dir}/.secrets-recovery/pulled/staging/etc__assrep__monitor.env" <<'EOF' +CPU_LIMIT=85 +RAM_LIMIT=90 +SEND_OK=0 +EOF + cat > "${tmp_dir}/mapping.yaml" <<'EOF' +- bw_item: ops/OPS_MONITORING_CONFIG + tag: config group + source: + type: env_file_group + server: staging + file: /etc/assrep/monitor.env + vars: + - CPU_LIMIT + - RAM_LIMIT + - SEND_OK +EOF + + run_collect "${tmp_dir}" "${tmp_dir}/mapping.yaml" + assert_contains "${tmp_dir}/.secrets-recovery/bitwarden-blocks.txt" "### ops/OPS_MONITORING_CONFIG [config group]" + assert_contains "${tmp_dir}/.secrets-recovery/bitwarden-blocks.txt" "CPU_LIMIT=85" + assert_contains "${tmp_dir}/.secrets-recovery/bitwarden-blocks.txt" "RAM_LIMIT=90" + assert_contains "${tmp_dir}/.secrets-recovery/bitwarden-blocks.txt" "SEND_OK=0" +} + +if [[ "${1:-}" == "" ]]; then + test_simple_var + test_extract_from_url + test_config_group + echo "All collect tests passed." + exit 0 +fi + +"$1" diff --git a/secrets/README.md b/secrets/README.md index 225dfba..63b57c8 100644 --- a/secrets/README.md +++ b/secrets/README.md @@ -93,6 +93,42 @@ Never commit `.secrets-recovery/`. Use `shred` or an encrypted disk workflow if your local security policy requires stronger deletion semantics. +## Manual recovery walkthrough + +1. Pull and format the locally recoverable values: + + ```bash + ./scripts/secrets-pull.sh + ./scripts/secrets-collect.sh + open .secrets-recovery/bitwarden-blocks.txt + ``` + +2. Transfer each block into Bitwarden manually: + + - Folder: `AssRep/` + - Item type: secure note + - Item name: the `### ...` header without the `[tag]` suffix + - Field `value:`: the block body under that header + +3. Manual-source checklist that still requires operator work: + + - Telegram bots via @BotFather `/token`: `DEV_BOT_TOKEN`, `DEV_NOTIFY_BOT_TOKEN`, `OPS_TG_TOKEN`, `AGENT_BOT_TOKEN` + - Verify chat ids if needed: `DEV_NOTIFY_CHAT_ID`, `OPS_TG_CHAT_ID`, `AGENT_BOT_CHAT_ID` + - GlitchTip UI -> Project -> Client Keys: `SENTRY_DSN_STAGING` for backend/mobile/web and `SENTRY_DSN_PRODUCTION` for mobile/web + - Per HANDOVER, create the missing GlitchTip projects first before recording the DSNs + - Regenerate manually: `DEV_GHCR_PAT`, `GHCR_PAT`, `AGENT_GHCR_TOKEN`, `EXPO_TOKEN`, `DOCKERHUB_TOKEN`, `AGENT_GITHUB_TOKEN` + - Rotate lost staging CI private keys: `DEV_SSH_KEY`, `OPS_SSH_KEY`, `SSH_KEY` + - The old staging CI private key fingerprint `SHA256:A0/C3q…` is considered lost; generate a new keypair, update `authorized_keys` on staging, remove the old key, then update the GitHub secrets + +4. `./scripts/secrets-to-bitwarden.sh` is not needed for entries already copied manually from `bitwarden-blocks.txt`. Keep it only if you still want to maintain `.secrets-recovery/consolidated.env` as a separate source of truth. + +5. Cleanup after finishing: + + ```bash + shred -u .secrets-recovery/bitwarden-blocks.txt + rm -rf .secrets-recovery + ``` + ## Provider Checklist Use provider/admin consoles for entries marked `recovery: provider`: diff --git a/secrets/collect-mapping.yaml b/secrets/collect-mapping.yaml new file mode 100644 index 0000000..664e439 --- /dev/null +++ b/secrets/collect-mapping.yaml @@ -0,0 +1,282 @@ +- bw_item: ops/AGENT_BOT_TOKEN + tag: secret + source: + type: env_file + server: ops + file: /etc/assrep/alert-bridge.env + var: AGENT_BOT_TOKEN + +- bw_item: ops/AGENT_BOT_CHAT_ID + tag: config + source: + type: env_file + server: ops + file: /etc/assrep/alert-bridge.env + var: AGENT_BOT_CHAT_ID + +- bw_item: ops/AGENT_GITHUB_TOKEN + tag: secret + source: + type: env_file + server: ops + file: /etc/assrep/alert-bridge.env + var: AGENT_GITHUB_TOKEN + +- bw_item: ops/ALERT_AGENT_CONTROL_TOKEN + tag: secret + source: + type: env_file + server: ops + file: /etc/assrep/alert-bridge.env + var: ALERT_AGENT_CONTROL_TOKEN + +- bw_item: ops/ALERT_AGENT_CONFIG + tag: config group + source: + type: env_file_group + server: ops + file: /etc/assrep/alert-bridge.env + vars: + - ALERT_AGENT_DB + - ALERT_AGENT_COMMANDS_DIR + - ALERT_AGENT_MODEL + - ALERT_AGENT_COOLDOWN_MINUTES + - ALERT_AGENT_DAILY_BUDGET + - ALERT_AGENT_MAX_SUMMARY_CHARS + - ALERT_AGENT_QUEUE_MAXSIZE + - ALERT_AGENT_ENABLE_BOT_POLLING + - ALERT_AGENT_APPROVAL_REQUIRED_FIXERS + +- bw_item: ops/GLITCHTIP_SECRET_KEY + tag: secret + source: + type: env_file + server: ops + file: /etc/assrep/glitchtip.env + var: SECRET_KEY + +- bw_item: ops/GLITCHTIP_DB_PASSWORD + tag: secret + source: + type: extract_from_url + server: ops + file: /etc/assrep/glitchtip.env + var: DATABASE_URL + extract: postgres_password + +- bw_item: ops/GLITCHTIP_EMAIL_URL + tag: secret + source: + type: env_file + server: ops + file: /etc/assrep/glitchtip.env + var: EMAIL_URL + +- bw_item: ops/GLITCHTIP_CONFIG + tag: config group + source: + type: env_file_group + server: ops + file: /etc/assrep/glitchtip.env + vars: + - PORT + - GLITCHTIP_DOMAIN + - DEFAULT_FROM_EMAIL + - CELERY_WORKER_AUTOSCALE + - CELERY_WORKER_MAX_TASKS_PER_CHILD + +- bw_item: ops/GLITCHTIP_TG_TOKEN + tag: secret + source: + type: env_file + server: ops + file: /etc/assrep/glitchtip-telegram.env + var: TG_TOKEN + +- bw_item: ops/GLITCHTIP_TG_CONFIG + tag: config group + source: + type: env_file_group + server: ops + file: /etc/assrep/glitchtip-telegram.env + vars: + - TG_CHAT_ID + - GLITCHTIP_DOMAIN + +- bw_item: ops/opencode-auth.json + tag: whole file + source: + type: whole_file + server: ops + file: /etc/assrep/opencode-auth.json + +- bw_item: ops/OPS_TG_TOKEN + tag: secret + source: + type: env_file + server: staging + file: /etc/assrep/monitor.env + var: TG_TOKEN + +- bw_item: ops/OPS_TG_CHAT_ID + tag: config + source: + type: env_file + server: staging + file: /etc/assrep/monitor.env + var: TG_CHAT_ID + +- bw_item: ops/OPS_MONITORING_CONFIG + tag: config group + source: + type: env_file_group + server: staging + file: /etc/assrep/monitor.env + vars: + - CPU_LIMIT + - RAM_LIMIT + - DISK_LIMIT + - SEND_OK + - ALERT_REMINDER_SEC + - OK_REMINDER_SEC + - MUTE_STATE_FILE + +- bw_item: ops/OPS_BOT_TOKEN + tag: secret + source: + type: env_file + server: staging + file: /etc/assrep/ops-bot.env + var: OPS_BOT_TOKEN + +- bw_item: ops/OPS_RUNTIME_CONFIG + tag: config group + source: + type: env_file_group + server: staging + file: /etc/assrep/ops-bot.env + vars: + - OPS_ALLOWED_CHATS + - OPS_COMPOSE_PROJECT + - OPS_SERVICES + - OPS_API_HEALTH_URL + - OPS_HOST_LABEL + - OPS_HOST_ROOT + - OPS_MUTE_STATE_FILE + +- bw_item: ops/OPS_VDS_SSH_KEY + tag: whole file + source: + type: local_file + path: ~/.ssh/id_ed25519 + +- bw_item: ops/_CONNECTION_INFO + tag: config + source: + type: literal_lines + lines: + - DEV_SSH_HOST=109.73.192.184 + - DEV_SSH_USER=root + - DEV_SSH_PORT=22 + - OPS_VDS_SSH_HOST=5.129.198.133 + - OPS_VDS_SSH_USER=root + - OPS_VDS_SSH_PORT=22 + +- bw_item: core/DEV_DATABASE_URL + tag: secret + optional: true + source: + type: env_file + server: staging + file: /opt/assrep/core/deploy/staging/.env + var: DATABASE_URL + +- bw_item: core/DEV_S3_ACCESS_KEY_ID + tag: secret + optional: true + source: + type: env_file + server: staging + file: /opt/assrep/core/deploy/staging/backend.env + var: S3_ACCESS_KEY_ID + +- bw_item: core/DEV_S3_SECRET_ACCESS_KEY + tag: secret + optional: true + source: + type: env_file + server: staging + file: /opt/assrep/core/deploy/staging/backend.env + var: S3_SECRET_ACCESS_KEY + +- bw_item: core/JWT_SECRET + tag: secret + optional: true + source: + type: env_file + server: staging + file: /opt/assrep/core/deploy/staging/backend.env + var: JWT_SECRET + +- bw_item: core/SENTRY_DSN_STAGING + tag: secret + optional: true + source: + type: env_file + server: staging + file: /opt/assrep/core/deploy/staging/backend.env + var: SENTRY_DSN + +- bw_item: telegram-frontend/DEV_BOT_TOKEN + tag: secret + optional: true + source: + type: env_file + server: staging + file: /opt/assrep/core/deploy/staging/bot.env + var: BOT_TOKEN + +- bw_item: telegram-frontend/INTERNAL_TOKEN + tag: secret + optional: true + source: + type: env_file + server: staging + file: /opt/assrep/core/deploy/staging/bot.env + var: INTERNAL_TOKEN + +- bw_item: ops/GRAFANA_ADMIN_PASSWORD + tag: secret + optional: true + source: + type: env_file + server: ops + file: /__generated/docker-inspect-grafana.env + var: GF_SECURITY_ADMIN_PASSWORD + +- bw_item: ops/BACKUP_S3_KEY_ID + tag: secret + optional: true + source: + type: env_file + server: staging + file: /usr/local/bin/db-backup.sh + var: AWS_ACCESS_KEY_ID + +- bw_item: ops/BACKUP_S3_SECRET + tag: secret + optional: true + source: + type: env_file + server: staging + file: /usr/local/bin/db-backup.sh + var: AWS_SECRET_ACCESS_KEY + +- bw_item: ops/DB_PASSWORD + tag: secret + optional: true + source: + type: env_file + server: staging + file: /usr/local/bin/db-backup.sh + var: PGPASSWORD