nix: print how to tail the server logs
For easier debugging during loadtests. Also prefix the echo traces for the postgrest-with-pgrst command.
This commit is contained in:
@@ -354,9 +354,12 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
withPgrst =
|
withPgrst =
|
||||||
|
let
|
||||||
|
commandName = "postgrest-with-pgrst";
|
||||||
|
in
|
||||||
checkedShellScript
|
checkedShellScript
|
||||||
{
|
{
|
||||||
name = "postgrest-with-pgrst";
|
name = commandName;
|
||||||
docs = "Build and run PostgREST and run <command> with PGRST_SERVER_UNIX_SOCKET set.";
|
docs = "Build and run PostgREST and run <command> with PGRST_SERVER_UNIX_SOCKET set.";
|
||||||
args =
|
args =
|
||||||
[
|
[
|
||||||
@@ -379,7 +382,7 @@ let
|
|||||||
rm -f result
|
rm -f result
|
||||||
build_start=$SECONDS
|
build_start=$SECONDS
|
||||||
if [ -z "''${PGRST_BUILD_CABAL:-}" ]; then
|
if [ -z "''${PGRST_BUILD_CABAL:-}" ]; then
|
||||||
echo -n "Building postgrest (nix)... "
|
echo -n "${commandName}: Building postgrest (nix)... "
|
||||||
# Using lib.getBin to also make this work with older checkouts, where .bin was not a thing, yet.
|
# Using lib.getBin to also make this work with older checkouts, where .bin was not a thing, yet.
|
||||||
nix-build -E 'with import ./. {}; pkgs.lib.getBin postgrestPackage' > "$tmpdir"/build.log 2>&1 || {
|
nix-build -E 'with import ./. {}; pkgs.lib.getBin postgrestPackage' > "$tmpdir"/build.log 2>&1 || {
|
||||||
echo "failed, output:"
|
echo "failed, output:"
|
||||||
@@ -388,7 +391,7 @@ let
|
|||||||
}
|
}
|
||||||
PGRST_CMD=$(echo ./result*/bin/postgrest)
|
PGRST_CMD=$(echo ./result*/bin/postgrest)
|
||||||
else
|
else
|
||||||
echo -n "Building postgrest (cabal)... "
|
echo -n "${commandName}: Building postgrest (cabal)... "
|
||||||
postgrest-build
|
postgrest-build
|
||||||
PGRST_CMD=postgrest-run
|
PGRST_CMD=postgrest-run
|
||||||
fi
|
fi
|
||||||
@@ -398,7 +401,7 @@ let
|
|||||||
|
|
||||||
ver=$($PGRST_CMD ${legacyConfig} --version)
|
ver=$($PGRST_CMD ${legacyConfig} --version)
|
||||||
|
|
||||||
echo -n "Starting $ver... "
|
echo -n "${commandName}: Starting $ver... "
|
||||||
|
|
||||||
$PGRST_CMD ${legacyConfig} > "$tmpdir"/run.log 2>&1 &
|
$PGRST_CMD ${legacyConfig} > "$tmpdir"/run.log 2>&1 &
|
||||||
pid=$!
|
pid=$!
|
||||||
@@ -425,6 +428,8 @@ let
|
|||||||
wait_duration=$((SECONDS - wait_start))
|
wait_duration=$((SECONDS - wait_start))
|
||||||
printf "done in %ss.\n" "$wait_duration"
|
printf "done in %ss.\n" "$wait_duration"
|
||||||
|
|
||||||
|
echo "${commandName}: You can tail the server logs with: tail -f $tmpdir/run.log"
|
||||||
|
|
||||||
if [[ -n "$_arg_monitor" ]]; then
|
if [[ -n "$_arg_monitor" ]]; then
|
||||||
${monitorPid} "$pid" > "$_arg_monitor" &
|
${monitorPid} "$pid" > "$_arg_monitor" &
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user