### Full Example with Supervisord Restart Task Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/supervisord-monitor.md A complete Deployer configuration example including application setup, repository, supervisord settings, hosts, build task, and a deployment task that includes restarting supervisord processes on production. ```php 'https://youruri.xyz/supervisor', 'basic_auth_user' => 'username', 'basic_auth_password' => 'password', 'process_name' => 'process01', ]); host('staging.myproject.com') ->set('branch', 'develop') ->set('labels', ['stage' => 'staging']); host('myproject.com') ->set('branch', 'main') ->set('labels', ['stage' => 'production']); // Tasks task('build', function () { run('cd {{release_path}} && build'); }); task('deploy', [ 'build', 'supervisord', ]); task('supervisord', ['supervisord-monitor:restart']) ->select('stage=production'); ``` -------------------------------- ### Quick MAML Recipe Example Source: https://github.com/deployphp/deployer/blob/master/docs/maml.md A basic MAML recipe demonstrating imports, configuration, host definitions, tasks, and after hooks. This serves as a starting point for creating Deployer recipes. ```maml { # Import other recipes (php, maml, or yaml). import: [ "recipe/common.php" ] config: { repository: "git@github.com:example/example.com.git" } hosts: { "example.com": { remote_user: "deployer" deploy_path: "~/example" } } tasks: { # Build the project build: [ { cd: "{{release_path}}" } { run: "npm ci" } { run: "npm run build" } ] } after: { "deploy:failed": "deploy:unlock" } } ``` -------------------------------- ### Include Setup Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/setup.md Include the setup recipe to prepare hosts for deployment. This is typically done at the beginning of your deployment configuration. ```php require 'recipe/deploy/setup.php'; ``` -------------------------------- ### Run deploy:setup Task Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/setup.md Execute the 'deploy:setup' task to prepare the host for deployment. This task ensures the necessary directory structure and permissions are in place. ```bash deploy:setup ``` -------------------------------- ### Filter Hosts by Labels Command Line Example Source: https://github.com/deployphp/deployer/blob/master/docs/hosts.md Shows an example of how to filter hosts using labels directly from the command line with Deployer. ```sh $ dep deploy stage=prod&role=web,role=special ``` -------------------------------- ### Full Deployer Example with Cpanel Integration Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/cpanel.md Complete Deployer configuration including cPanel tasks for creating addon domains and databases. This example sets up a staging environment with a unique domain and database for a specific branch. ```php load(); // this is used just so an .env file can be used for credentials require 'cpanel.php'; // Project name set('application', 'myproject.com'); // Project repository set('repository', 'git@github.com:myorg/myproject.com'); set('cpanel', [ 'host' => getenv('CPANEL_HOST'), 'port' => getenv('CPANEL_PORT'), 'username' => getenv('CPANEL_USERNAME'), 'auth_type' => getenv('CPANEL_AUTH_TYPE'), 'token' => getenv('CPANEL_TOKEN'), 'user' => getenv('CPANEL_USER'), 'db_user' => getenv('CPANEL_DB_USER'), 'db_user_privileges' => getenv('CPANEL_DB_PRIVILEGES'), 'timeout' => 500, 'allowInStage' => ['staging', 'beta', 'alpha'], 'create_domain_format' => '%s-%s-%s', 'create_domain_values' => ['staging', 'master', get('application')], 'subdomain_prefix' => substr(md5(get('application')), 0,4) . '-', 'subdomain_suffix' => getenv('SUDOMAIN_SUFFIX'), 'create_db_format' => '%s_%s-%s-%s', 'create_db_values' => ['apps', 'staging','master', get('application')], ]); host('myproject.com') ->stage('staging') ->set('cpanel_createdb', vsprintf(get('cpanel')['create_db_format'], get('cpanel')['create_db_values'])) ->set('branch', 'dev-branch') ->set('deploy_path', '~/staging/' . vsprintf(get('cpanel')['create_domain_format'], get('cpanel')['create_domain_values'])) ->set('addondir', 'staging/' . vsprintf(get('cpanel')['create_domain_format'], get('cpanel')['create_domain_values'])); // Tasks task('build', function () { run('cd {{release_path}} && build'); }); after('deploy:prepare', 'cpanel:createaddondomain'); after('deploy:prepare', 'cpanel:createdb'); ``` -------------------------------- ### Initialize Deployer Recipe for Project Installation Source: https://github.com/deployphp/deployer/blob/master/docs/installation.md Initialize the deploy.php recipe when Deployer is installed per project. Use this command to set up the configuration file. ```sh vendor/bin/dep init ``` -------------------------------- ### Example Deployer YAML Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/yaml.md This is a basic example of a Deployer recipe written in YAML. It demonstrates importing another recipe, setting configuration options like the repository and remote user, defining hosts with their deployment paths, and specifying build tasks. ```yaml import: - recipe/laravel.php config: repository: "git@github.com:example/example.com.git" remote_user: deployer hosts: example.com: deploy_path: "~/example" tasks: build: - cd: "{{release_path}}" - run: "npm run build" after: deploy:failed: deploy:unlock ``` -------------------------------- ### Running a Task Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Example of how to execute a defined task from the command line. ```sh $ dep my_task ``` -------------------------------- ### Global Configuration Example Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Illustrates setting a global configuration value that is inherited by all hosts. ```php set('my_config', 'global'); host('deployer.org'); host('medv.io'); ``` -------------------------------- ### Global Installation with Composer Source: https://github.com/deployphp/deployer/blob/master/docs/installation.md Install Deployer globally using Composer for everyday use. Ensure Composer's global bin directory is in your PATH. ```sh composer global require deployer/deployer ``` -------------------------------- ### Minimal Recipe Example Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md A minimal Deployer recipe defining a host and a simple task that runs the 'whoami' command. ```php namespace Deployer; host('deployer.org'); task('my_task', function () { run('whoami'); }); ``` -------------------------------- ### Cpanel .env File Example Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/cpanel.md Example .env file for cPanel configuration. Ensure sensitive information like tokens are kept secure. ```dotenv CPANEL_HOST=xxx.xxx.xxx.xxx CPANEL_PORT=2087 CPANEL_USERNAME=root CPANEL_TOKEN=xxxx CPANEL_USER=xxx CPANEL_AUTH_TYPE=hash CPANEL_DB_USER=db_user CPANEL_DB_PRIVILEGES="ALL PRIVILEGES" SUDOMAIN_SUFFIX=.mymaindomain.com ``` -------------------------------- ### Install Shell Completion (macOS) Source: https://github.com/deployphp/deployer/blob/master/docs/cli.md Install bash-completion and set up shell completion for Deployer on macOS. ```bash brew install bash-completion dep completion bash > /usr/local/etc/bash_completion.d/deployer ``` -------------------------------- ### Global Installation with Phive Source: https://github.com/deployphp/deployer/blob/master/docs/installation.md Install Deployer globally using Phive. This is an alternative to Composer for global installations. ```sh phive install deployer ``` -------------------------------- ### Setup Ms-teams Webhook and Notifications Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/ms-teams.md Configure the MS Teams webhook URL and set up notification tasks for deployment start, success, and failure. ```php require 'contrib/ms-teams.php'; set('teams_webhook', 'https://outlook.office.com/webhook/...'); ``` ```php before('deploy', 'teams:notify'); after('deploy:success', 'teams:notify:success'); after('deploy:failed', 'teams:notify:failure'); ``` -------------------------------- ### Composer Install Options for TYPO3 Production Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/typo3.md Configures options for the `composer install` command when deploying to production. These options optimize the installation for performance and security. ```php ' --no-dev --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader' ``` -------------------------------- ### Magento 2 Compile Configuration Example Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/magento2.md Example configuration for Magento 2 compilation in production mode. Ensure this is set correctly for artifact deployment. ```php 'MAGE_MODE' => 'production' ``` -------------------------------- ### Composer Action Configuration Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/vendors.md Sets the default action for Composer. Use 'install' to install dependencies. ```php 'install' ``` -------------------------------- ### Configure Yarn or npm Installation Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/webpack_encore.md Specify the package manager to use for installing dependencies. Deployer attempts to auto-detect, but explicit configuration is supported. ```php after('deploy:update_code', 'yarn:install'); ``` ```php after('deploy:update_code', 'npm:install'); ``` -------------------------------- ### Per-Host Dynamic Configuration Example Output Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Shows the output demonstrating the per-host caching of dynamic configuration values. ```sh $ dep my_task deployer.org -v ``` -------------------------------- ### Default Dotenv Example File Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/spiral.md Specifies the default example file for environment variables in a Spiral project. Deployer uses this to manage `.env` files during deployment. ```php '.env.sample' ``` -------------------------------- ### Project Installation with Composer Source: https://github.com/deployphp/deployer/blob/master/docs/installation.md Install Deployer as a development dependency within your project using Composer. This pins the version for CI/CD environments. ```sh composer require --dev deployer/deployer ``` -------------------------------- ### Initialize Deployer Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/installation.md Initialize the deploy.php recipe in your project after global installation. This command sets up the necessary configuration file. ```sh dep init ``` -------------------------------- ### Cpanel Configuration Example Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/cpanel.md Configure cPanel integration using environment variables or direct values. Ensure 'subdomain_suffix' matches your main domain for proper deletion. ```php set('cpanel', [ 'host' => getenv('CPANEL_HOST'), 'port' => getenv('CPANEL_PORT'), 'username' => getenv('CPANEL_USERNAME'), 'auth_type' => getenv('CPANEL_AUTH_TYPE'), 'token' => getenv('CPANEL_TOKEN'), 'user' => getenv('CPANEL_USER'), 'db_user' => getenv('CPANEL_DB_USER'), 'db_user_privileges' => getenv('CPANEL_DB_PRIVILEGES'), 'timeout' => 500, 'allowInStage' => ['staging', 'beta', 'alpha'], 'create_domain_format' => '%s-%s-%s', 'create_domain_values' => ['staging', 'master', get('application')], 'subdomain_prefix' => substr(md5(get('application')), 0,4) . '-', 'subdomain_suffix' => getenv('SUDOMAIN_SUFFIX'), 'create_db_format' => '%s_%s-%s-%s', 'create_db_values' => ['apps', 'staging','master', get('application')], ]); ``` -------------------------------- ### Start Supervisord Process Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/supervisord-monitor.md Task to start a supervisord process. This task is part of the supervisord-monitor recipe. ```php task('supervisord-monitor:start', function () { invoke('supervisord-monitor:start'); }); ``` -------------------------------- ### Dynamic Configuration Execution Example Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Shows the output when a task uses a dynamically evaluated configuration value. ```sh $ dep my_task all ``` -------------------------------- ### Deploy TYPO3 to Production using Git Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/typo3.md Example command to deploy a TYPO3 project to a production environment using Git as the source control. ```bash vendor/bin/dep deploy production ``` -------------------------------- ### Configuring Repository and Release Settings Source: https://github.com/deployphp/deployer/blob/master/docs/maml.md Example of the `config` section in a MAML recipe, setting deployment-related configurations like the repository URL, number of releases to keep, and shared directories. ```maml { config: { repository: "git@github.com:example/example.com.git" keep_releases: 5 ssh_multiplexing: true shared_dirs: ["storage", "bootstrap/cache"] } } ``` -------------------------------- ### Running Task on All Hosts Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Example of running a task on all defined hosts with increased verbosity. ```sh $ dep my_task -v all ``` -------------------------------- ### Notify on Deployment Start Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/ntfy.md Add this line to only notify about the beginning of a deployment. ```php before('deploy', 'ntfy:notify'); ``` -------------------------------- ### Deploy TYPO3 to Staging using Rsync Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/typo3.md Example command to deploy a TYPO3 project to a staging environment using rsync. Ensure 'use_rsync' is set to true in your configuration. ```bash # In deploy.php or servers config, enable rsync set('use_rsync', true); vendor/bin/dep deploy staging ``` -------------------------------- ### Rsync Warmup Task Configuration Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/rsync.md Example of adding the 'rsync:warmup' task to the deploy sequence. This task can be run before or after the 'rsync' task, depending on convenience. ```php task('deploy', [ 'deploy:prepare', 'deploy:release', 'rsync:warmup', 'rsync', 'deploy:vendors', 'deploy:symlink', ])->desc('Deploy your project'); ``` -------------------------------- ### Include Raygun Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/raygun.md Include the Raygun recipe file in your Deployer setup. ```php require 'contrib/raygun.php'; ``` -------------------------------- ### get() Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Retrieves a configuration value by its name, with an optional default value. ```APIDOC ## get() ### Description Retrieves a configuration value by its name. If the configuration option is not set, it returns the provided default value. Callable values are resolved and cached upon first access. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **$name**: (string) - The name of the configuration option to retrieve. - **$default**: (mixed) - The default value to return if the option is not set. Defaults to `null`. ### Request Example ```php $branch = get('branch', 'main'); ``` ### Response #### Success Response - **mixed**: The value of the configuration option, or the default value if not set. #### Response Example ```json { "config_value": "main" } ``` ``` -------------------------------- ### Add Build Step to deploy.php Source: https://github.com/deployphp/deployer/blob/master/docs/getting-started.md Define a 'build' task in deploy.php and hook it after code updates to handle build processes like npm installs. ```php task('build', function () { cd('{{release_path}}'); run('npm install'); run('npm run prod'); }); after('deploy:update_code', 'build'); ``` -------------------------------- ### Local Deploy Rsync Configuration Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/rsync.md Example configuration for rsync when using a local deploy recipe. It specifies a local source path and a remote destination path. ```php host('hostname') ->hostname('10.10.10.10') ->port(22) ->set('deploy_path','/your/remote/path/app') ->set('rsync_src', '/your/local/path/app') ->set('rsync_dest','{{release_path}}'); ``` -------------------------------- ### Nginx Web Server Configuration Source: https://github.com/deployphp/deployer/blob/master/docs/getting-started.md Example Nginx configuration to point your web server at the 'current' deployment directory. ```nginx root /home/deployer/example/current/public; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } ``` -------------------------------- ### Provision the Server Source: https://github.com/deployphp/deployer/blob/master/docs/getting-started.md Execute the provision command to set up your server. This command takes about 5 minutes. ```sh dep provision ``` -------------------------------- ### MAML Host Configuration with Labels Source: https://github.com/deployphp/deployer/blob/master/docs/selector.md Example of defining host configurations in MAML, including environment variables and labels. Note the distinction between 'env' configuration and 'labels.env'. ```maml { hosts: { "web.example.com": { remote_user: "deployer" env: { environment: "production" } labels: { env: "prod" } } } } ``` -------------------------------- ### Get Default Statamic Version Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/statamic.md Retrieves the default Statamic version installed in your project. This is useful for verifying compatibility or for conditional logic in your deployment script. ```php $result = run('{{bin/php}} {{release_or_current_path}}/please --version'); preg_match_all('/(\d+\.?)+/', $result, $matches); return $matches[0][0] ?? 'unknown'; ``` -------------------------------- ### Notify Ms-teams on Deployment Start Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/ms-teams.md Add this line to notify MS Teams only about the beginning of a deployment. ```php before('deploy', 'teams:notify'); ``` -------------------------------- ### Lock Contao Install Tool Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/contao.md Locks the Contao Install Tool. This is useful if you do not intend to use the Install Tool. ```php task('contao:install:lock'); ``` -------------------------------- ### Deploy Your Project Source: https://github.com/deployphp/deployer/blob/master/docs/getting-started.md Run the deploy command to deploy your project to the provisioned server. Check for missing .env or credentials on failure. ```sh dep deploy ``` -------------------------------- ### Setup Ntfy Notifications Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/ntfy.md Configure your deploy.php to use ntfy.sh for deployment notifications. This involves setting the topic and registering tasks for different deployment stages. ```php require 'contrib/ntfy.php'; set('ntfy_topic', 'ntfy.sh/mytopic'); ``` ```php before('deploy', 'ntfy:notify'); after('deploy:success', 'ntfy:notify:success'); after('deploy:failed', 'ntfy:notify:failure'); ``` -------------------------------- ### Accessing Host Configuration within Task (get) Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md A shorter way to access host-specific configuration values within a task using get(). ```php task('my_task', function () { $myConfig = get('my_config'); writeln("my_config: " . $myConfig); }); ``` -------------------------------- ### Rsync Task in Deploy Sequence Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/rsync.md Example of how to include the 'rsync' task in your deploy sequence. This task should be used instead of 'deploy:update_code' when Git is not available. ```php task('deploy', [ 'deploy:prepare', 'deploy:release', 'rsync', 'deploy:vendors', 'deploy:symlink', ])->desc('Deploy your project'); ``` -------------------------------- ### Default .env.example Path Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/env.md Specifies the default path for the .env.example file. This is used to load environment variables during deployment. ```php '.env.example' ``` -------------------------------- ### Display Deployer Execution Plan Source: https://github.com/deployphp/deployer/blob/master/docs/cli.md Use the --plan option with a task to see the execution order for all hosts without executing any tasks. This helps visualize the deployment steps. ```bash $ dep deploy --plan all ``` -------------------------------- ### Initialize Deployer from Phar File Source: https://github.com/deployphp/deployer/blob/master/docs/installation.md Initialize the deploy.php recipe using the downloaded Deployer Phar file. This method does not require Composer. ```sh php deployer.phar init ``` -------------------------------- ### Install Magento 2 Cron Jobs Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/magento2.md Installs Magento 2 cron jobs into the system's crontab. This is usually performed after upgrading the Magento application. ```php after('magento:upgrade', 'magento:cron:install'); ``` -------------------------------- ### Configuring Host-Specific Settings Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Shows how to set configuration options for individual hosts. ```php host('deployer.org')->set('my_config', 'foo'); host('medv.io')->set('my_config', 'bar'); ``` -------------------------------- ### Update `env()` to `set()`/`get()` (3.x to 4.x) Source: https://github.com/deployphp/deployer/blob/master/docs/UPGRADE.md In v4, `env()` is replaced by `set()` for setting values and `get()` for retrieving them. This applies to both global and server-specific configurations. ```php env($name, $value) -> set($name, $value) ``` ```php env($name) -> get($name) ``` ```php server(...)->env(...) -> server(...)->set(...) ``` -------------------------------- ### Configure Yarn Tasks Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/yarn.md Configure the order of Yarn tasks within your deployment process. Use 'yarn:install' to install dependencies and 'yarn:build' to build your project. ```php after('deploy:update_code', 'yarn:install'); after('yarn:install', 'yarn:build'); ``` -------------------------------- ### Get Configuration Value Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Retrieve a configuration value using `get()`. It accepts an optional default value to return if the configuration option is not set. Callable values are resolved and cached. ```php $branch = get('branch', 'main'); ``` -------------------------------- ### Include Info Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/info.md Include the info recipe to enable the deploy:info task. ```php require 'recipe/deploy/info.php'; ``` -------------------------------- ### Check Command Existence Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Use `commandExist()` to determine if a specific command is available in the current host's PATH. This is crucial for ensuring necessary tools are installed before proceeding with deployment steps. ```php if (!commandExist('git')) { throw error('git is required to deploy'); } ``` -------------------------------- ### Defining Multiple Hosts Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Shows how to define multiple hosts within a single Deployer recipe. ```php host('deployer.org'); host('medv.io'); ``` -------------------------------- ### Advanced Rsync Configuration with Exclude File Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/rsync.md An example of advanced rsync configuration using an exclude file and additional flags/options for specific deployment needs. Note the use of an absolute path for the exclude-file. ```php set('rsync',[ 'exclude' => ['excludes_file'], 'exclude-file' => '/tmp/localdeploys/excludes_file', //Use absolute path to avoid possible rsync problems 'include' => [], 'include-file' => false, 'filter' => [], 'filter-file' => false, 'filter-perdir' => false, 'flags' => 'rzcE', // Recursive, with compress, check based on checksum rather than time/size, preserve Executable flag 'options' => ['delete', 'delete-after', 'force'], //Delete after successful transfer, delete even if deleted dir is not empty 'timeout' => 3600, //for those huge repos or crappy connection ]); ``` -------------------------------- ### Configuring Localhost for Development Source: https://github.com/deployphp/deployer/blob/master/docs/maml.md Demonstrates how to define a local development environment using the `local: true` option within the `hosts` section. This configures Deployer to use `localhost()`. ```maml { hosts: { "dev": { local: true deploy_path: "/tmp/dev" } } } ``` -------------------------------- ### Include Databases Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/provision/databases.md Include the databases recipe to enable database provisioning tasks. ```php require 'recipe/provision/databases.php'; ``` -------------------------------- ### Include Supervisord-monitor Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/supervisord-monitor.md Include the supervisord-monitor.php file to enable its functionality. ```php require 'contrib/supervisord-monitor.php'; ``` -------------------------------- ### Get lsb_release Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/provision.md Retrieves the lsb_release codename, typically 'focal' for Ubuntu 20.04 LTS. ```php return run("lsb_release -s -c"); ``` -------------------------------- ### Basic CLI Command Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Demonstrates the basic command structure for running a task on a specific host. ```sh $ dep deploy deployer.org ``` -------------------------------- ### Set Node.js Version Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/provision/nodejs.md Configure the Node.js version to install. Defaults to the latest LTS version. ```php '--lts' ``` -------------------------------- ### option() Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Adds a CLI option to the `dep` binary. Includes details on name, shortcut, mode, description, and default value. ```APIDOC ## option() ### Description Add a CLI option to the `dep` binary. ### Method Signature ```php option(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null): void ``` ### Parameters #### Arguments - `$name` (string) - Option name (long form, no leading dashes). - `$shortcut` (string or array or null) - Single-letter shortcut, `|`-separated list, or array of shortcuts. - `$mode` (int or null) - One of the `InputOption::VALUE_*` constants. - `$description` (string) - Help text shown in `dep --help`. - `$default` (string or string[] or int or bool or null) - Default value (must be null for `VALUE_NONE`). ### Usage Examples ```php use Symfony\Component\Console\Input\InputOption; option('tag', null, InputOption::VALUE_REQUIRED, 'Release tag'); task('deploy', function () { $tag = input()->getOption('tag'); }); ``` ``` -------------------------------- ### Run Command Step with Options Source: https://github.com/deployphp/deployer/blob/master/docs/maml.md Execute a command on the remote host with various options including working directory, environment variables, secrets, and timeouts. ```maml { "run": "php artisan migrate --force", "cwd": "{{release_path}}", "env": { "APP_ENV": "production" }, "secrets": { "DB_PASSWORD": "s3cret" }, "timeout": 600, "idleTimeout": 120, "nothrow": false, "forceOutput": true } ``` -------------------------------- ### Add Workplace Notification Hook Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/workplace.md Add a hook to send notifications to Workplace before deployment starts. ```bash before('deploy', 'workplace:notify'); ``` -------------------------------- ### Run Task with Simple Selector Source: https://github.com/deployphp/deployer/blob/master/docs/selector.md Execute the 'info' task on hosts matching the 'env=prod' label. This demonstrates basic label-based selection. ```bash $ dep info env=prod ``` -------------------------------- ### Add Slack Notification Hook Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/slack.md Add a hook to trigger Slack notifications before deployment starts. ```php before('deploy', 'slack:notify'); ``` -------------------------------- ### Specifying Recipe File Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Shows how to specify a custom recipe file using the -f or --file flags. ```sh $ dep --file=deploy.php deploy deployer.org ``` -------------------------------- ### First Deployment with Release Name Source: https://github.com/deployphp/deployer/blob/master/docs/UPGRADE.md For the initial v7 deployment, manually specify the `release_name` to ensure correct numbering. ```bash dep deploy -o release_name=43 ``` -------------------------------- ### Add Chat Notification Hook Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/hangouts.md Add a hook to send chat notifications before deployment starts. ```php before('deploy', 'chat:notify'); ``` -------------------------------- ### Add Discord Notification Hook Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/discord.md Add a hook to trigger Discord notifications before deployment starts. ```php before('deploy', 'discord:notify'); ``` -------------------------------- ### Define a Basic Host Source: https://github.com/deployphp/deployer/blob/master/docs/hosts.md Defines a single host with its alias. This is the most basic way to register a host in Deployer. ```php host('example.org'); ``` -------------------------------- ### Deploy Vendors Task Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/vendors.md The 'deploy:vendors' task is responsible for installing project dependencies using Composer. ```php deploy:vendors ``` -------------------------------- ### Get Current Host Source: https://github.com/deployphp/deployer/blob/master/docs/api.md The `currentHost()` function returns the `Host` instance for the host the current task is executing on. ```php task('whoami', function () { writeln(currentHost()->getAlias()); }); ``` -------------------------------- ### Import Configuration and Recipes Source: https://github.com/deployphp/deployer/blob/master/docs/UPGRADE.md Replace `inventory()` with `import()` to include hosts, configs, and tasks from external files. ```yaml import: recipe/common.php config: application: deployer shared_dirs: - uploads - storage/logs/ - storage/db shared_files: - .env - config/test.yaml keep_releases: 3 http_user: false hosts: prod: local: true tasks: deploy: - deploy:prepare - deploy:vendors - deploy:publish deploy:vendors: - run: "cd {{release_path}} && echo {{bin/composer}} {{composer_options}} 2>&1" ``` -------------------------------- ### Get Crontab Binary Path Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/crontab.md Retrieves the system path for the 'crontab' binary. This is used internally by the recipe. ```php return which('crontab'); ``` -------------------------------- ### Include Website Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/provision/website.md Include the website recipe to enable website provisioning tasks. ```php require 'recipe/provision/website.php'; ``` -------------------------------- ### Set Magento Directory Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/magento2.md Define the Magento installation directory relative to the repository root. Defaults to '.' (current directory). ```php '.' ``` -------------------------------- ### Configure Host in deploy.php Source: https://github.com/deployphp/deployer/blob/master/docs/getting-started.md Define a host with essential settings like remote user and deploy path in your deploy.php file. ```php host('example.org') ->set('remote_user', 'deployer') ->set('deploy_path', '~/example'); ``` -------------------------------- ### Composer Binary Path Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/vendors.md Automatically determines the Composer binary path. If not found, it attempts to install Composer to `.dep/composer.phar`. ```php bin/composer ``` -------------------------------- ### Chain Npm Tasks Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/npm.md Chain npm install and npm build tasks after code deployment or other npm tasks. ```php after('deploy:update_code', 'npm:install'); after('npm:install', 'npm:build'); ``` -------------------------------- ### Lock Deployment Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/lock.md Use the `deploy:lock` task to prevent concurrent deployments. This task should be called before starting a deployment. ```bash dep deploy:lock ``` -------------------------------- ### Download Files/Directories Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Use `download()` to retrieve files or directories from the current host via rsync. The configuration options for `upload()` are also applicable here. ```php download('{{deploy_path}}/.dep/database.sql', 'backup/database.sql'); ``` -------------------------------- ### Get Selected Hosts Source: https://github.com/deployphp/deployer/blob/master/docs/api.md The `selectedHosts()` function returns an array of hosts that the user explicitly picked on the command line. ```php selectedHosts(): array ``` -------------------------------- ### Lazy Evaluation for CLI Overrides Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Explains the difference between direct `get()` and lazy callbacks when using CLI overrides. ```php set('dir_name', 'test'); // Evaluated at recipe load — captures the default, ignores -o overrides. set('uses_original_dir_name', '/path/to/' . get('dir_name')); // Evaluated lazily — sees the overridden value. set('uses_overridden_dir_name', function () { return '/path/to/' . get('dir_name'); }); task('my_task', function () { writeln('Path: {{uses_original_dir_name}}'); writeln('Path: {{uses_overridden_dir_name}}'); }); ``` -------------------------------- ### ask() Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Prompts the user for a string input on the current host, with an optional default and autocomplete suggestions. ```APIDOC ## ask() ### Description Prompts the user for a string input on the current host. It supports providing a default value and an array of autocomplete suggestions. In quiet mode (`-q`), it returns the default value. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **$message**: (string) - The prompt message to display to the user. - **$default**: (string|null) - The default value to use if the user provides no input. Defaults to `null`. - **$autocomplete**: (array|null) - An array of strings for autocomplete suggestions. Defaults to `null`. ### Request Example ```php $branch = ask('Branch to deploy?', 'main'); $tag = ask('Tag?', null, ['v1.0', 'v1.1', 'v1.2']); ``` ### Response #### Success Response - **?string**: The user's input string, or the default value if provided and no input was given, or `null` if no default was set and no input was given. #### Response Example ```json { "user_input": "develop" } ``` ``` -------------------------------- ### Deployer Execution Plan Table Source: https://github.com/deployphp/deployer/blob/master/docs/cli.md This is the visual output of the --plan command, showing the task execution order for multiple hosts. It helps in understanding task dependencies and distribution. ```text ┌──────────────────────┬──────────────────────┬──────────────────────┬──────────────────────┐ │ prod01 │ prod02 │ prod03 │ prod04 │ ├──────────────────────┼──────────────────────┼──────────────────────┼──────────────────────┤ │ deploy:info │ deploy:info │ deploy:info │ deploy:info │ │ deploy:setup │ deploy:setup │ deploy:setup │ deploy:setup │ │ deploy:lock │ deploy:lock │ deploy:lock │ deploy:lock │ │ deploy:release │ deploy:release │ deploy:release │ deploy:release │ │ deploy:update_code │ deploy:update_code │ deploy:update_code │ deploy:update_code │ │ build │ build │ build │ build │ │ deploy:shared │ deploy:shared │ deploy:shared │ deploy:shared │ │ deploy:writable │ deploy:writable │ deploy:writable │ deploy:writable │ │ deploy:vendors │ deploy:vendors │ deploy:vendors │ deploy:vendors │ │ artisan:storage:link │ artisan:storage:link │ artisan:storage:link │ artisan:storage:link │ │ artisan:config:cache │ artisan:config:cache │ artisan:config:cache │ artisan:config:cache │ │ artisan:route:cache │ artisan:route:cache │ artisan:route:cache │ artisan:route:cache │ │ artisan:view:cache │ artisan:view:cache │ artisan:view:cache │ artisan:view:cache │ │ artisan:migrate │ artisan:migrate │ artisan:migrate │ artisan:migrate │ │ deploy:symlink │ - │ - │ - │ │ - │ deploy:symlink │ - │ - │ │ - │ - │ deploy:symlink │ - │ │ - │ - │ - │ deploy:symlink │ │ deploy:unlock │ deploy:unlock │ deploy:unlock │ deploy:unlock │ │ deploy:cleanup │ deploy:cleanup │ deploy:cleanup │ deploy:cleanup │ │ deploy:success │ deploy:success │ deploy:success │ deploy:success │ └──────────────────────┴──────────────────────┴──────────────────────┴──────────────────────┘ ``` -------------------------------- ### Add Crontab Job Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/crontab.md Add a crontab job to be synchronized. This example adds a job to run a Laravel scheduler. ```php require 'contrib/crontab.php'; after('deploy:success', 'crontab:sync'); add('crontab:jobs', [ '* * * * * cd {{current_path}} && {{bin/php}} artisan schedule:run >> /dev/null 2>&1', ]); ``` -------------------------------- ### Notify Telegram on Deployment Start Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/telegram.md This task notifies Telegram when a deployment begins. It should be called using `before('deploy', 'telegram:notify');`. ```php task('telegram:notify', function () { if (!get('telegram_token') || !get('telegram_chat_id')) { writeln('You must set telegram_token and telegram_chat_id.'); return; } $text = get('telegram_text', '_{{user}}_ deploying `{{what}}` to *{{where}}*'); $text = parse("{$text}"); try { send('telegram', $text); } catch (Exception $e) { // Ignore } }); ``` -------------------------------- ### Multiple Aliases as Selector Source: https://github.com/deployphp/deployer/blob/master/docs/selector.md Shows how multiple host aliases can be specified, equivalent to using 'alias=...' for each. ```bash $ dep info 'web.example.com' 'db.example.com' ``` -------------------------------- ### Set Multiple Host Labels for Fleet Management Source: https://github.com/deployphp/deployer/blob/master/docs/hosts.md Demonstrates setting multiple labels for various hosts, including ranges, to manage complex server fleets. ```php host('admin.example.org')->setLabels(['stage' => 'prod', 'role' => 'web']); host('web[1:5].example.org')->setLabels(['stage' => 'prod', 'role' => 'web']); host('db[1:2].example.org')->setLabels(['stage' => 'prod', 'role' => 'db']); host('test.example.org')->setLabels(['stage' => 'test', 'role' => 'web']); host('special.example.org')->setLabels(['role' => 'special']); ``` -------------------------------- ### Hook Task Before Another Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Use the `before()` function to execute a task or callback before a specified task. This is useful for setup or pre-flight checks. ```php before('deploy:symlink', 'deploy:cache:warmup'); before('deploy:symlink', function () { run('echo about to symlink'); }); ``` -------------------------------- ### Configure specific Composer version Source: https://github.com/deployphp/deployer/blob/master/docs/UPGRADE.md Use the `composer_version` configuration option to specify a particular version of Composer to be installed on the remote host. ```php set('composer_version', '2.7'); ``` -------------------------------- ### Add Yammer Notification Hook Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/yammer.md Add a hook to notify Yammer at the beginning of the deployment process. This ensures you are informed when a deployment starts. ```php before('deploy', 'yammer:notify'); ``` -------------------------------- ### Include PHP Provisioning Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/provision/php.md Include the PHP provisioning recipe to enable PHP-related tasks. ```php require 'recipe/provision/php.php'; ``` -------------------------------- ### Add Telegram Notification Hook Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/telegram.md Add a hook to notify via Telegram before the deployment starts. Ensure you have configured the `telegram_token` and `telegram_chat_id`. ```php before('deploy', 'telegram:notify'); ``` -------------------------------- ### Configure Npm Binary Path Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/npm.md Set the path to the npm binary if it's not in your system's PATH. Defaults to detecting 'npm' automatically. ```php return which('npm'); ``` -------------------------------- ### Add Rocket.Chat Notification Hook Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/rocketchat.md Add the 'rocketchat:notify' task to be executed before the 'deploy' stage to send notifications at the start of a deployment. ```php before('deploy', 'rocketchat:notify'); ``` -------------------------------- ### Include Push Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/push.md Include the push recipe to enable the push functionality. This is typically done at the beginning of your Deployer configuration file. ```php require 'recipe/deploy/push.php'; ``` -------------------------------- ### Access Host Information in Task Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Within a task, you can retrieve host-specific information using the `host()` function to get the `Host` instance. ```php task('test', function () { $port = host('example.org')->get('port'); }); ``` -------------------------------- ### Lazy Evaluation CLI Override Example Output Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Shows the output when using lazy evaluation with CLI overrides for configuration values. ```sh $ dep my_task deployer.org -v -o dir_name="prod" ``` -------------------------------- ### Selector Syntax: AND Source: https://github.com/deployphp/deployer/blob/master/docs/selector.md Demonstrates the AND operator (&) in selectors. This command selects hosts that have both 'type=web' AND 'env=prod' labels. ```bash $ dep info 'type=web & env=prod' ``` -------------------------------- ### Include User Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/provision/user.md Include the user provisioning recipe to enable user-related tasks. ```php require 'recipe/provision/user.php'; ``` -------------------------------- ### Composer Options Configuration Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/vendors.md Specifies default options for Composer commands. These options are verbose, prefer optimized installations, and disable development dependencies. ```php '--verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader' ``` -------------------------------- ### Download File Step Source: https://github.com/deployphp/deployer/blob/master/docs/maml.md Pull a file from the remote host to the local machine. Specify the source path on the host and the destination path locally. ```maml { "download": { "src": "{{deploy_path}}/shared/.env", "dest": ".env.production" } } ``` -------------------------------- ### CakePHP Main Deploy Task Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/cakephp.md The main deploy task for CakePHP projects, orchestrating preparation, vendor installation, initialization, migrations, and publishing. ```php task('deploy', [ 'deploy:prepare', 'deploy:vendors', 'deploy:init', 'deploy:run_migrations', 'deploy:publish', ])->desc('Deploys your project'); ``` -------------------------------- ### Include Release Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/release.md Include the release recipe to enable release management functionality. ```php require 'recipe/deploy/release.php'; ``` -------------------------------- ### deploy:unlock Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/lock.md Unlocks the deployment process, allowing new deployments to start. This task is typically called automatically after deployment steps are completed. ```APIDOC ## deploy:unlock ### Description Unlocks deploy. ### Method Task ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Get Current UTC Timestamp Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Obtain the current Coordinated Universal Time (UTC) as a string formatted according to ISO 8601 standards. ```php timestamp(); ``` -------------------------------- ### Configure bin/websiteconsole Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/sulu.md Defines the default command for the 'bin/websiteconsole' script. This is used for various Sulu-specific console commands during deployment. ```php return parse('{{bin/php}} {{release_or_current_path}}/bin/websiteconsole --no-interaction'); ``` -------------------------------- ### Accessing Host Configuration within Task (currentHost) Source: https://github.com/deployphp/deployer/blob/master/docs/basics.md Demonstrates how to retrieve host-specific configuration values within a task using currentHost()->get(). ```php task('my_task', function () { $myConfig = currentHost()->get('my_config'); writeln("my_config: " . $myConfig); }); ``` -------------------------------- ### Fish Shell Completion for Deployer Source: https://github.com/deployphp/deployer/blob/master/docs/installation.md Set up Fish shell completion for Deployer. This command writes the completion script to the appropriate Fish completions directory. ```sh dep completion fish > ~/.config/fish/completions/deployer.fish ``` -------------------------------- ### Get Git Short Revision for Revision Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/newrelic.md This snippet defines the default value for `newrelic_revision`. It retrieves the short hash of the last Git commit. ```php return runLocally('git log -n 1 --format="%h"'); ``` -------------------------------- ### Set Phinx Path and Configuration Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/phinx.md Specify the path to the Phinx executable and set the Phinx configuration array using Deployer's `set` function. ```php set('phinx_path', '/usr/local/phinx/bin/phinx'); set('phinx', $phinx_env_vars); ``` -------------------------------- ### Yii Deploy Task Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/yii.md The main deployment task for Yii projects. It orchestrates several sub-tasks including preparation, vendor installation, migrations, and publishing. ```php task('deploy', [ 'deploy:prepare', 'deploy:vendors', 'deploy:migrate', 'deploy:publish' ]); ``` -------------------------------- ### Determine Laravel Version Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/laravel.md Executes the Artisan --version command to dynamically determine the installed Laravel version. Defaults to 5.5 if the version cannot be parsed. ```php $result = run("{{bin/php}} {{bin/artisan}} --version"); preg_match_all('/(\d+\.?)+/', $result, $matches); return $matches[0][0] ?? 5.5; ``` -------------------------------- ### Include Workplace Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/workplace.md Include the Workplace recipe in your Deployer configuration. ```php require 'contrib/workplace.php'; ``` -------------------------------- ### Include Cleanup Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/deploy/cleanup.md Include the cleanup recipe to enable its tasks. ```php require 'recipe/deploy/cleanup.php'; ``` -------------------------------- ### CraftCMS Main Deploy Task Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/craftcms.md The main deploy task for CraftCMS projects. It orchestrates the entire deployment process, including preparation and vendor installation. ```php task('deploy'); ``` -------------------------------- ### CodeIgniter Deploy Task Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/codeigniter.md The main deploy task for CodeIgniter projects. It orchestrates the deployment process by calling prepare, vendor installation, and publish tasks. ```php task('deploy', [ 'deploy:prepare', 'deploy:vendors', 'deploy:publish' ]); ``` -------------------------------- ### Configure Supervisord with Array Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/supervisord-monitor.md Configure the supervisord monitoring settings using an associative array. Ensure the URI, authentication credentials, and process name are correctly set. ```php set('supervisord', [ 'uri' => 'https://youruri.xyz/supervisor', 'basic_auth_user' => 'username', 'basic_auth_password' => 'password', 'process_name' => 'process01', ]); ``` -------------------------------- ### Add Mattermost Notification to Deploy Hook Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/mattermost.md Add a 'before' hook to trigger Mattermost notifications before the deployment starts. This ensures you are alerted at the beginning of the process. ```php before('deploy', 'mattermost:notify'); ``` -------------------------------- ### Include Phinx Recipe Source: https://github.com/deployphp/deployer/blob/master/docs/contrib/phinx.md Include the Phinx recipe file to enable Phinx tasks within Deployer. ```php require 'contrib/phinx.php'; ``` -------------------------------- ### Add CLI Option Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Use the `option()` function to add a command-line option to the `dep` binary. This allows users to pass parameters to tasks. ```php use Symfony\Component\Console\Input\InputOption; option('tag', null, InputOption::VALUE_REQUIRED, 'Release tag'); task('deploy', function () { $tag = input()->getOption('tag'); }); ``` -------------------------------- ### Set Current Path Source: https://github.com/deployphp/deployer/blob/master/docs/recipe/common.md Define the path to the current release. Defaults to '{{deploy_path}}/current'. ```php set('current_path', '/var/public_html'); ``` -------------------------------- ### Get Symfony Console Input Interface Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Obtain the Symfony Console `InputInterface` object using `input()`. This allows access to command-line options and arguments. ```php $tag = input()->getOption('tag'); ``` -------------------------------- ### run() Source: https://github.com/deployphp/deployer/blob/master/docs/api.md Executes a command on the current remote host and returns its standard output, trimmed. Supports specifying working directory, environment variables, secrets for redaction, timeouts, and error handling. ```APIDOC ## run() ### Description Run a command on the current remote host and return its trimmed stdout. ### Signature ```php run( string $command, ?string $cwd = null, ?array $env = null, #["SensitiveParameter"] ?array $secrets = null, ?bool $nothrow = false, ?bool $forceOutput = false, ?int $timeout = null, ?int $idleTimeout = null, ): string ``` ### Arguments | Argument | Type | Comment | |---|---|---| | `$command` | `string` | Command to run on the remote host. | | `$cwd` | `string` or `null` | Working directory for this run. Defaults to `{{working_path}}` (set by `cd()`). | | `$timeout` | `int` or `null` | Max runtime in seconds (default: `{{default_timeout}}`, 300; `null` disables). | | `$idleTimeout` | `int` or `null` | Max seconds without output before aborting. | | `$secrets` | `array` or `null` | Map of `%name%` placeholders to redacted values. | | `$env` | `array` or `null` | Environment variables: `run('echo $KEY', env: ['KEY' => 'value']);` | | `$forceOutput` | `bool` or `null` | Print command output in real time. | | `$nothrow` | `bool` or `null` | Return output instead of throwing on non-zero exit. | ### Usage ```php run('echo hello world'); run('cd {{deploy_path}} && git status'); run('curl medv.io', timeout: 5); $path = run('readlink {{deploy_path}}/current'); run("echo $path"); // Pass secrets via placeholders (e.g. %token%) so they are redacted in logs: run('curl -u admin:%token% https://api.example', secrets: ['token' => getenv('TOKEN')]); // Use the `| quote` filter to escape config values as shell arguments: run('echo {{ message | quote }}'); run('grep -r {{ pattern | quote }} {{release_path}}'); // To emit a literal `{{`, escape it with a backslash: run('echo \{{not_replaced}}'); // outputs: {{not_replaced}} ``` ```