A command-line interface (CLI) to manage Trellis projects via the
trellis command. It includes:
- Smart autocompletion (based on your defined environments and sites)
- Automatic Virtualenv integration for easier dependency management
- Easy DigitalOcean droplet creation
- Better Ansible Vault support for encrypting files
Quick Install (macOS and Linux via Homebrew)
brew install roots/tap/trellis-cli
Quick Install (Unstable - macOS and Linux via Homebrew)
# Cleanup previous versions (if installed) brew uninstall roots/tap/trellis-cli # Install brew install --HEAD roots/tap/trellis-cli-dev # Upgrade brew upgrade --fetch-HEAD roots/tap/trellis-cli-dev
We also offer a quick script version:
# You might need sudo before bash curl -sL https://roots.io/trellis/cli/get | bash # Turns on debug logging curl -sL https://roots.io/trellis/cli/get | bash -s -- -d # Sets bindir or installation directory, Defaults to '/usr/local/bin' curl -sL https://roots.io/trellis/cli/get | bash -s -- -b /path/to/my/bin
trellis-cli provides binary releases for a variety of OSes. These binary versions can be manually downloaded and installed.
- Download the latest release or any specific version
- Unpack it (
tar -zxvf trellis_0.9.0_Linux_x86_64.tar.gz)
- Find the
trellisbinary in the unpacked directory, and move it to its desired destination (
mv trellis_0.9.0_Darwin_x86_64/trellis /usr/local/bin/trellis)
- Make sure the above path is in your
For windows you also need to setup environment variables to perfectly work with windows terminal
- Open system properties
- Open environment variables
- Under system variables add new variable,
TRELLIS, pointing to the location of the
- Edit path from system variables and add new named
- Save the changes
Homebrew installs trellis-cli's shell completion automatically by default. If shell completions aren't working, or you installed manually not using Homebrew, you'll need to install the completions manually.
To use the trellis-cli's autocomplete via Homebrew's shell completion:
Follow Homebrew's install instructions https://docs.brew.sh/Shell-Completion
Note: For zsh, as the instructions mention, be sure compinit is autoloaded and called, either explicitly or via a framework like oh-my-zsh.
brew reinstall trellis-cli
To install shell completions manually, run the following:
It should modify your
.zshrc or similar.
trellis-cli uses Virtualenv to manage dependencies such as Ansible which it automatically activates and uses when running any
But there's still a lot of times you may want to run
pip manually in your shell. To make this experience seamless, trellis-cli
offers shell integration which automatically activates the Virtualenv when you enter a Trellis project, and deactivates when you leave it.
To enable this integration, add the following to your shell profile:
eval "$(trellis shell-init bash)"
eval "$(trellis shell-init zsh)"
trellis for the complete usage and help.
Supported commands so far:
||Generate WP CLI aliases for remote environments|
||Checks if Trellis requirements are met|
||Commands for database management|
||Deploys a site to the specified environment|
||Template .env files to local system|
||Stops the Vagrant machine by running
||Commands for DigitalOcean Droplets|
||Exec runs a command in the Trellis virtualenv|
||Commands for Ansible Galaxy|
||Displays information about this Trellis project|
||Initializes an existing Trellis project|
||Creates a new Trellis project|
||Provisions the specified environment|
||Rollsback the last deploy of the site on the specified environment|
||Connects to host via SSH|
||Starts and provisions the Vagrant environment by running
||Commands for Laravel Valet|
||Commands for Ansible Vault|
trellis-cli requires Go >= 1.13 (
brew install go on macOS)
# Clone the repo git clone https://github.com/roots/trellis-cli cd trellis-cli # Build the binary for your machine go build # Run tests (without integration tests) go test -v -short ./... # (Optional) Build the docker image for testing (requires `docker`) make docker # Alternatively, do not use cache when building the doccker image (requires `docker`) make docker-no-cache # Run all tests (requires `docker`) make test
Releasing Docker Images
This section only intended for the maintainers
make docker-no-cache # docker tag rootsdev/trellis-cli-dev:latest rootsdev/trellis-cli-dev:YYYY.MM.DD.N # where N is a sequential integer, starting from 1. docker tag rootsdev/trellis-cli-dev:latest rootsdev/trellis-cli-dev:2019.08.12.1 # docker push rootsdev/trellis-cli-dev:YYYY.MM.DD.N docker push rootsdev/trellis-cli-dev:2019.08.12.1 docker push rootsdev/trellis-cli-dev:latest
Contributions are welcome from everyone. We have contributing guidelines to help you get started.
Help support our open-source development efforts by becoming a patron.
Keep track of development and community news.