unoverse 0.1.129 → 0.1.131
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/docker-compose.yml +11 -1
- package/operator/lib/deploy.sh +31 -4
- package/package.json +1 -1
|
@@ -111,7 +111,17 @@ services:
|
|
|
111
111
|
# SAME :4105 backend as api.<domain>, so default to the api host (one public entry,
|
|
112
112
|
# one cert, no extra DNS). UNOVERSE_URL can still override for a dedicated MCP host.
|
|
113
113
|
- VITE_UNOVERSE_SERVICE_URL=${UNOVERSE_URL:-${DOMAIN:+https://api.${DOMAIN:-}}}
|
|
114
|
-
|
|
114
|
+
# THE BROWSER'S MEMORY UPSTREAM, AND IT IS THE PUBLIC JWT LANE (:4104). Its own
|
|
115
|
+
# variable, because `MEMORY_SERVICE_URL` means the opposite thing to a server-to-
|
|
116
|
+
# server caller: the engine uses that name for the TOKENLESS platform lane (:4114),
|
|
117
|
+
# and the canvas entrypoint was reading the same name for its nginx upstream. The
|
|
118
|
+
# dashboard therefore proxied the browser at :4114, whose /api/* routes do not
|
|
119
|
+
# exist — every memory page call 404'd on every deployed universe.
|
|
120
|
+
#
|
|
121
|
+
# The 404 was the lucky part. The platform lane asserts identity instead of proving
|
|
122
|
+
# it, so a browser reaching it would read and write ANY user's memory with no token.
|
|
123
|
+
# A browser must only ever reach :4104, which authenticates every request.
|
|
124
|
+
- MEMORY_PUBLIC_URL=http://memory:4104
|
|
115
125
|
depends_on:
|
|
116
126
|
- unoverse
|
|
117
127
|
logging: *default-logging
|
package/operator/lib/deploy.sh
CHANGED
|
@@ -103,7 +103,15 @@ NODE
|
|
|
103
103
|
# database.
|
|
104
104
|
cmd_db_allow() {
|
|
105
105
|
local cloud
|
|
106
|
-
|
|
106
|
+
# DIGITALOCEAN ONLY, and it is not an oversight. This joins a MANAGED DATABASE's
|
|
107
|
+
# trusted-source list through the DO API, and AWS has no equivalent to join: RDS
|
|
108
|
+
# reachability is a VPC security group, owned by Terraform and changed by `deploy`, not by
|
|
109
|
+
# a developer's laptop asking an API at runtime. Offering `db-allow aws` produced a
|
|
110
|
+
# ground-picker prompt for a cloud that would then have done nothing.
|
|
111
|
+
SELF_CMD="unoverse db-allow" \
|
|
112
|
+
GROUNDS_ONLY="digitalocean" \
|
|
113
|
+
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}." \
|
|
114
|
+
cloud=$(_pick_ground "${1:-}") || {
|
|
107
115
|
[ -z "${1:-}" ] && [ ! -d "$ROOT/infra" ] && fail "No ground here. There is no database to reach"
|
|
108
116
|
return 1
|
|
109
117
|
}
|
|
@@ -117,8 +125,13 @@ cmd_db_allow() {
|
|
|
117
125
|
# this could not help. A cluster host is `<name>-do-user-...`, so the name is right there
|
|
118
126
|
# in DATABASE_URL.
|
|
119
127
|
if [ -z "$cluster" ]; then
|
|
128
|
+
# `-n` + `p`: print ONLY when the substitution matched. The portable way to say "extract
|
|
129
|
+
# or nothing". This was `s|…|\1|; t; d`, which is GNU: BSD sed reads everything after `t`
|
|
130
|
+
# as a LABEL, so on macOS it died with `undefined label '; d'`, printed nothing, and the
|
|
131
|
+
# command then reported "this database has no trusted-source list" — a real cluster
|
|
132
|
+
# reported as an open one, on the platform's own machine.
|
|
120
133
|
cluster=$(grep -E '^DATABASE_URL=' "$ROOT/.env" 2>/dev/null | head -1 \
|
|
121
|
-
| sed -
|
|
134
|
+
| sed -nE 's|.*@([a-z0-9-]+)-do-user-[^.]*\..*|\1|p')
|
|
122
135
|
fi
|
|
123
136
|
|
|
124
137
|
if [ -z "$cluster" ]; then
|
|
@@ -205,11 +218,23 @@ _pick_ground() {
|
|
|
205
218
|
*) fail "Unknown ground '$want'. Use ${BOLD}digitalocean${NC} or ${BOLD}aws${NC}" >&2; return 1 ;;
|
|
206
219
|
esac
|
|
207
220
|
|
|
221
|
+
# A command may not apply to every cloud. `GROUNDS_ONLY` names the ones it does, so a
|
|
222
|
+
# ground that cannot answer is never offered as a choice and never named in the
|
|
223
|
+
# "say which" prompt. Unset means all of them, which is every other caller.
|
|
208
224
|
local configured=()
|
|
209
225
|
for g in digitalocean aws; do
|
|
210
|
-
[ -f "$ROOT/infra/$g/terraform.tfvars" ]
|
|
226
|
+
[ -f "$ROOT/infra/$g/terraform.tfvars" ] || continue
|
|
227
|
+
if [ -n "${GROUNDS_ONLY:-}" ] && [[ " ${GROUNDS_ONLY} " != *" $g "* ]]; then continue; fi
|
|
228
|
+
configured+=("$g")
|
|
211
229
|
done
|
|
212
230
|
|
|
231
|
+
# Asked for a ground this command cannot serve: say so plainly rather than "no such
|
|
232
|
+
# ground here", which sends someone off to create one that would not have helped.
|
|
233
|
+
if [ -n "$want" ] && [ -n "${GROUNDS_ONLY:-}" ] && [[ " ${GROUNDS_ONLY} " != *" $want "* ]]; then
|
|
234
|
+
fail "${SELF_CMD:-This command} does not apply to $want. ${GROUNDS_ONLY_WHY:-}" >&2
|
|
235
|
+
return 1
|
|
236
|
+
fi
|
|
237
|
+
|
|
213
238
|
if [ -n "$want" ]; then
|
|
214
239
|
for g in "${configured[@]}"; do
|
|
215
240
|
[ "$g" = "$want" ] && { printf '%s' "$want"; return 0; }
|
|
@@ -224,7 +249,9 @@ _pick_ground() {
|
|
|
224
249
|
*)
|
|
225
250
|
# Two grounds and no name. Refuse rather than pick: this decides which cloud a
|
|
226
251
|
# destroy lands on.
|
|
227
|
-
|
|
252
|
+
# Names the grounds THIS command can actually serve, not both clouds unconditionally:
|
|
253
|
+
# offering a choice that would be refused is worse than not offering it.
|
|
254
|
+
fail "Two grounds are configured. Say which: ${BOLD}${SELF_CMD:-unoverse deploy} ${configured[0]}${NC} or ${BOLD}${SELF_CMD:-unoverse deploy} ${configured[1]}${NC}" >&2
|
|
228
255
|
return 1
|
|
229
256
|
;;
|
|
230
257
|
esac
|
package/package.json
CHANGED