Artisan Commands
ske run runs a command against a deployed environment, with your application’s environment variables, database and cache. It waits for the command to end, prints its output and exits with its exit code.
Running a command
Section titled “Running a command”ske run --env production php artisan migrate --forceFlags of ske go before the command: everything from the command’s first word on is sent as it is, so --force above goes to artisan, and --env must come before php. Quote a command that needs a shell’s quoting:
ske run "php artisan tinker --execute='echo User::count();'"The command runs with sh -c in the application’s directory, in a dedicated invocation of the environment’s CLI function, isolated from web traffic. Its output comes back whole once it ends, cut in the middle if it is over 1 MB.
The dashboard’s Console tab on the environment runs commands the same way.
A command can’t be stopped once it has started: Ctrl-C stops waiting for it, not the command itself. ske run show <run-id> shows its result later.
There is no interactive session: ske run can’t answer prompts, so use --execute for tinker and --force or --no-interaction for commands that ask.
Run history
Section titled “Run history”ske run list --limit 30ske run show <run-id>ske run list lists the environment’s recent runs: who ran what, when, and how it ended. To run a command named list or show, put it after --: ske run -- list.
Timeouts
Section titled “Timeouts”Commands run on the CLI function, which has its own memory and timeout. Set them under the environment’s Settings, Compute, in the CLI part:
| Setting | Description | Default |
|---|---|---|
| Memory | Memory for commands, in MB (128 to 10,240) | 512 |
| Timeout | Maximum time per command, in seconds (1 to 900) | 900 |
Common uses
Section titled “Common uses”# Run database migrationsske run --env production php artisan migrate --force
# Clear cachesske run --env staging php artisan cache:clear
# Run a custom commandske run --env production php artisan app:import-data --source=s3Caution: with a cache attached, cache:clear empties the whole Redis database the cache store is on, for every environment attached to that cache, and on a serverless cache also locks and anything else the app keeps in Redis. See Caches.