title | draft | slug | url |
---|---|---|---|
One-off Commands |
false |
One-off Commands |
/management/run |
Convox allows you to execute one-off commands on your App. This can be used for starting a shell for debugging purposes or running administrative commands such as database migrations.
Using convox run
will start a new Process of the specified
Service on your current Rack and run your command inside the new Process.
Running an interactive process will start a Process and connect your local terminal so that you can run commands and see output:
$ convox run web bash
root@web#
Running detached is useful for long-running tasks that you don't want to be disrupted:
$ convox run web bin/cleanup-database --detach
Running detached process... OK, web-s43xf
The output of detached Processes will appear in the application logs
Using convox exec
will run a command inside an existing Process.
This can be useful for debugging a running Process.
$ convox ps
ID SERVICE STATUS RELEASE STARTED COMMAND
web-6844dc6f45-9wdss web running RABCDEFGHI 14 minutes ago bin/web
web-6844dc6f45-mj9mp web running RABCDEFGHI 14 minutes ago bin/web
$ convox exec web-6844dc6f45-9wdss bash
root@web#
You can also use a Service name with convox exec
to select
a random Process of that Service.
$ convox exec web bash
root@web#