Skip to content

Running Ad-hoc Commands

Quant Cloud provides a powerful interface for executing one-time commands within your application environment. This feature is essential for debugging, running maintenance tasks, executing database migrations, or performing any utility operations without the need for SSH access or creating scheduled cron jobs.

The “Execute Command” interface allows you to run commands in temporary, isolated containers that have access to your application’s environment and configuration.

How Ad-hoc Commands Work

When you execute a command, Quant Cloud creates a temporary container specifically for that execution using your environment’s current configuration. This temporary container:

  • Uses the same container image as your running application
  • Inherits environment variables and secrets from your environment configuration
  • Has access to mounted persistent storage volumes defined in your environment
  • Runs completely isolated from your production containers
  • Is automatically destroyed after the command completes

Execution Process

  1. You submit a command through the interface
  2. A temporary container is provisioned with your environment’s configuration
  3. The command executes asynchronously in the isolated container
  4. Output (stdout/stderr) and exit codes are captured and displayed
  5. The temporary container is automatically cleaned up

Using the Command Interface

The “Run Ad-hoc Command” interface provides a straightforward form for executing commands in your environment.

Command Configuration

Command Input (Required) Enter the complete command and any arguments you want to execute. The interface accepts any valid shell command that would work within your container environment.

Common examples include:

  • ls -la /app - List application directory contents
  • php artisan migrate:status - Check Laravel migration status
  • npm run build - Execute build scripts
  • python manage.py shell - Access Django shell (non-interactive commands only)

Container Selection (Optional) For multi-container environments, choose which container should execute the command:

  • Dropdown Selection: Choose from available containers in your environment (e.g., php, web, worker)
  • Default Behavior: If left blank, commands execute in the primary/essential container
  • Container Context: The temporary container uses the selected container’s image and configuration

Executing Commands

Submit Execution Click “Execute Command” to start the asynchronous execution process. The interface will:

  • Validate your command input
  • Provision a temporary container
  • Begin command execution
  • Provide immediate feedback about the submission status

Execution Feedback After submitting a command:

  • The interface shows the execution has been initiated
  • A unique Run ID is generated for tracking
  • You can navigate away while the command continues executing
  • Results will be available through the command status interface

Command Execution Characteristics

Asynchronous Processing Commands execute asynchronously in the background, allowing you to:

  • Submit commands and navigate away from the interface
  • Execute multiple commands without waiting for completion
  • Return to check command status and results at any time

Resource and Time Considerations

  • Resource Limits: Commands inherit the resource limits defined in your environment’s task configuration
  • Execution Timeouts: Platform-defined limits prevent commands from running indefinitely
  • Non-Interactive Only: Commands requiring user input during execution will fail or timeout

Access and Permissions Temporary containers have the same access as your application containers:

  • Environment variables and secrets are available
  • Persistent storage volumes are mounted and accessible
  • Network access follows your environment’s configuration
  • Database connections work using configured credentials

Common Use Cases

Database Operations

  • Run database migrations: php artisan migrate
  • Check database status: php artisan migrate:status
  • Execute database seeders: python manage.py loaddata fixtures.json

Application Maintenance

  • Clear application caches: php artisan cache:clear
  • Generate application keys: php artisan key:generate
  • Compile assets: npm run production

Debugging and Inspection

  • Check file permissions: ls -la /app/storage
  • Verify environment configuration: env | grep APP_
  • Test database connectivity: php artisan tinker --execute="DB::connection()->getPdo();"

Data Processing

  • Import data files: python scripts/import_data.py
  • Generate reports: php artisan reports:generate
  • Process queued jobs manually: php artisan queue:work --once

Command execution provides a powerful way to interact with your application environment safely and efficiently, with full isolation from your production workloads.