This feature implements a hybrid command architecture that provides both low-level (plumbing) and high-level (porcelain) commands for deployment operations.
Current: Planning and Specification
Implementation: Plumbing commands first, porcelain commands later
Users need different levels of control over the deployment process:
- Beginners want simple, guided deployment with minimal commands
- Advanced users need precise control over individual deployment steps
- CI/CD systems require reliable, granular commands for automation
- Development workflows benefit from quick, intelligent deployment commands
A single command interface cannot optimally serve all these use cases.
Implement a hybrid architecture with two command levels:
Individual commands for precise control:
torrust-tracker-deployer create <env>torrust-tracker-deployer provision <env>torrust-tracker-deployer configure <env>torrust-tracker-deployer release <env>torrust-tracker-deployer run <env>
Orchestration commands built on plumbing commands:
torrust-tracker-deployer deploy <env>- Smart deployment from current state
Rationale: Plumbing commands provide the foundation. Porcelain commands are built on top of stable plumbing operations.
Implementation Order:
- Phase 1: Implement all plumbing commands
- Phase 2: Build porcelain commands using plumbing commands
- Phase 3: Optimize and enhance user experience
Scope: Porcelain commands only automate the core deployment workflow (provision → configure → release → run).
Exclusions: Management commands (create, list, check, status, destroy) remain individual operations because:
- They serve different purposes than deployment
- They require different user interaction patterns
- They don't benefit from orchestration
The deploy command intelligently determines next steps:
- From
created:provision→configure→release→run - From
provisioned:configure→release→run - From
configured:release→run - From
released:run - From
running: No-op (already complete)
Beginners:
torrust-tracker-deployer create myenv
torrust-tracker-deployer deploy myenv # One command to completionAdvanced Users:
torrust-tracker-deployer create myenv
torrust-tracker-deployer provision myenv
# Custom configuration changes
torrust-tracker-deployer configure myenv
torrust-tracker-deployer release myenv
torrust-tracker-deployer run myenvCI/CD Pipelines:
# Precise control, clear failure points
torrust-tracker-deployer provision $ENV_NAME
torrust-tracker-deployer configure $ENV_NAME
torrust-tracker-deployer release $ENV_NAMEDevelopment Workflows:
# Quick iteration
torrust-tracker-deployer deploy dev-env # Smart deploymentPorcelain commands internally call plumbing commands:
// Simplified example
impl DeployCommand {
pub fn execute(&self, env: Environment) -> Result<()> {
let state = env.current_state()?;
match state {
EnvironmentState::Created => {
self.provision_cmd.execute(&env)?;
self.configure_cmd.execute(&env)?;
self.release_cmd.execute(&env)?;
self.run_cmd.execute(&env)?;
},
EnvironmentState::Provisioned => {
self.configure_cmd.execute(&env)?;
self.release_cmd.execute(&env)?;
self.run_cmd.execute(&env)?;
},
// ... other states
}
Ok(())
}
}- Plumbing commands: Fail fast with specific error codes
- Porcelain commands: Provide context about which step failed and how to continue
Porcelain commands show unified progress across multiple steps:
[1/4] Provisioning infrastructure...
✓ LXD container created
[2/4] Configuring system...
✓ Docker installed
✓ Network configured
[3/4] Releasing application...
✓ Application deployed
[4/4] Starting services...
✓ Torrust Tracker running at http://10.140.190.14:7070
Potential future additions:
torrust-tracker-deployer redeploy <env>- Release and restart without reprovisioningtorrust-tracker-deployer reset <env>- Return to configured statetorrust-tracker-deployer upgrade <env>- Update application while preserving data
Porcelain commands could support configuration profiles:
torrust-tracker-deployer deploy prod-env --config production.toml- Console Commands Documentation - Complete command reference
- UX Design Research - Original research that led to this design
- Git's porcelain/plumbing architecture - Inspiration for this approach
-
Phase 1: Plumbing Commands Implementation
-
createcommand -
provisioncommand (partially implemented in E2E tests) -
configurecommand (partially implemented in E2E tests) -
releasecommand -
runcommand -
destroycommand (being implemented)
-
-
Phase 2: Porcelain Commands Implementation
-
deploycommand orchestration logic - State detection and step selection
- Unified progress reporting
- Enhanced error messages with continuation guidance
-
-
Phase 3: Integration and Polish
- Command composition optimization
- User experience testing
- Documentation updates
- CI/CD integration examples