run

Run a specific remote task from the current project.

Usage

$ tomo run [--dry-run] [options] [--] TASK [ARGS...]

Remotely run one specified TASK, optionally passing ARGS to that task. For example, if this project uses the rails plugin, you could run:

$ tomo run -- rails:console --sandbox

This will run the rails:console task on the host specified in .tomo/config.rb configuration file, and will pass the --sandbox argument to that task. The -- is used to separate tomo options from options that are passed to the task. If a task does not accept options, the -- can be omitted, like this:

$ tomo run core:clean_releases

When you specify a task name, the run command is implied and can be omitted, so this works as well:

$ tomo core:clean_releases

You can run any task defined by plugins loaded by the plugin declarations in .tomo/config.rb. To see a list of available tasks, run the tasks command.

During the run command, tomo will initialize the :release_path setting to be equal to the current symlink (i.e. /var/www/my-app/current). This means that the task will run within the current release.

Options

Option Purpose
--[no-]privileged Run the task using a privileged user (e.g. root). This user is configured per host.
-e ENVIRONMENT, --environment ENVIRONMENT If the configuration contains multiple environments, specify the ENVIRONMENT that should be used (e.g. production). The host(s) and settings can be different per environment.
-s NAME=VALUE, --setting NAME=VALUE Override the setting NAME with the given VALUE. Refer to the settings overrides documentation for a detailed explanation.
--[no-]dry-run Simulate running tasks instead of using real SSH.
-c PATH, --config PATH Override the PATH where the configuration file is loaded from. (Default: .tomo/config.rb).
--[no-]color By default, tomo automatically determines whether to use color output based on the capabilities of the terminal. Use this option to override this behavior and force tomo to enable or disable color output.
--[no-]debug Enables verbose logging output that is helpful for troubleshooting. This includes runtime information such as the environment variables on the remote host and all tomo settings. Each SSH command executed by tomo is also logged in detail.
--[no-]trace Normally if a tomo command fails, a concise and helpful error message is printed. If --trace is specified, tomo will also print the full backtrace.
-h, --help Prints the help for this tomo command, similar to what you see on this page.

Example

Given the following configuration:

plugin "puma"
host "deployer@app.example.com"

Then we could run puma:restart like this:

$ tomo run puma:restart
tomo run v1.1.2
→ Connecting to deployer@app.example.com
• puma:restart
systemctl --user start puma_example.socket
systemctl --user restart puma_example.service
✔ Ran puma:restart on deployer@app.example.com