Skip to content

Commit abe414a

Browse files
committed
nix: print how to tail the server logs
For easier debugging during loadtests. Also prefix the echo traces for the postgrest-with-pgrst command.
1 parent e95e815 commit abe414a

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

nix/tools/withTools.nix

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,12 @@ let
354354
'';
355355

356356
withPgrst =
357+
let
358+
commandName = "postgrest-with-pgrst";
359+
in
357360
checkedShellScript
358361
{
359-
name = "postgrest-with-pgrst";
362+
name = commandName;
360363
docs = "Build and run PostgREST and run <command> with PGRST_SERVER_UNIX_SOCKET set.";
361364
args =
362365
[
@@ -379,7 +382,7 @@ let
379382
rm -f result
380383
build_start=$SECONDS
381384
if [ -z "''${PGRST_BUILD_CABAL:-}" ]; then
382-
echo -n "Building postgrest (nix)... "
385+
echo -n "${commandName}: Building postgrest (nix)... "
383386
# Using lib.getBin to also make this work with older checkouts, where .bin was not a thing, yet.
384387
nix-build -E 'with import ./. {}; pkgs.lib.getBin postgrestPackage' > "$tmpdir"/build.log 2>&1 || {
385388
echo "failed, output:"
@@ -388,7 +391,7 @@ let
388391
}
389392
PGRST_CMD=$(echo ./result*/bin/postgrest)
390393
else
391-
echo -n "Building postgrest (cabal)... "
394+
echo -n "${commandName}: Building postgrest (cabal)... "
392395
postgrest-build
393396
PGRST_CMD=postgrest-run
394397
fi
@@ -398,7 +401,7 @@ let
398401
399402
ver=$($PGRST_CMD ${legacyConfig} --version)
400403
401-
echo -n "Starting $ver... "
404+
echo -n "${commandName}: Starting $ver... "
402405
403406
$PGRST_CMD ${legacyConfig} > "$tmpdir"/run.log 2>&1 &
404407
pid=$!
@@ -425,6 +428,8 @@ let
425428
wait_duration=$((SECONDS - wait_start))
426429
printf "done in %ss.\n" "$wait_duration"
427430
431+
echo "${commandName}: You can tail the server logs with: tail -f $tmpdir/run.log"
432+
428433
if [[ -n "$_arg_monitor" ]]; then
429434
${monitorPid} "$pid" > "$_arg_monitor" &
430435
fi

0 commit comments

Comments
 (0)