Configure software dependencies on provisioned infrastructure.
Installs and configures Docker and Docker Compose on provisioned VM infrastructure. This command takes an environment from the "Provisioned" state to the "Configured" state with all required software installed.
torrust-tracker-deployer configure <ENVIRONMENT><ENVIRONMENT>(required) - Name of the environment to configure
- Environment provisioned - Must run
provisionfirst - VM running - Instance must be accessible via SSH
- Ansible installed - Ansible CLI available in PATH
- SSH connectivity - Network access to VM
[Provisioned] --configure--> [Configured]
When you configure an environment:
- Validates prerequisites - Checks environment state and connectivity
- Runs Ansible playbooks - Executes configuration management tasks
- Installs Docker - Sets up Docker Engine
- Installs Docker Compose - Sets up Docker Compose plugin
- Configures user permissions - Adds SSH user to docker group
- Verifies installation - Tests Docker and Docker Compose availability
- Updates environment state - Transitions to "Configured"
# Configure the environment
torrust-tracker-deployer configure my-environment
# Output:
# ✓ Validating prerequisites...
# ✓ Running Ansible playbooks...
# ✓ Installing Docker...
# ✓ Installing Docker Compose...
# ✓ Configuring permissions...
# ✓ Verifying installation...
# ✓ Environment configured successfully# Development
torrust-tracker-deployer configure dev-local
# Staging
torrust-tracker-deployer configure staging
# Production
torrust-tracker-deployer configure production# Complete setup sequence
torrust-tracker-deployer create environment -f config.json
torrust-tracker-deployer provision my-environment
torrust-tracker-deployer configure my-environment
torrust-tracker-deployer test my-environmentThe configure command installs:
- Docker Engine - Latest stable version
- Docker Compose - Plugin version (v2.x)
- User permissions - SSH user added to docker group
- Verification results - Docker and Compose version info
Ansible logs are written to:
data/logs/ansible-<timestamp>.log
After configuration:
# Verify the infrastructure is ready
torrust-tracker-deployer test my-environment
# Expected output:
# ✓ All infrastructure tests passedProblem: Cannot configure an environment that hasn't been provisioned
Solution: Provision the environment first
# Check environment state
cat data/my-environment/state.json
# If state is "Created", provision first
torrust-tracker-deployer provision my-environmentProblem: Ansible CLI is not installed or not in PATH
Solution: Install Ansible
# Ubuntu/Debian
sudo apt update
sudo apt install ansible
# Or use pip
pip install ansible
# Verify installation
ansible --versionProblem: Cannot connect to VM via SSH
Solution: Verify VM is running and SSH is accessible
# Check VM status
lxc list
# Get VM IP
lxc list my-environment --format json | jq -r '.[0].state.network.eth0.addresses[0].address'
# Try manual SSH connection
ssh -i <private-key> torrust@<vm-ip>
# If cloud-init is still running, wait for it
lxc exec <instance-name> -- cloud-init status --waitProblem: Ansible playbook fails during Docker installation
Solution: Check Ansible logs and VM network connectivity
# Review Ansible logs
tail -f data/logs/ansible-*.log
# Manually check VM network
lxc exec <instance-name> -- ping -c 3 8.8.8.8
# Check VM DNS
lxc exec <instance-name> -- cat /etc/resolv.conf
# Retry configuration
torrust-tracker-deployer configure my-environmentProblem: User cannot run Docker commands without sudo
Solution: The configure command should handle this, but if it fails:
# SSH into the VM
ssh -i <private-key> torrust@<vm-ip>
# Add user to docker group (done by playbook normally)
sudo usermod -aG docker $USER
# Log out and log back in for group changes to take effect
exit
ssh -i <private-key> torrust@<vm-ip>
# Verify
docker ps#!/bin/bash
set -e
ENV_NAME="test-${BUILD_ID}"
# Setup
torrust-tracker-deployer create environment -f test.json
torrust-tracker-deployer provision ${ENV_NAME}
torrust-tracker-deployer configure ${ENV_NAME}
# Verify
torrust-tracker-deployer test ${ENV_NAME}
# Your tests here...
# Cleanup
torrust-tracker-deployer destroy ${ENV_NAME}# Set up infrastructure
torrust-tracker-deployer create environment -f dev.json
torrust-tracker-deployer provision dev-local
torrust-tracker-deployer configure dev-local
# SSH into VM for manual work
ssh -i fixtures/testing_rsa torrust@$(lxc list --format json | jq -r '.[0].state.network.eth0.addresses[0].address')
# Inside VM: verify Docker
docker --version
docker compose versionIf you need to reconfigure without reprovisioning:
# Just run configure again (idempotent)
torrust-tracker-deployer configure my-environment
# Ansible playbooks are designed to be idempotent
# Safe to run multiple timesThe configure command runs these playbooks in order:
-
install-docker.yml - Installs Docker Engine
- Adds Docker GPG key
- Adds Docker repository
- Installs docker-ce, docker-ce-cli, containerd.io
- Starts and enables Docker service
-
install-docker-compose.yml - Installs Docker Compose
- Downloads Docker Compose plugin
- Installs to
/usr/local/lib/docker/cli-plugins/docker-compose - Sets executable permissions
-
configure-docker-permissions.yml - Sets up user permissions
- Adds SSH user to docker group
- Applies group changes
Configuration generates:
- Ansible inventory -
build/<env>/ansible/inventory.yml - Ansible logs -
data/logs/ansible-<timestamp>.log - Environment state - Updated with "Configured" status
After configuration, the command verifies:
- Docker daemon is running
- Docker CLI is accessible
- Docker Compose is installed
- User has docker group permissions