unoverse 0.1.74 → 0.1.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/operator/lib/deploy.sh +20 -0
- package/package.json +1 -1
package/operator/lib/deploy.sh
CHANGED
|
@@ -114,6 +114,26 @@ _ensure_ground_config() {
|
|
|
114
114
|
cur_size=$(grep -E '^size[[:space:]]*=' "$tfv" 2>/dev/null | sed -E 's/.*"([^"]+)".*/\1/')
|
|
115
115
|
[ -n "$cur_size" ] && info "Size: ${BOLD}${cur_size}${NC} ${DIM}(small · medium · large — change it in terraform.tfvars and deploy again whenever you outgrow it)${NC}"
|
|
116
116
|
|
|
117
|
+
# REGION MUST MATCH, or the platform cannot reach its own database. DigitalOcean's
|
|
118
|
+
# private networking is per-region: the connection string uses the cluster's PRIVATE
|
|
119
|
+
# host, which a droplet in another region cannot resolve. Everything provisions
|
|
120
|
+
# perfectly and then the platform fails to start, which is the worst way to find out.
|
|
121
|
+
local reuse_name ground_region db_region
|
|
122
|
+
reuse_name=$(grep -E '^existing_pg_cluster_name[[:space:]]*=' "$tfv" 2>/dev/null | sed -E 's/.*"([^"]+)".*/\1/')
|
|
123
|
+
ground_region=$(grep -E '^region[[:space:]]*=' "$tfv" 2>/dev/null | sed -E 's/.*"([^"]+)".*/\1/')
|
|
124
|
+
if [ -n "$reuse_name" ] && [ -n "$ground_region" ] && command -v doctl >/dev/null 2>&1; then
|
|
125
|
+
db_region=$(doctl databases list --format Name,Region --no-header 2>/dev/null | awk -v n="$reuse_name" '$1==n{print $2}')
|
|
126
|
+
if [ -n "$db_region" ] && [ "$db_region" != "$ground_region" ]; then
|
|
127
|
+
echo ""
|
|
128
|
+
fail "Region mismatch: this universe is in ${BOLD}$ground_region${NC}, ${BOLD}$reuse_name${NC} is in ${BOLD}$db_region${NC}"
|
|
129
|
+
info "Private networking does not cross regions, so the platform could not reach it."
|
|
130
|
+
info "Either set ${BOLD}region = \"$db_region\"${NC} in infra/$cloud/terraform.tfvars,"
|
|
131
|
+
info "or comment out existing_pg_cluster_name to create a database in $ground_region."
|
|
132
|
+
echo ""
|
|
133
|
+
return 1
|
|
134
|
+
fi
|
|
135
|
+
fi
|
|
136
|
+
|
|
117
137
|
# THE DATABASE DECISION, STATED EVERY RUN. It is asked once and then recorded in
|
|
118
138
|
# terraform.tfvars, so later deploys correctly do not re-ask — but silence reads
|
|
119
139
|
# exactly like never having been asked. Say what is in force, the same way Size does.
|
package/package.json
CHANGED