Search
⌃K

Env Exec

Velocity's Env Exec feature allows you to run a standalone shell command, or to open a terminal, inside of a running container for troubleshooting and debugging Velocity Services during runtime.

Run a shell command inside a container

For example, the following command will list files and directories in the root of the running container.
veloctl env exec -s <service> — ls

Open a terminal inside the container

To open a terminal inside of a Velocity Service's running container, you can run the following:
veloctl env exec -s <service> -t -- /bin/sh

Env Exec Script

Additionally, with Velocity's Env Exec-Script feature, you can run a predefined script in a running container by adding the script name and command to your .velocity.yaml config.
version: 1
services:
analytics:
exec:
scripts:
get-mongodb-url:
description: prints mongodb url
command: sh
args:
- -c
- env | grep MONGODB_URL
my-test:
description: run sanity test
command: ./test.sh
With the above exec configuration added to your .velocity.yaml file, you can run either of the following commands in the analytics Velocity Service during runtime:
veloctl env exec-script -s analytics get-mongodb-url
veloctl env exec-script -s analytics my-test
Note: in order to run the my-test script as shown above, the script test.sh must be included in the container image.