Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(cursor): stop Cloud install daemons so the bake can exit (#5812)

teo3b999f4f627d
diff --git a/.cursor/cloud-lib.sh b/.cursor/cloud-lib.sh
index ddbe7d3215..06c1e0ca5a 100755
--- a/.cursor/cloud-lib.sh
+++ b/.cursor/cloud-lib.sh
@@ -95,8 +95,8 @@ ensure_nix_daemon() {
"AWS_SECRET_ACCESS_KEY=${NIX_CACHE_AWS_SECRET_ACCESS_KEY}"
)
fi
- sudo setsid env "${daemon_env[@]}" "${NIX_BIN}" daemon \
- >>"${LOG_DIR}/nix-daemon.log" 2>&1 </dev/null &
+ sudo setsid --fork env "${daemon_env[@]}" "${NIX_BIN}" daemon \
+ >>"${LOG_DIR}/nix-daemon.log" 2>&1 </dev/null
local n=0
while [ "${n}" -lt 30 ]; do
if "${NIX_BIN}" ping-store >/dev/null 2>&1; then
@@ -167,8 +167,8 @@ ensure_dockerd() {
# Disk snapshots preserve dead socket entries.
sudo rm -f "${DOCKER_SOCK}"
: >"${LOG_DIR}/dockerd.log"
- sudo setsid env "PATH=${PATH}" "${dockerd_bin}" "${storage_args[@]}" \
- >>"${LOG_DIR}/dockerd.log" 2>&1 </dev/null &
+ sudo setsid --fork env "PATH=${PATH}" "${dockerd_bin}" "${storage_args[@]}" \
+ >>"${LOG_DIR}/dockerd.log" 2>&1 </dev/null
local n=0
while [ "${n}" -lt 60 ]; do
if [ -S "${DOCKER_SOCK}" ]; then
@@ -243,3 +243,32 @@ build_local_stack_binaries() {
"${NIX_BIN}" build "${WORKSPACE_ROOT}#local-stack-binaries" --out-link "${LOCAL_STACK_BINS}"
)
}
+
+stop_cloud_daemons() {
+ if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then
+ local ids
+ ids="$(docker ps -aq 2>/dev/null || true)"
+ if [ -n "${ids}" ]; then
+ # shellcheck disable=SC2086
+ timeout --kill-after=5s 45s docker stop -t 5 ${ids} >/dev/null 2>&1 || true
+ fi
+ fi
+ sudo pkill -x dockerd >/dev/null 2>&1 || true
+ sudo pkill -x containerd >/dev/null 2>&1 || true
+ sudo pkill -x nix-daemon >/dev/null 2>&1 || true
+ sudo pkill -x determinate-nixd >/dev/null 2>&1 || true
+ local n=0
+ while sudo pgrep -x dockerd >/dev/null 2>&1 \
+ || sudo pgrep -x nix-daemon >/dev/null 2>&1 \
+ || sudo pgrep -x determinate-nixd >/dev/null 2>&1; do
+ n=$((n + 1))
+ if [ "${n}" -ge 15 ]; then
+ sudo pkill -9 -x dockerd >/dev/null 2>&1 || true
+ sudo pkill -9 -x containerd >/dev/null 2>&1 || true
+ sudo pkill -9 -x nix-daemon >/dev/null 2>&1 || true
+ sudo pkill -9 -x determinate-nixd >/dev/null 2>&1 || true
+ break
+ fi
+ sleep 1
+ done
+}
diff --git a/.cursor/install.sh b/.cursor/install.sh
index 338d16ee4a..16e8d68131 100755
--- a/.cursor/install.sh
+++ b/.cursor/install.sh
@@ -69,4 +69,8 @@ just stack up --infra-only --no-doppler --build-aux-services --binaries-dir "${L
cleanup_stack
trap - EXIT
+# Cursor waits for the install process tree to drain. Images, volumes, and
+# the Nix store stay on disk; start.sh / infra.sh bring the daemons back.
+stop_cloud_daemons
+
echo "cursor-cloud install: durable stack ready"
diff --git a/CLAUDE.md b/CLAUDE.md
index 5d73206932..1f5afeb01c 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -317,7 +317,7 @@ don't inject it directly into the error message.
## Cursor Cloud specific instructions
-`.cursor/install.sh` prepares the durable caches, databases, test dependencies, frontend dependencies, service binaries, and stack init snapshot. `.cursor/start.sh` runs at boot and starts nothing beyond the nix daemon, so sessions and subagents are usable immediately. `.cursor/infra.sh` starts Docker, Postgres, and Redis on demand. `.cursor/stack.sh` starts the on-demand product stack. `.cursor/rebuild.sh` rebuilds the stack after backend edits. These scripts are the only supported entry points; each re-enters the pinned nix shell itself, so run them with plain `bash` from any environment.
+`.cursor/install.sh` prepares the durable caches, databases, test dependencies, frontend dependencies, service binaries, and stack init snapshot, then stops dockerd and nix-daemon so the Cloud bake can exit. `.cursor/start.sh` runs at boot and starts nothing beyond the nix daemon, so sessions and subagents are usable immediately. `.cursor/infra.sh` starts Docker, Postgres, and Redis on demand. `.cursor/stack.sh` starts the on-demand product stack. `.cursor/rebuild.sh` rebuilds the stack after backend edits. These scripts are the only supported entry points; each re-enters the pinned nix shell itself, so run them with plain `bash` from any environment.
Nix is the only host dependency. The pinned dev shell supplies the Docker CLI and daemon, Compose, `fuse-overlayfs`, and OpenSSH. `ssh-keygen` must come from this shell.