unoverse 0.1.19 → 0.1.21
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/init.sh +59 -23
- package/operator/lib/update.sh +28 -1
- package/package.json +1 -1
package/operator/lib/init.sh
CHANGED
|
@@ -103,7 +103,7 @@ cmd_init() {
|
|
|
103
103
|
ok "Registry token carried over from create"
|
|
104
104
|
else
|
|
105
105
|
while true; do
|
|
106
|
-
read -p " DOCR Token (from your Unoverse admin): " DOCR_TOKEN
|
|
106
|
+
read -p " DOCR Token (from your Unoverse admin): " DOCR_TOKEN || { fail "no input (end of stream). Run unoverse init interactively"; exit 1; }
|
|
107
107
|
if [[ "$DOCR_TOKEN" == dop_v1_* ]]; then
|
|
108
108
|
break
|
|
109
109
|
fi
|
|
@@ -111,9 +111,13 @@ cmd_init() {
|
|
|
111
111
|
done
|
|
112
112
|
fi
|
|
113
113
|
|
|
114
|
-
#
|
|
114
|
+
# A DEFAULT, because "from your admin" is meaningless when you are the admin. The
|
|
115
|
+
# platform ships no database (docker-compose has no postgres), so this points at one
|
|
116
|
+
# you run. Enter takes the conventional local one.
|
|
117
|
+
DB_DEFAULT="postgres://postgres:postgres@localhost:5432/universe"
|
|
115
118
|
while true; do
|
|
116
|
-
read -p " DATABASE_URL (
|
|
119
|
+
read -p " DATABASE_URL [${DB_DEFAULT}]: " DATABASE_URL || { fail "no input (end of stream). Run unoverse init interactively"; exit 1; }
|
|
120
|
+
DATABASE_URL="${DATABASE_URL:-$DB_DEFAULT}"
|
|
117
121
|
if [ -n "$DATABASE_URL" ] && [[ "$DATABASE_URL" != *"user:password"* ]]; then
|
|
118
122
|
break
|
|
119
123
|
fi
|
|
@@ -148,28 +152,59 @@ cmd_init() {
|
|
|
148
152
|
REDIS_TLS="${REDIS_TLS:-false}"
|
|
149
153
|
|
|
150
154
|
# Auth (required — from admin)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
# ASK BEFORE DEMANDING. A developer trying the platform locally has no identity
|
|
156
|
+
# provider yet, and AUTH_ISSUER was required, so init could not be completed at all.
|
|
157
|
+
#
|
|
158
|
+
# This is a LOCAL switch only. INFRASTRUCTURE.md is explicit that auth is always on for
|
|
159
|
+
# a deployed universe ("there is no auth-off deployment"), and the platform enforces it
|
|
160
|
+
# rather than trusting this wizard: authConfig.ts refuses to start with auth off when
|
|
161
|
+
# NODE_ENV=production. So answering "no" here cannot produce an unprotected deployment.
|
|
162
|
+
echo ""
|
|
163
|
+
read -r -p " Do you have an identity provider (Auth0/OIDC) to connect? [y/N] " HAS_IDP
|
|
164
|
+
echo ""
|
|
158
165
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
if [[ "$HAS_IDP" =~ ^[Yy]$ ]]; then
|
|
167
|
+
AUTH_ENABLED=true
|
|
168
|
+
while true; do
|
|
169
|
+
read -p " AUTH_ISSUER (e.g. https://your-tenant.auth0.com): " AUTH_ISSUER || { fail "no input (end of stream). Run unoverse init interactively"; exit 1; }
|
|
170
|
+
if [ -n "$AUTH_ISSUER" ] && [[ "$AUTH_ISSUER" == https://* ]]; then
|
|
171
|
+
break
|
|
172
|
+
fi
|
|
173
|
+
fail "AUTH_ISSUER must be an https:// URL from your identity provider"
|
|
174
|
+
done
|
|
175
|
+
|
|
176
|
+
while true; do
|
|
177
|
+
read -p " AUTH_CLIENT_ID: " AUTH_CLIENT_ID || { fail "no input (end of stream). Run unoverse init interactively"; exit 1; }
|
|
178
|
+
if [ -n "$AUTH_CLIENT_ID" ] && [[ "$AUTH_CLIENT_ID" != *"your-"* ]]; then
|
|
179
|
+
break
|
|
180
|
+
fi
|
|
181
|
+
fail "AUTH_CLIENT_ID is required"
|
|
182
|
+
done
|
|
183
|
+
|
|
184
|
+
read -p " AUTH_AUDIENCE [gravity-api]: " AUTH_AUDIENCE
|
|
185
|
+
AUTH_AUDIENCE="${AUTH_AUDIENCE:-gravity-api}"
|
|
186
|
+
else
|
|
187
|
+
AUTH_ENABLED=false
|
|
188
|
+
AUTH_ISSUER=""
|
|
189
|
+
AUTH_CLIENT_ID=""
|
|
190
|
+
AUTH_AUDIENCE="gravity-api"
|
|
191
|
+
warn "Auth is OFF for local development"
|
|
192
|
+
info "Deploying needs it: ${BOLD}unoverse deploy${NC} runs with auth on, and the server refuses to start without it in production"
|
|
193
|
+
fi
|
|
166
194
|
|
|
167
|
-
|
|
168
|
-
|
|
195
|
+
# NOT ASKED. 4105 is the port docker-compose publishes, so locally this is a fact the
|
|
196
|
+
# CLI already knows, and confirming it is not a question. A DEPLOYED universe gets its
|
|
197
|
+
# own API_URL rendered into .env.production by Terraform, which never comes through here.
|
|
198
|
+
API_URL="http://localhost:4105"
|
|
169
199
|
|
|
170
|
-
#
|
|
171
|
-
|
|
172
|
-
|
|
200
|
+
# DERIVED FROM THE FOLDER, not hardcoded. Every key the memory server writes is
|
|
201
|
+
# prefixed with this, so two universes sharing one Redis and the same namespace mix
|
|
202
|
+
# their streams and caches. It used to be written as a literal `gravity` for every
|
|
203
|
+
# local universe, while Terraform rendered `universe` for deployed ones: same Redis,
|
|
204
|
+
# same prefix, silently interleaved.
|
|
205
|
+
REDIS_NAMESPACE=$(basename "$ROOT" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9-' '-' | sed 's/-*$//')
|
|
206
|
+
REDIS_NAMESPACE="${REDIS_NAMESPACE:-universe}"
|
|
207
|
+
ok "Redis namespace: ${BOLD}${REDIS_NAMESPACE}${NC}"
|
|
173
208
|
|
|
174
209
|
# OpenAI (for Memory Server)
|
|
175
210
|
read -p " OPENAI_API_KEY (for Memory Server, blank to skip): " OPENAI_API_KEY
|
|
@@ -183,7 +218,8 @@ REDIS_HOST=${REDIS_HOST}
|
|
|
183
218
|
REDIS_PORT=${REDIS_PORT}
|
|
184
219
|
REDIS_PASSWORD=${REDIS_PASSWORD}
|
|
185
220
|
REDIS_TLS=${REDIS_TLS}
|
|
186
|
-
REDIS_NAMESPACE
|
|
221
|
+
REDIS_NAMESPACE=${REDIS_NAMESPACE}
|
|
222
|
+
AUTH_ENABLED=${AUTH_ENABLED}
|
|
187
223
|
AUTH_ISSUER=${AUTH_ISSUER}
|
|
188
224
|
AUTH_CLIENT_ID=${AUTH_CLIENT_ID}
|
|
189
225
|
AUTH_AUDIENCE=${AUTH_AUDIENCE}
|
package/operator/lib/update.sh
CHANGED
|
@@ -7,6 +7,21 @@ cmd_update() {
|
|
|
7
7
|
echo ""
|
|
8
8
|
timer_start
|
|
9
9
|
|
|
10
|
+
# ── Refuse before doing half the job ───────────────────────────────────────────
|
|
11
|
+
# This used to run against an unconfigured folder with Docker down: compose warned
|
|
12
|
+
# about thirty blank variables, then failed on the daemon, after reporting that the
|
|
13
|
+
# code had updated. Ask first.
|
|
14
|
+
if [ ! -f "$ROOT/.env" ]; then
|
|
15
|
+
fail "This universe is not configured yet"
|
|
16
|
+
info "Run ${BOLD}unoverse init${NC} first"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
if ! docker info >/dev/null 2>&1; then
|
|
20
|
+
fail "Docker is not running. Update pulls images, so it needs the daemon"
|
|
21
|
+
info "Start Docker Desktop, then run ${BOLD}unoverse update${NC} again"
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
|
|
10
25
|
# ── Developer work is SAFE, by design ──────────────────────────────────────────
|
|
11
26
|
# `update` refreshes the PLATFORM (its own tracked files) and NEVER touches a developer's
|
|
12
27
|
# own work. Custom nodes live as UNTRACKED files (apps/unoverse/nodes/<yours>) — `git reset
|
|
@@ -27,7 +42,18 @@ cmd_update() {
|
|
|
27
42
|
exit 1
|
|
28
43
|
fi
|
|
29
44
|
|
|
30
|
-
# Step 1: Code — pull from customer's fork
|
|
45
|
+
# Step 1: Code — pull from customer's fork.
|
|
46
|
+
#
|
|
47
|
+
# NOT EVERY UNIVERSE IS A GIT CLONE. `unoverse create` extracts a tarball, so there is
|
|
48
|
+
# no remote to pull from and never was. That is not a failure: the images carry the
|
|
49
|
+
# platform, and the files here are yours. Skip the step and say which mode you are in,
|
|
50
|
+
# rather than running git commands that all fail and then reporting "Code updated".
|
|
51
|
+
if ! git -C "$ROOT" rev-parse --git-dir >/dev/null 2>&1; then
|
|
52
|
+
info "Not a git checkout, so there is no code to pull. Updating images only"
|
|
53
|
+
UNOVERSE_SKIP_GIT=1
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
if [ "${UNOVERSE_SKIP_GIT:-}" != "1" ]; then
|
|
31
57
|
printf " ${DIM}●${NC} Pulling latest code..."
|
|
32
58
|
local git_ok=true
|
|
33
59
|
local git_log
|
|
@@ -89,6 +115,7 @@ cmd_update() {
|
|
|
89
115
|
exit 1
|
|
90
116
|
fi
|
|
91
117
|
fi
|
|
118
|
+
fi # UNOVERSE_SKIP_GIT
|
|
92
119
|
|
|
93
120
|
# Step 2: Images — login to registry if DOCR_TOKEN is set
|
|
94
121
|
local docr_token
|
package/package.json
CHANGED