You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* test: fix duplicate apps deletion during cleanup
* feat: raise error if no value is provided for a non-boolean option
* feat: add option to delete specific workload to delete command
* feat: add options to use different limit on number of entries and loopback window to logs command
* feat: add option to display logs for specific replica to logs command
* feat: add option to stop specific replica to ps:stop command
* feat: improve run command
* feat: improve handling of commands that accept extra options
* feat: run release script in context of run command
* fix: use exact same image as original workload by default
* fix: wait for runner workload to be updated before starting job
* chore: add note regarding stty size
* test: update specs
* fix: add delay before starting job if image changed
* More log drain variants
* Add log_method option, cleanup
* Fix Kernel.system orphan process handling
- Deletes the whole app (GVC with all workloads, all volumesets and all images)
108
+
- Deletes the whole app (GVC with all workloads, all volumesets and all images) or a specific workload
109
109
- Will ask for explicit user confirmation
110
110
111
111
```sh
112
+
# Deletes the whole app (GVC with all workloads, all volumesets and all images).
112
113
cpl delete -a $APP_NAME
114
+
115
+
# Deletes a specific workload.
116
+
cpl delete -a $APP_NAME -w $WORKLOAD_NAME
113
117
```
114
118
115
119
### `deploy-image`
116
120
117
121
- Deploys the latest image to app workloads
118
122
- Optionally runs a release script before deploying if specified through `release_script` in the `.controlplane/controlplane.yml` file and `--run-release-phase` is provided
123
+
- The release script is run in the context of `cpl run` with the latest image
119
124
- The deploy will fail if the release script exits with a non-zero code or doesn't exist
120
125
121
126
```sh
@@ -177,13 +182,23 @@ cpl latest-image -a $APP_NAME
177
182
### `logs`
178
183
179
184
- Light wrapper to display tailed raw logs for app/workload syntax
185
+
- Defaults to showing the last 200 entries from the past 1 hour before tailing
180
186
181
187
```sh
182
188
# Displays logs for the default workload (`one_off_workload`).
183
189
cpl logs -a $APP_NAME
184
190
185
191
# Displays logs for a specific workload.
186
192
cpl logs -a $APP_NAME -w $WORKLOAD_NAME
193
+
194
+
# Displays logs for a specific replica of a workload.
195
+
cpl logs -a $APP_NAME -w $WORKLOAD_NAME -r $REPLICA_NAME
196
+
197
+
# Uses a different limit on number of entries.
198
+
cpl logs -a $APP_NAME --limit 100
199
+
200
+
# Uses a different loopback window.
201
+
cpl logs -a $APP_NAME --since 30min
187
202
```
188
203
189
204
### `maintenance`
@@ -311,6 +326,9 @@ cpl ps:stop -a $APP_NAME
311
326
312
327
# Stops a specific workload in app.
313
328
cpl ps:stop -a $APP_NAME -w $WORKLOAD_NAME
329
+
330
+
# Stops a specific replica of a workload.
331
+
cpl ps:stop -a $APP_NAME -w $WORKLOAD_NAME -r $REPLICA_NAME
314
332
```
315
333
316
334
### `ps:wait`
@@ -327,26 +345,43 @@ cpl ps:swait -a $APP_NAME -w $WORKLOAD_NAME
327
345
328
346
### `run`
329
347
330
-
- Runs one-off **_interactive_** replicas (analog of `heroku run`)
331
-
- Uses `Standard` workload type and `cpln exec` as the execution method, with CLI streaming
332
-
- If `fix_terminal_size` is `true` in the `.controlplane/controlplane.yml` file, the remote terminal size will be fixed to match the local terminal size (may also be overriden through `--terminal-size`)
333
-
334
-
> **IMPORTANT:** Useful for development where it's needed for interaction, and where network connection drops and
335
-
> task crashing are tolerable. For production tasks, it's better to use `cpl run:detached`.
348
+
- Runs one-off interactive or non-interactive replicas (analog of `heroku run`)
349
+
- Uses `Cron` workload type and either:
350
+
- - `cpln workload exec` for interactive mode, with CLI streaming
351
+
- - log async fetching for non-interactive mode
352
+
- The Dockerfile entrypoint is used as the command by default, which assumes `exec "${@}"` to be present,
353
+
and the args ["bash", "-c", cmd_to_run] are passed
354
+
- The entrypoint can be overriden through `--entrypoint`, which must be a single command or a script path that exists in the container,
355
+
and the args ["bash", "-c", cmd_to_run] are passed,
356
+
unless the entrypoint is `bash`, in which case the args ["-c", cmd_to_run] are passed
357
+
- Providing `--entrypoint none` sets the entrypoint to `bash` by default
358
+
- If `fix_terminal_size` is `true` in the `.controlplane/controlplane.yml` file,
359
+
the remote terminal size will be fixed to match the local terminal size (may also be overriden through `--terminal-size`)
336
360
337
361
```sh
338
362
# Opens shell (bash by default).
339
363
cpl run -a $APP_NAME
340
364
341
-
# Need to quote COMMAND if setting ENV value or passing args.
342
-
cpl run -a $APP_NAME --'LOG_LEVEL=warn rails db:migrate'
365
+
# Runs interactive command, keeps shell open, and stops job when exiting.
366
+
cpl run -a $APP_NAME --interactive -- rails c
343
367
344
-
# Runs command, displays output, and exits shell.
345
-
cpl run -a $APP_NAME -- ls /
346
-
cpl run -a $APP_NAME -- rails db:migrate:status
368
+
# Some commands are automatically detected as interactive, so no need to pass `--interactive`.
369
+
cpl run -a $APP_NAME -- bash
370
+
cpl run -a $APP_NAME -- rails console
371
+
cpl run -a $APP_NAME -- rails c
372
+
cpl run -a $APP_NAME -- rails dbconsole
373
+
cpl run -a $APP_NAME -- rails db
347
374
348
-
# Runs command and keeps shell open.
349
-
cpl run -a $APP_NAME -- rails c
375
+
# Runs non-interactive command, outputs logs, exits with the exit code of the command and stops job.
376
+
cpl run -a $APP_NAME -- rails db:migrate
377
+
378
+
# Runs non-iteractive command, detaches, exits with 0, and prints commands to:
379
+
# - see logs from the job
380
+
# - stop the job
381
+
cpl run -a $APP_NAME --detached -- rails db:migrate
382
+
383
+
# The command needs to be quoted if setting an env variable or passing args.
384
+
cpl run -a $APP_NAME -- 'SOME_ENV_VAR=some_value rails db:migrate'
350
385
351
386
# Uses a different image (which may not be promoted yet).
352
387
cpl run -a $APP_NAME --image appimage:123 -- rails db:migrate # Exact image name
@@ -358,47 +393,12 @@ cpl run -a $APP_NAME -w other-workload -- bash
358
393
# Overrides remote CPLN_TOKEN env variable with local token.
359
394
# Useful when superuser rights are needed in remote container.
360
395
cpl run -a $APP_NAME --use-local-token -- bash
361
-
```
362
-
363
-
### `run:cleanup`
364
-
365
-
- Deletes stale run workloads for an app
366
-
- Workloads are considered stale based on how many days since created
367
-
- `stale_run_workload_created_days` in the `.controlplane/controlplane.yml` file specifies the number of days after created that the workload is considered stale
368
-
- Works for both interactive workloads (created with `cpl run`) and non-interactive workloads (created with `cpl run:detached`)
369
-
- Will ask for explicit user confirmation of deletion
370
-
371
-
```sh
372
-
cpl run:cleanup -a $APP_NAME
373
-
```
374
-
375
-
### `run:detached`
376
-
377
-
- Runs one-off **_non-interactive_** replicas (close analog of `heroku run:detached`)
378
-
- Uses `Cron` workload type with log async fetching
379
-
- Implemented with only async execution methods, more suitable for production tasks
380
-
- Has alternative log fetch implementation with only JSON-polling and no WebSockets
381
-
- Less responsive but more stable, useful for CI tasks
382
-
- Deletes the workload whenever finished with success
383
-
- Deletes the workload whenever finished with failure by default
384
-
- Use `--no-clean-on-failure` to disable cleanup to help with debugging failed runs
385
-
386
-
```sh
387
-
cpl run:detached rails db:prepare -a $APP_NAME
388
396
389
-
# Need to quote COMMAND if setting ENV value or passing args.
390
-
cpl run:detached -a $APP_NAME --'LOG_LEVEL=warn rails db:migrate'
397
+
# Replaces the existing Dockerfile entrypoint with `bash`.
398
+
cpl run -a $APP_NAME --entrypoint none -- rails db:migrate
391
399
392
-
# Uses a different image (which may not be promoted yet).
393
-
cpl run:detached -a $APP_NAME --image appimage:123 -- rails db:migrate # Exact image name
0 commit comments