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 > $NEBION_ACTION_OUTPUT/db-dump.sql.gz"
    result: file

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
resultNooutputResult type: output (show stdout) or file (produce a downloadable file)

Result Types

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

file -- The command produces a file that can be downloaded afterward. Use this for database dumps, log exports, or any command that generates a file you want to retrieve.

Output Actions

Actions with result: output (or no result field) 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 with result: file write a file to a special directory that Nebion makes available for download.

Use the $NEBION_ACTION_OUTPUT environment variable in your command -- it points to a temporary directory where your command should write its output file.

yaml
actions:
  db-dump:
    name: "Database Dump"
    service: php
    command: "drush sql-dump --gzip > $NEBION_ACTION_OUTPUT/db-dump.sql.gz"
    result: file

  export-files:
    name: "Export Uploads"
    service: php
    command: "tar -czf $NEBION_ACTION_OUTPUT/uploads.tar.gz /var/www/html/sites/default/files"
    result: file

  export-config:
    name: "Export Configuration"
    service: php
    command: "drush cex --destination=/tmp/config-export -y && tar -czf $NEBION_ACTION_OUTPUT/config.tar.gz -C /tmp config-export"
    result: file

After the action completes, a Download button appears in the UI next to the action run.

Use $NEBION_ACTION_OUTPUT

When result: file is set, your command must write to $NEBION_ACTION_OUTPUT. If the command does not reference this variable, the action is disabled with a message explaining why. You will see this immediately after deploying -- update your .nebion.yml to fix it.

Single file per action

Each action produces one output file. If you need to export multiple files, bundle them into an archive (e.g., tar -czf $NEBION_ACTION_OUTPUT/bundle.tar.gz file1 file2).

File Retention

Downloaded files are kept on the server for 7 days, then automatically cleaned up. Download any files you need before they expire.

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 > $NEBION_ACTION_OUTPUT/db-dump.sql.gz"
    result: file

  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 > $NEBION_ACTION_OUTPUT/database.sql.gz"
    result: file

  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 $NEBION_ACTION_OUTPUT/export.json"
    result: file

Troubleshooting

Action is grayed out / disabled

The action has result: file but the command does not reference $NEBION_ACTION_OUTPUT. Update your .nebion.yml to write the output file to $NEBION_ACTION_OUTPUT 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 have result: file set in .nebion.yml
  • The command must have completed successfully
  • The file must exist in $NEBION_ACTION_OUTPUT after the command finishes
  • Files are automatically removed after 7 days
"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.