Added
-
servicrab exec <SERVICE> -- <COMMAND>..., for the questions that start with
"but what does the service actually see?":servicrab exec api -- printenv DATABASE_URL servicrab exec api -- npm run migrate servicrab exec db -- psql
It runs the command with the service's merged environment, its
env_file
layers and its working directory, assembled by the same code that starts the
service, so the two cannot drift apart. The command inherits servicrab's
stdio — interactive tools and pipes work, and nothing of servicrab's own
reaches the output — and its exit status is passed through, with127for a
command that does not exist and126for one that is not executable, as a
shell would.Unlike
docker execit does not enter a running process: no daemon is
involved and no namespace is joined. That is the point. Debugging a service
that refuses to start is exactly when there is nothing to attach to, and it is
also the limit — a variable the process changed after startup is not visible
here.Everything after the service name belongs to the command, including its own
flags.