diff --git a/dev-worker b/dev-worker index 2c6273b..033ace5 100644 --- a/dev-worker +++ b/dev-worker @@ -10,7 +10,8 @@ Usage: sh ./dev-worker [arguments...] Commands: up Start the isolated worker and wait for Nextcloud installation - exec Run a command in the worker's Nextcloud container + exec Run a non-interactive command in the worker's Nextcloud container + shell Open an interactive shell in the worker's Nextcloud container logs Print worker logs config Render the resolved Compose configuration status Run occ status in the worker @@ -28,6 +29,7 @@ Environment: NEXTCLOUD_HOST= Public hostname (default: .localhost) NEXTCLOUD_PROTOCOL=http|https Public protocol (default: https) NCDD_WORKSPACE= Optional directory mounted as /var/www/html/apps-extra + NCDD_SHELL= Interactive shell command (default: bash) WORKER_READY_TIMEOUT=180 Seconds to wait for a clean installation EOF } @@ -184,6 +186,9 @@ case "$command" in } compose exec -T nextcloud "$@" ;; + shell) + compose exec nextcloud "${NCDD_SHELL:-bash}" + ;; logs) compose logs --no-color "$@" ;; @@ -233,4 +238,4 @@ case "$command" in usage >&2 exit 2 ;; -esac +esac \ No newline at end of file diff --git a/docs/apps-development.md b/docs/apps-development.md index c02a585..6059dd3 100644 --- a/docs/apps-development.md +++ b/docs/apps-development.md @@ -56,8 +56,19 @@ NCDD does not assign a primary application, manage application repositories or limit how many applications the workspace contains. Clones, Git worktrees and other source layouts are the responsibility of the caller. +For an interactive development shell, use the worker command that keeps TTY +allocation enabled: + +```bash +NCDD_WORKSPACE=/tmp/workspaces/issue-123 \ +DB_TYPE=sqlite \ +sh ./dev-worker issue-123 shell +``` + +Set `NCDD_SHELL` if a shell other than `bash` is desired. + Application-specific setup remains owned by the application repository or the -agent operating the worker: +agent operating the worker. Use `exec` for non-interactive commands: ```bash NCDD_WORKSPACE=/tmp/workspaces/issue-123 \ @@ -69,4 +80,4 @@ sh ./dev-worker issue-123 exec sh -lc \ Worker runtime state remains under `.workers/`; destroying a worker never deletes its external workspace. -⬅️ [Back to index](../README.md) +⬅️ [Back to index](../README.md) \ No newline at end of file diff --git a/tests/worker/contract.bats b/tests/worker/contract.bats index 351d354..dec2a85 100644 --- a/tests/worker/contract.bats +++ b/tests/worker/contract.bats @@ -113,3 +113,11 @@ setup() { } + +@test "worker exposes a TTY-enabled interactive shell command" { + run grep -F 'compose exec nextcloud "${NCDD_SHELL:-bash}"' "$WORKER" + [ "$status" -eq 0 ] + + run grep -F 'compose exec -T nextcloud "$@"' "$WORKER" + [ "$status" -eq 0 ] +}