Skip to content

Commit 0b4411e

Browse files
fix: tune vm sysctl params and redirect cp-ready output to journal
1 parent 4e3b892 commit 0b4411e

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

modules/csf-setup.nix

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,31 +113,28 @@ in
113113
Type = "oneshot";
114114
RemainAfterExit = true;
115115
User = "root";
116+
StandardOutput = "journal+console";
117+
StandardError = "journal+console";
116118
ExecStart = pkgs.writeShellScript "csf-cp-ready" ''
117119
set -euo pipefail
118120
119121
CURL=${pkgs.curl}/bin/curl
120122
TIMEOUT=120
121123
ELAPSED=0
122124
123-
echo "CSF Control Plane starting..." > /dev/tty1
124-
125125
while [ "$ELAPSED" -lt "$TIMEOUT" ]; do
126126
if "$CURL" -sf http://localhost:8000/api/public-key > /dev/null 2>&1; then
127-
IP=$(hostname -I | awk '{print $1}')
128-
echo "" > /dev/tty1
129-
echo "CSF Control Plane ready." > /dev/tty1
130-
echo "API: http://$IP:8000" > /dev/tty1
127+
IP=$(${pkgs.iproute2}/bin/ip route get 1.1.1.1 2>/dev/null | awk '/src/{print $7; exit}' || true)
128+
echo "[INFO] csf control plane ready host=$IP port=8000"
131129
exit 0
132130
fi
133131
134-
echo "Waiting for API gateway... (''${ELAPSED}s)" > /dev/tty1
132+
echo "[INFO] csf control plane not ready elapsed=''${ELAPSED}s timeout=''${TIMEOUT}s"
135133
sleep 5
136134
ELAPSED=$((ELAPSED + 5))
137135
done
138136
139-
echo "CSF Control Plane did not become ready within ''${TIMEOUT}s" > /dev/tty1
140-
echo "Check: sudo docker logs csf-csf-api-gateway-1" > /dev/tty1
137+
echo "[ERROR] csf control plane readiness timeout elapsed=''${TIMEOUT}s"
141138
exit 1
142139
'';
143140
};

0 commit comments

Comments
 (0)