unoverse 0.1.131 → 0.1.132
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 +23 -12
- package/package.json +1 -1
package/operator/lib/deploy.sh
CHANGED
|
@@ -41,8 +41,12 @@
|
|
|
41
41
|
# exists because the opposite mistake is what wiped this exact cluster's firewall once
|
|
42
42
|
# already: an authoritative write that assumed the whole list was ours to own.
|
|
43
43
|
_operator_db_access() {
|
|
44
|
-
|
|
45
|
-
cluster
|
|
44
|
+
# `$2` is the cluster, when the CALLER already knows it. The monorepo has no ground to
|
|
45
|
+
# read one from — it develops against a cluster named only in .env — so re-deriving it
|
|
46
|
+
# from terraform.tfvars here meant this returned 0 and did nothing in the one place the
|
|
47
|
+
# developer actually types `npm run dev`.
|
|
48
|
+
local cloud="$1" dir="$ROOT/infra/$cloud" cluster="${2:-}"
|
|
49
|
+
[ -n "$cluster" ] || cluster=$(grep -E '^existing_pg_cluster_name[[:space:]]*=' "$dir/terraform.tfvars" 2>/dev/null | sed -E 's/.*"([^"]+)".*/\1/')
|
|
46
50
|
[ -n "$cluster" ] || return 0
|
|
47
51
|
[ -n "${DIGITALOCEAN_TOKEN:-}" ] || return 0
|
|
48
52
|
mkdir -p "$ROOT/.unoverse"
|
|
@@ -108,16 +112,21 @@ cmd_db_allow() {
|
|
|
108
112
|
# reachability is a VPC security group, owned by Terraform and changed by `deploy`, not by
|
|
109
113
|
# a developer's laptop asking an API at runtime. Offering `db-allow aws` produced a
|
|
110
114
|
# ground-picker prompt for a cloud that would then have done nothing.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
# A GROUND IS OPTIONAL HERE. This used to `return 1` the moment the picker found none,
|
|
116
|
+
# which made the .env fallback below unreachable in the monorepo — the one checkout that
|
|
117
|
+
# has no ground and the one the fallback was written for. Only ask the picker when there
|
|
118
|
+
# is something to pick, so an ambiguous two-ground universe still stops, while a
|
|
119
|
+
# groundless checkout proceeds to look the cluster up where it actually knows it.
|
|
120
|
+
cloud=""
|
|
121
|
+
if ls "$ROOT"/infra/*/terraform.tfvars >/dev/null 2>&1; then
|
|
122
|
+
SELF_CMD="unoverse db-allow" \
|
|
123
|
+
GROUNDS_ONLY="digitalocean" \
|
|
124
|
+
GROUNDS_ONLY_WHY="On AWS the database is reached through its VPC security group, which the ground owns — change it in infra/aws and run ${BOLD}unoverse deploy aws${NC}." \
|
|
125
|
+
cloud=$(_pick_ground "${1:-}") || return 1
|
|
126
|
+
fi
|
|
118
127
|
|
|
119
|
-
local cluster
|
|
120
|
-
cluster=$(grep -E '^existing_pg_cluster_name[[:space:]]*=' "$ROOT/infra/$cloud/terraform.tfvars" 2>/dev/null | sed -E 's/.*"([^"]+)".*/\1/')
|
|
128
|
+
local cluster=""
|
|
129
|
+
[ -n "$cloud" ] && cluster=$(grep -E '^existing_pg_cluster_name[[:space:]]*=' "$ROOT/infra/$cloud/terraform.tfvars" 2>/dev/null | sed -E 's/.*"([^"]+)".*/\1/')
|
|
121
130
|
|
|
122
131
|
# THE MONOREPO NEEDS THIS TOO, and it has no ground. The platform's own checkout is
|
|
123
132
|
# developed against a managed cluster named only in .env, so a ground-only lookup found
|
|
@@ -147,7 +156,9 @@ cmd_db_allow() {
|
|
|
147
156
|
fi
|
|
148
157
|
|
|
149
158
|
echo ""
|
|
150
|
-
|
|
159
|
+
# Hand the cluster over: we already resolved it, from a ground OR from .env, and the
|
|
160
|
+
# helper cannot re-derive the .env case (there is no tfvars to read).
|
|
161
|
+
_operator_db_access "$cloud" "$cluster"
|
|
151
162
|
echo ""
|
|
152
163
|
info "Run this again whenever you change network"
|
|
153
164
|
echo ""
|
package/package.json
CHANGED