Files
computer-playbook/scripts/tests/deploy/local/exec/app.sh
T
kevinveenbirkenbachandClaude Opus 5 aa09a3707b feat(make): add compose-app-exec for reaching a deployed app container
The local exec helpers covered the development container and a throwaway
sidecar next to it, but nothing reached into an application the stack had
already deployed. Swarm had swarm-app-exec for that; compose had no
counterpart, so the only remaining route was a nested docker exec, which the
contributor rules forbid.

The helper goes through container.sh's positional form rather than its cmd
environment variable. container.sh runs that variable through `sh -lc`, so an
already-composed command would be split a second time; passing argv through
untouched leaves exactly one shell level, inside the target container.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06 13:54:58 +02:00

23 lines
819 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Run a one-off command inside a deployed app container of the local compose
# stack, through the repository's own `container` wrapper.
#
# Usage:
# app=<container> cmd='<command>' scripts/tests/deploy/local/exec/app.sh # nocheck: self-path-reference
#
# Environment:
# app Container name of the deployed app (e.g. flowise).
# cmd Command executed inside that container via `sh -lc`.
#
# Examples:
# app=flowise cmd='wget -qO- http://localhost:3000/api/v1/ping' scripts/tests/deploy/local/exec/app.sh # nocheck: self-path-reference
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
: "${app:?app=<container> required, e.g. app=flowise}"
: "${cmd:?cmd='<command>' required}"
exec bash "${SCRIPT_DIR}/container.sh" container exec -i "${app}" sh -lc "${cmd}"