|
10 | 10 |
|
11 | 11 | set -e |
12 | 12 |
|
13 | | -PROJECT_DIR="/home/bloud.linux/bloud-v3" |
| 13 | +PROJECT_DIR="/home/bloud.linux/bloud" |
14 | 14 | LOCAL_SRC="/tmp/bloud-src" |
15 | 15 | DATA_DIR="/home/bloud/.local/share/bloud" # Match NixOS module path |
16 | 16 | LOCAL_NODE_MODULES="/tmp/bloud-node-modules" |
|
58 | 58 | rm -rf "$WEB_DIR/node_modules" |
59 | 59 | ln -s "$LOCAL_NODE_MODULES/node_modules" "$WEB_DIR/node_modules" |
60 | 60 |
|
| 61 | +# Fix go.mod replace paths for VM directory structure |
| 62 | +sed -i 's|=> ../../apps|=> ../apps|g' "$LOCAL_SRC/host-agent/go.mod" 2>/dev/null || true |
| 63 | +sed -i 's|=> ../services/host-agent|=> ../host-agent|g' "$LOCAL_SRC/apps/go.mod" 2>/dev/null || true |
| 64 | + |
| 65 | +# Pre-build host-agent binary (required for service prestart/poststart hooks) |
| 66 | +echo "Building host-agent binary..." |
| 67 | +cd "$LOCAL_SRC/host-agent" |
| 68 | +if go build -o /tmp/host-agent ./cmd/host-agent 2>&1; then |
| 69 | + echo "Host-agent binary built at /tmp/host-agent" |
| 70 | +else |
| 71 | + echo "Warning: Failed to build host-agent, services may fail" |
| 72 | +fi |
| 73 | + |
| 74 | +# Restart any failed services (in case services failed before binary existed) |
| 75 | +echo "Checking for failed services..." |
| 76 | +systemctl --user reset-failed 2>/dev/null || true |
| 77 | +for svc in podman-apps-postgres podman-apps-redis bloud-db-init authentik-db-init podman-apps-authentik-server podman-apps-authentik-worker podman-apps-authentik-proxy; do |
| 78 | + if systemctl --user is-failed "$svc.service" 2>/dev/null; then |
| 79 | + echo "Restarting failed service: $svc" |
| 80 | + systemctl --user restart "$svc.service" 2>/dev/null || true |
| 81 | + elif ! systemctl --user is-active "$svc.service" 2>/dev/null; then |
| 82 | + echo "Starting inactive service: $svc" |
| 83 | + systemctl --user start "$svc.service" 2>/dev/null || true |
| 84 | + fi |
| 85 | +done |
| 86 | + |
61 | 87 | # Create Go watch script with rsync |
62 | 88 | GO_WATCH="/tmp/go-watch.sh" |
63 | 89 | cat > "$GO_WATCH" << 'GO_EOF' |
|
0 commit comments