unoverse 0.1.55 → 0.1.56
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 +60 -8
- package/package.json +1 -1
package/operator/lib/deploy.sh
CHANGED
|
@@ -43,17 +43,69 @@ cmd_deploy() {
|
|
|
43
43
|
}
|
|
44
44
|
echo ""
|
|
45
45
|
ok "Your $cloud ground is prefilled ${DIM}(infra/$cloud/terraform.tfvars)${NC}"
|
|
46
|
+
|
|
47
|
+
# FILL THE BLANKS OURSELVES. Every FILL_ME the universe already knows (.env from
|
|
48
|
+
# setup) is copied in silently; only genuine unknowns are asked. Hand-copying
|
|
49
|
+
# values between our own files is not a step a developer should ever see.
|
|
50
|
+
local tfv="$ROOT/infra/$cloud/terraform.tfvars"
|
|
51
|
+
_tf_put() { # key value — safe replacement via node (values may hold sed specials)
|
|
52
|
+
node -e 'const fs=require("fs");const[f,k,v]=process.argv.slice(1);let s=fs.readFileSync(f,"utf8");s=s.replace(new RegExp("^"+k+"(\\s*)=\\s*\"FILL_ME\"","m"),k+"$1= "+JSON.stringify(v));fs.writeFileSync(f,s)' "$tfv" "$1" "$2"
|
|
53
|
+
}
|
|
54
|
+
_tf_fill() { # key envname prompt
|
|
55
|
+
local key="$1" envname="$2" prompt="$3" val
|
|
56
|
+
grep -q "^${key}[[:space:]]*=[[:space:]]*\"FILL_ME\"" "$tfv" 2>/dev/null || return 0
|
|
57
|
+
val=$(grep "^${envname}=" "$ROOT/.env" 2>/dev/null | head -1 | cut -d= -f2-)
|
|
58
|
+
if [ -n "$val" ]; then
|
|
59
|
+
_tf_put "$key" "$val"
|
|
60
|
+
ok "$key ${DIM}from your .env${NC}"
|
|
61
|
+
else
|
|
62
|
+
read -r -p " $prompt: " val
|
|
63
|
+
[ -n "$val" ] && _tf_put "$key" "$val"
|
|
64
|
+
fi
|
|
65
|
+
}
|
|
66
|
+
echo ""
|
|
67
|
+
_tf_fill docr_token DOCR_TOKEN "Registry access token (from your Unoverse admin)"
|
|
68
|
+
_tf_fill openai_api_key OPENAI_API_KEY "OPENAI_API_KEY (powers the platform's AI)"
|
|
69
|
+
if grep -q '^auth_issuer[[:space:]]*=[[:space:]]*"FILL_ME"' "$tfv" 2>/dev/null; then
|
|
70
|
+
local env_auth
|
|
71
|
+
env_auth=$(grep "^AUTH_ISSUER=" "$ROOT/.env" 2>/dev/null | cut -d= -f2-)
|
|
72
|
+
if [ -z "$env_auth" ]; then
|
|
73
|
+
echo ""
|
|
74
|
+
info "A deployed universe requires a login. Local auth-off does not deploy"
|
|
75
|
+
info "${DIM}(Auth0 or any OIDC provider; the issuer looks like https://your-tenant.auth0.com)${NC}"
|
|
76
|
+
fi
|
|
77
|
+
fi
|
|
78
|
+
_tf_fill auth_issuer AUTH_ISSUER "AUTH_ISSUER"
|
|
79
|
+
_tf_fill auth_client_id AUTH_CLIENT_ID "AUTH_CLIENT_ID"
|
|
80
|
+
|
|
81
|
+
if grep -q "FILL_ME" "$tfv" 2>/dev/null; then
|
|
82
|
+
echo ""
|
|
83
|
+
warn "Some values are still blank in ${BOLD}infra/$cloud/terraform.tfvars${NC} — fill them, then:"
|
|
84
|
+
info " cd infra/$cloud && terraform init && terraform apply"
|
|
85
|
+
info " cd ../.. && unoverse deploy"
|
|
86
|
+
echo ""
|
|
87
|
+
exit 1
|
|
88
|
+
fi
|
|
89
|
+
ok "terraform.tfvars is complete"
|
|
90
|
+
|
|
91
|
+
# PROVISION FROM RIGHT HERE, if wanted. terraform apply prints its plan and asks
|
|
92
|
+
# for its own explicit yes — creating billable infrastructure stays a deliberate,
|
|
93
|
+
# visible act, it just no longer requires leaving the flow.
|
|
46
94
|
echo ""
|
|
47
|
-
local
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
95
|
+
local REPLY
|
|
96
|
+
read -r -p " Provision now? terraform runs here and shows its plan first. [Y/n] " REPLY
|
|
97
|
+
if [[ "$REPLY" =~ ^[Nn]$ ]]; then
|
|
98
|
+
info "When ready: cd infra/$cloud && terraform init && terraform apply && cd ../.. && unoverse deploy"
|
|
99
|
+
exit 0
|
|
51
100
|
fi
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
101
|
+
command -v terraform >/dev/null 2>&1 || { fail "terraform is not installed"; info " brew install terraform"; exit 1; }
|
|
102
|
+
terraform -chdir="$ROOT/infra/$cloud" init -input=false >/dev/null 2>&1 || { fail "terraform init failed"; exit 1; }
|
|
103
|
+
terraform -chdir="$ROOT/infra/$cloud" apply || { fail "apply did not complete. Re-run: unoverse deploy"; exit 1; }
|
|
104
|
+
echo ""
|
|
105
|
+
ok "Infrastructure is up. Shipping the platform onto it..."
|
|
55
106
|
echo ""
|
|
56
|
-
|
|
107
|
+
cmd_deploy init
|
|
108
|
+
return $?
|
|
57
109
|
fi
|
|
58
110
|
|
|
59
111
|
# Read deploy target from .env.production
|
package/package.json
CHANGED