mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
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>
23 lines
819 B
Bash
Executable File
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}"
|