@nodegx/preview 0.2.5 → 0.2.6
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/dist/backend/cli.js +1225 -656
- package/dist/backend/vm/provision-app.sh +41 -0
- package/dist/browser/noodl-graph-target.js +95 -95
- package/dist/browser/noodl-preview-in-page.js +23 -20
- package/dist/external/deploy/noodl.deploy.js +1 -1
- package/dist/nodegx-deploy.cjs +1000 -581
- package/dist/nodegx-deploy.inputs.json +5 -0
- package/dist/noodl-preview.cjs +820 -531
- package/dist/noodl-preview.inputs.json +4 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
# /etc/<app>/secrets.env (written by ship-to-vm.sh over stdin, never here, never in the folder)
|
|
22
22
|
# /etc/systemd/system/<app>-backend.service
|
|
23
23
|
# /etc/caddy/conf.d/<app>.caddy (unless CADDY=off; deleted again if caddy validate fails)
|
|
24
|
+
# /opt/nodegx-native/sharp-<version>/ the image module that makes a photo's small versions, fetched from npm
|
|
25
|
+
# the first time any app ships here and shared by every app after
|
|
24
26
|
#
|
|
25
27
|
# and, once Caddy no longer points at it, removes /srv/<app>/ — the site the earlier layout (a site plus a loose
|
|
26
28
|
# cli.js) served from.
|
|
@@ -108,6 +110,44 @@ chown -R root:root "$FOLDER"; chmod -R u+rwX,go+rX,go-w "$FOLDER"
|
|
|
108
110
|
chown root:"$APP_USER" "$SECRETS"; chmod 640 "$SECRETS"
|
|
109
111
|
chown -R "$APP_USER":"$APP_USER" "/var/lib/$APP"; chmod 750 "/var/lib/$APP"
|
|
110
112
|
|
|
113
|
+
# 🔴 P112-OWN024-DEPLOYNOSHARP (Richard, 2026-10-25: the server fetches it once). A photo's small versions (?thumb=)
|
|
114
|
+
# are made by sharp, a native module the folder does not carry, so without it every thumbnail answers 501 and the
|
|
115
|
+
# marketplace draws its photos broken. It is fetched from npm ONCE per server into a place outside /opt/<app> (which
|
|
116
|
+
# every ship replaces), shared by every app here, and found through the unit's NODE_PATH. A server that cannot fetch
|
|
117
|
+
# it still ships: the app runs, and ?thumb= answers 501 until a later ship can. Pinned to the version the editor's
|
|
118
|
+
# backend ships (the lockfile's; tests/p112-own024-deploy-sharp.test.ts holds the two together).
|
|
119
|
+
SHARP_VERSION=0.33.5
|
|
120
|
+
NATIVE=/opt/nodegx-native
|
|
121
|
+
SHARP_DIR="$NATIVE/sharp-$SHARP_VERSION"
|
|
122
|
+
sharp_loads() { "$NODE" -e 'require(process.argv[1])' "$1/node_modules/sharp" >/dev/null 2>&1; }
|
|
123
|
+
if sharp_loads "$SHARP_DIR"; then
|
|
124
|
+
echo " photos: small versions (?thumb=) are made by sharp $SHARP_VERSION, already on this server"
|
|
125
|
+
else
|
|
126
|
+
mkdir -p "$NATIVE"
|
|
127
|
+
FETCH="$(mktemp -d "$NATIVE/.sharp-$SHARP_VERSION-XXXXXX")"
|
|
128
|
+
NPM="$(command -v npm || true)"
|
|
129
|
+
if [ -z "$NPM" ]; then
|
|
130
|
+
WHY="this server has no npm"
|
|
131
|
+
elif ! WHY="$(cd "$FETCH" && npm_config_cache="$FETCH/.cache" timeout 300 "$NPM" install --prefix "$FETCH" --omit=dev \
|
|
132
|
+
--no-audit --no-fund --loglevel=error --fetch-retries=1 "sharp@$SHARP_VERSION" 2>&1)"; then
|
|
133
|
+
# npm's last line points at a log in the cache this deletes; the line before it is the reason.
|
|
134
|
+
WHY="npm could not fetch it ($(echo "$WHY" | grep -v -e '^\s*$' -e 'complete log' | tail -1 | sed 's/^npm error //' || true))"
|
|
135
|
+
elif ! sharp_loads "$FETCH"; then
|
|
136
|
+
WHY="it was fetched but does not load on this server: $("$NODE" -e 'require(process.argv[1])' "$FETCH/node_modules/sharp" 2>&1 | grep -m1 -E '^[A-Za-z]*Error' || true)"
|
|
137
|
+
else
|
|
138
|
+
WHY=""
|
|
139
|
+
fi
|
|
140
|
+
rm -rf "$FETCH/.cache"
|
|
141
|
+
if [ -z "$WHY" ]; then
|
|
142
|
+
rm -rf "$SHARP_DIR"; mv "$FETCH" "$SHARP_DIR"; chmod -R go+rX,go-w "$SHARP_DIR"
|
|
143
|
+
echo " photos: fetched sharp $SHARP_VERSION from npm for this server's small photo versions (?thumb=), once"
|
|
144
|
+
else
|
|
145
|
+
rm -rf "$FETCH"
|
|
146
|
+
echo " photos: NOT AVAILABLE: small photo versions (?thumb=) answer 501 until sharp $SHARP_VERSION is on this server," \
|
|
147
|
+
"and the next ship fetches it again. $WHY. The app runs; uploads and full-size photos work."
|
|
148
|
+
fi
|
|
149
|
+
fi
|
|
150
|
+
|
|
111
151
|
cat > "$UNIT" <<UNIT
|
|
112
152
|
[Unit]
|
|
113
153
|
Description=${APP} (NodeGX full-stack folder, P26 DEP-002)
|
|
@@ -120,6 +160,7 @@ User=${APP_USER}
|
|
|
120
160
|
Group=${APP_USER}
|
|
121
161
|
WorkingDirectory=/var/lib/${APP}
|
|
122
162
|
EnvironmentFile=${SECRETS}
|
|
163
|
+
Environment=NODE_PATH=${SHARP_DIR}/node_modules
|
|
123
164
|
ExecStart=${NODE} ${FOLDER}/start.js --port ${PORT} --host 127.0.0.1 --data-dir ${DATA_DIR} --backend-id ${APP} --no-admin
|
|
124
165
|
Restart=always
|
|
125
166
|
RestartSec=3
|