diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c2e272 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ + +# nested repos — independent, not tracked by this umbrella +/hiveiq-openmetal/hiveiq-openmetal-prod/ +/hiveiq-openmetal/hiveiq-openmetal-dev/ +/hiveiq-devops/ +/hiveiq-docs/ diff --git a/hiveiq-openmetal b/hiveiq-openmetal deleted file mode 160000 index a62c9b7..0000000 --- a/hiveiq-openmetal +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a62c9b712da9fdaf8351c70e3aa0a5955d32bdb8 diff --git a/hiveiq-openmetal/ENVIRONMENTS.md b/hiveiq-openmetal/ENVIRONMENTS.md new file mode 100644 index 0000000..1b7b9fc --- /dev/null +++ b/hiveiq-openmetal/ENVIRONMENTS.md @@ -0,0 +1,31 @@ +# HiveOps Deployment Environments + +**Two repos, one per environment — no duplication.** Production config lives only in the prod +repo; dev config lives only in the dev repo. + +| Env | Repo (cloned as) | Config path | Live URL | VM | +|-----|------------------|-------------|----------|----| +| **PRODUCTION** | `hiveiq-openmetal-prod` (`hiveiq-openmetal/`) | `hiveops/instances/services/` | bcos.cloud | 173.231.195.250 | +| **DEV / staging** | `hiveiq-openmetal-dev/` | `hiveops/instances/dev/` | bcos.dev | 173.231.195.251 | + +Production also keeps its other instances in the **prod** repo: `database`, `browser`, `ollama`, +`logging`, and the `bcos-*` services (mail, office, share, proxy, gitea, odoo). **Dev is all-in-one** +— one VM bundles postgres/kafka/registry/etc that prod splits across VMs. + +## Compare dev vs prod +The two repos are **structurally parallel** (`compose/.yml`, `nginx/conf.d/.conf`): + +```bash +./compare-prod-dev.sh # drift summary — which configs differ or are env-only +./compare-prod-dev.sh incident # full diff of a specific service +# or diff directly: +diff hiveiq-openmetal-dev/hiveops/instances/dev/nginx/conf.d/api.conf \ + hiveiq-openmetal/hiveops/instances/services/nginx/conf.d/api.conf +``` + +(For this to work, clone **both** repos side by side under this directory.) + +## Source of truth +The live VMs are **hand-managed** (not git-fed). These repos are the **reference/backup** — keep +them in sync with the VMs whenever you change deployment config. `.env` **secrets are gitignored**: +they live only on the VMs and in **Vaultwarden** (`pw.bcos.cloud`). diff --git a/hiveiq-openmetal/compare-prod-dev.sh b/hiveiq-openmetal/compare-prod-dev.sh new file mode 100755 index 0000000..9af7382 --- /dev/null +++ b/hiveiq-openmetal/compare-prod-dev.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# Compare bcos.dev (DEV) vs bcos.cloud (PROD) deployment config, side by side. +# +# ./compare-prod-dev.sh # DRIFT SUMMARY: which configs differ / are env-only +# ./compare-prod-dev.sh incident # FULL DIFF of every config matching "incident" +# ./compare-prod-dev.sh api # FULL DIFF of the nginx api.conf, etc. +# +# PROD = hiveiq-openmetal/hiveops/instances/services (bcos.cloud, 173.231.195.250) +# DEV = hiveiq-openmetal-dev/hiveops/instances/dev (bcos.dev, 173.231.195.251) +# +# Both repos are structurally parallel: compose/.yml + nginx/conf.d/.conf. +set -uo pipefail +HERE=$(cd "$(dirname "$0")" && pwd) +PROD="$HERE/hiveiq-openmetal-prod/hiveops/instances/services" +DEV="$HERE/hiveiq-openmetal-dev/hiveops/instances/dev" +[ -d "$PROD" ] || { echo "PROD config not found: $PROD"; exit 1; } +[ -d "$DEV" ] || { echo "DEV config not found: $DEV (clone hiveiq-openmetal-dev next to hiveiq-openmetal)"; exit 1; } + +FILTER="${1:-}" + +scan() { # $1 = subdir ; $2 = glob + local sub="$1" glob="$2" df pf n + echo "## $sub" + for df in "$DEV/$sub"/$glob; do + [ -e "$df" ] || continue; n=$(basename "$df") + pf="$PROD/$sub/$n" + if [ ! -e "$pf" ]; then echo " [dev-only] $n" + elif ! diff -q "$pf" "$df" >/dev/null 2>&1; then echo " [DIFFERS] $n"; fi + done + for pf in "$PROD/$sub"/$glob; do + [ -e "$pf" ] || continue; n=$(basename "$pf") + [ -e "$DEV/$sub/$n" ] || echo " [prod-only] $n" + done +} + +if [ -n "$FILTER" ]; then + echo "=== FULL DIFF (prod → dev) for *$FILTER* ===" + for sub in compose nginx/conf.d; do + for df in "$DEV/$sub/"*"$FILTER"*; do + [ -e "$df" ] || continue; n=$(basename "$df"); pf="$PROD/$sub/$n" + echo "--- $sub/$n ---" + if [ -e "$pf" ]; then diff -u "$pf" "$df" || true; else echo " (dev-only — no prod counterpart)"; fi + done + done +else + echo "=== DRIFT SUMMARY: bcos.dev (DEV) vs bcos.cloud (PROD) ===" + scan compose '*.yml' + scan nginx/conf.d '*.conf' + echo "" + echo "→ './compare-prod-dev.sh ' for the full diff of one config (e.g. incident, api, auth)." +fi