mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-06 05:33:38 -10:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c261ecdfbc | ||
|
|
712e5ba3a0 |
No files matched your search
@@ -78,7 +78,8 @@ image)
|
||||
dirty=$([ -n "$(git -C "$HERE" status --porcelain -- .)" ] && echo true || echo false)
|
||||
fi
|
||||
has_app "$IMAGE_APP" || fly apps create "$IMAGE_APP" --org "$ORG" > /dev/null
|
||||
label=v$version-${commit:0:10}$([ "$dirty" = true ] && echo "-dirty-$(date +%s)")
|
||||
# (|| true: on a clean tree the test fails, and set -e ended the script there with nothing said)
|
||||
label=v$version-${commit:0:10}$([ "$dirty" = true ] && echo "-dirty-$(date +%s)" || true)
|
||||
(cd "$src" && fly deploy --build-only --push -a "$IMAGE_APP" -c deploy/fly/image.toml --dockerfile deploy/fly/Dockerfile \
|
||||
--image-label "$label" --build-arg RAEA_VERSION="$version" --build-arg COMMIT="$commit" --build-arg DIRTY="$dirty" .) >&2
|
||||
echo "registry.fly.io/$IMAGE_APP:$label" | tee "$CONF/fly-image"
|
||||
@@ -169,7 +170,9 @@ except Exception: print(-1)')
|
||||
# run from inside the work folder, which the box's idle stop sees as work going on (server/idle.ts); the box woken
|
||||
# first, as fly ssh doesn't start a stopped Machine
|
||||
healthy "$NAME" > /dev/null || true
|
||||
fly ssh console -a "$a" -q -C "sh -c 'cd /home/raea/work/.move && zstd -dqc home.tar.zst | tar -C /home/raea -xf - --checkpoint=50000 --checkpoint-action=echo=\"fly box: $NAME: %{}T unpacked\" && cd /home/raea && rm -rf work/.move && chown -R raea:raea /home/raea && du -sh /home/raea'"
|
||||
# and the box held while it unpacks (~/.raea-hold, which its idle stop reads): its image may be older than idle.ts's
|
||||
# real-path match
|
||||
fly ssh console -a "$a" -q -C "sh -c '(while kill -0 \$\$ 2> /dev/null; do touch /home/raea/.raea-hold; sleep 60; done) & cd /home/raea/work/.move && zstd -dqc home.tar.zst | tar -C /home/raea -xf - --checkpoint=50000 --checkpoint-action=echo=\"fly box: $NAME: %{}T unpacked\" && cd /home/raea && rm -rf work/.move && chown -R raea:raea /home/raea && du -sh /home/raea'"
|
||||
# its own settings on its disk too, as a Sprite kept them
|
||||
fly ssh console -a "$a" -q -C "sh -c 'umask 077; cat > /home/raea/.raea-cloud.env && chown raea:raea /home/raea/.raea-cloud.env'" < "$f"
|
||||
# RAEA_BOX_REGISTER=0: copied, but raea cloud still sends work to the Sprite until deploy/fly/box.sh register NAME
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// `holdMs`: raea cloud touches it while a project is unfinished (its awake alarm), as it held a Sprite's task before.
|
||||
//
|
||||
// Off unless RAEA_CLOUD_IDLE_STOP_MIN is set (the Fly image sets it), so a box elsewhere never stops itself.
|
||||
import { readdirSync, readFileSync, readlinkSync, statSync } from "node:fs"
|
||||
import { readdirSync, readFileSync, readlinkSync, realpathSync, statSync } from "node:fs"
|
||||
import type { Server } from "node:http"
|
||||
import path from "node:path"
|
||||
|
||||
@@ -35,13 +35,19 @@ export function workingIn(work: string, self = process.pid): number[] {
|
||||
} catch {
|
||||
return out
|
||||
}
|
||||
const root = path.resolve(work) + "/"
|
||||
// the folder by the name it's given and by its real one: /proc says where a process is with no symlink in the way, and
|
||||
// a Fly box's work folder is /home/sprite/work, a link to /home/raea/work (12-03: a 64 GB unpack in it was taken for
|
||||
// idle and the box stopped under it)
|
||||
const roots = [path.resolve(work) + "/"]
|
||||
try {
|
||||
roots.push(realpathSync(work) + "/")
|
||||
} catch {}
|
||||
for (const d of pids) {
|
||||
const pid = Number(d)
|
||||
if (mine.has(pid)) continue
|
||||
try {
|
||||
const cwd = readlinkSync(`/proc/${d}/cwd`) + "/"
|
||||
if (cwd.startsWith(root)) out.push(pid)
|
||||
if (roots.some((r) => cwd.startsWith(r))) out.push(pid)
|
||||
} catch {}
|
||||
}
|
||||
return out
|
||||
|
||||
Reference in new issue
Block a user