Skip to content

Actions ​

Run commands on demand against your live environments -- clear caches, export databases, run scripts, and more.

Defined in Code

Declare actions in .nebion.yml alongside your deployment tasks

Run from UI or CLI

Trigger actions with a click or from the terminal

Output & Downloads

View command output or download generated files (DB dumps, exports)

Access Controlled

Same permissions as environment access -- team members only

Defining Actions ​

Add an actions block to your .nebion.yml. Each action has a unique key (the machine name) and specifies which container to run in and what command to execute.

yaml
actions:
  cache-clear:
    name: "Clear Cache"
    service: php
    command: "drush cr"

  db-dump:
    name: "Database Dump"
    service: php
    command: "drush sql-dump --gzip > db-dump.sql.gz"
    artifacts:
      paths: ["db-dump.sql.gz"]

Actions become available after the next successful deployment. Nebion reads the actions block from your .nebion.yml during deploy and syncs the list to the environment.

Action Fields ​

FieldRequiredDefaultDescription
nameYes--Display name shown in the UI
serviceYes--Container to run the command in (must match a service in your compose file)
commandYes--Shell command to execute
artifactsNo--Declares downloadable output files: paths (glob list) and optional if-no-files -- see File Actions

Result Types ​

Output (default) -- The command's stdout is captured and displayed in the UI. Use this for cache clears, status checks, or any operation where you want to see the text output.

File -- Add an artifacts block and the declared files become downloadable after the run. Use this for database dumps, log exports, or any command that generates files you want to retrieve.

Output Actions ​

Actions without an artifacts block capture the command's stdout and display it directly.

yaml
actions:
  cache-clear:
    name: "Clear Cache"
    service: php
    command: "drush cr"

  status:
    name: "Drupal Status"
    service: php
    command: "drush status --format=table"

  check-permissions:
    name: "Check File Permissions"
    service: php
    command: "ls -la /var/www/html/sites/default/files"

Output is truncated to 64 KB. For longer output, check the full deployment logs.

File Actions ​

Actions can produce downloadable files -- database dumps, config exports, log archives. Declare which files your command produces with an artifacts block; Nebion collects them after the action finishes and makes them available behind the Download button.

yaml
actions:
  db-dump:
    name: "Database Dump"
    service: php
    command: "drush sql-dump --gzip > db-dump.sql.gz"
    artifacts:
      paths: ["db-dump.sql.gz"]

  export-files:
    name: "Export Uploads"
    service: php
    command: "tar -czf uploads.tar.gz -C /var/www/html/sites/default files"
    artifacts:
      paths: ["uploads.tar.gz"]

  backup:
    name: "Site Backup"
    service: php
    command: "mkdir -p out && bash scripts/backup.sh out"
    artifacts:
      paths: ["out/*.tar.gz", "out/*.sql.gz"]
      if-no-files: error

How it works:

  • paths is a list of glob patterns, relative to the directory your command runs in (the project root). After the command exits successfully, Nebion expands the patterns and collects every matching regular file.
  • Collected files are moved out of the environment into platform storage -- they do not stay in your checkout and never end up in the next build.
  • Your command controls the filenames -- timestamped names are fine; the actual names and sizes appear next to the Download button, one link per file when an action produces several.

Paths are relative and stay inside the project

paths entries must be relative (no leading /) and must not contain ... An action with invalid paths is disabled at catalog sync, with the reason shown in the UI.

When no files match ​

The if-no-files option controls what happens when the command succeeds but no file matches the declared paths:

ValueBehaviour
warn (default)Action succeeds; a notice is appended to its output
errorAction is marked as failed
ignoreNothing is reported

Migrating from result: file ​

The previous contract (result: file + $NEBION_ACTION_OUTPUT) is deprecated -- such actions are disabled at the next deploy with a hint. Point your command at any directory you like and declare it:

diff
-    command: "bash scripts/db-dump.sh $NEBION_ACTION_OUTPUT"
-    result: file
+    command: "mkdir -p out && bash scripts/db-dump.sh out"
+    artifacts:
+      paths: ["out/*.sql.gz"]

File Retention ​

Artifacts are stored per run on the deployment server and removed together with the environment. Time-based expiry is planned -- download files you need promptly.

Running Actions ​

From the UI ​

  1. Open your environment page and click the Actions tab
  2. Find the action you want to run and click Run
  3. Watch the status update from Pending to Running to Success (or Error)
  4. View the output or click Download for file actions

From the CLI ​

The action CLI command is not yet available. Actions can currently be triggered from the UI.
bash
# List available actions for an environment
nebioncli action list

# Run an action (interactive project/environment selection)
nebioncli action run cache-clear

# Run with explicit project and environment
nebioncli action run db-dump --project mysite --env pr-42

# Download the artifact from a file action
nebioncli action download db-dump

Concurrency ​

Only one action can run at a time per environment. If an action is already running, new triggers are rejected until it completes.

Actions are also blocked while a deployment is in progress -- wait for the deployment to finish before running an action.

Action Statuses ​

StatusMeaning
PendingAction has been triggered and is queued
RunningCommand is executing in the container
SuccessCommand completed successfully
ErrorCommand failed -- check the output for details

Examples ​

Drupal Project ​

yaml
docker-compose-yaml: docker-compose-nebion.yml
nginx_service: nginx

tasks:
  post-rollout:
    - name: Install dependencies
      command: composer install -o
      service: php
    - name: Run database updates
      command: drush updb -y
      service: php
    - name: Import configuration
      command: drush cim -y
      service: php
    - name: Clear caches
      command: drush cr
      service: php

actions:
  cache-clear:
    name: "Clear Cache"
    service: php
    command: "drush cr"

  db-dump:
    name: "Database Dump"
    service: php
    command: "drush sql-dump --gzip > db-dump.sql.gz"
    artifacts:
      paths: ["db-dump.sql.gz"]

  status:
    name: "Drupal Status"
    service: php
    command: "drush status --format=table"

  watchdog:
    name: "Recent Log Messages"
    service: php
    command: "drush watchdog:show --count=50"

Laravel Project ​

yaml
actions:
  cache-clear:
    name: "Clear All Caches"
    service: php
    command: "php artisan optimize:clear"

  db-dump:
    name: "Database Dump"
    service: php
    command: "mysqldump -h $DB_HOST -u $DB_USERNAME -p$DB_PASSWORD $DB_DATABASE | gzip > database.sql.gz"
    artifacts:
      paths: ["database.sql.gz"]

  migrate-status:
    name: "Migration Status"
    service: php
    command: "php artisan migrate:status"

  queue-status:
    name: "Queue Status"
    service: php
    command: "php artisan queue:monitor"

Node.js Project ​

yaml
actions:
  health-check:
    name: "Health Check"
    service: node
    command: "curl -s http://localhost:3000/health | jq ."

  seed-db:
    name: "Seed Database"
    service: node
    command: "npx prisma db seed"

  export-data:
    name: "Export Data"
    service: node
    command: "node scripts/export.js --output export.json"
    artifacts:
      paths: ["export.json"]

Troubleshooting ​

Action is grayed out / disabled

The action either still uses the deprecated result: file contract without an artifacts block, or its artifacts.paths is invalid (empty, absolute paths, or ..). The exact reason is shown in the UI tooltip -- update your .nebion.yml and redeploy.

Action fails immediately
  • Check that the service matches a running container in your docker-compose-nebion.yml
  • Check the action output for error messages from the command
  • Verify the command works when run manually via nebioncli ssh
No actions available

Actions are synced after each successful deployment. If you just added the actions block to .nebion.yml, redeploy the environment for actions to appear.

Download button missing
  • The action must declare an artifacts block with paths in .nebion.yml
  • The command must have completed successfully
  • At least one file must match artifacts.paths after the command finishes -- check the run output for a [nebion] No files matched notice
  • Artifacts are removed when the environment is deleted
"Action already running" error

Only one action can run per environment at a time. Wait for the current action to finish, then try again. Actions are also blocked during active deployments.