Commit ec1d4cd
committed
Merge #55: Document create environment command
7fe3690 docs: fix documentation link in create-environment.md (copilot-swe-agent[bot])
dbf216b docs: add comprehensive create environment command documentation (copilot-swe-agent[bot])
9aa0675 Initial plan (copilot-swe-agent[bot])
Pull request description:
Adds user-facing documentation for the `create environment` command, completing the final subissue of epic #34.
## Documentation Added
- **Command reference** (`docs/user-guide/commands/create-environment.md`):
- Syntax with all CLI flags and configuration format
- JSON schema with field validation rules
- 8 practical examples covering development, CI/CD, and production setups
- Troubleshooting section for configuration validation, SSH keys, permissions, and parsing errors
- Workflow integration with template generation and next steps
- **Commands index updates** (`docs/user-guide/commands.md`):
- Mark `create environment` and `create template` as ✅ Fully Implemented
- Update workflow examples to include environment creation
- Add `--working-dir` to common options
## Example Usage
```bash
# Generate and edit configuration template
torrust-tracker-deployer create template config.json
nano config.json # Replace placeholders
# Create environment
torrust-tracker-deployer create environment --env-file config.json
# With custom working directory
torrust-tracker-deployer create environment \
--env-file config.json \
--working-dir /opt/deployments
```
Configuration format:
```json
{
"environment": {
"name": "production"
},
"ssh_credentials": {
"private_key_path": "~/.ssh/id_rsa",
"public_key_path": "~/.ssh/id_rsa.pub",
"username": "torrust",
"port": 22
}
}
```
Closes #52
<!-- START COPILOT CODING AGENT SUFFIX -->
<details>
<summary>Original prompt</summary>
----
*This section details on the original issue you should resolve*
<issue_title>[Subissue 10/10] Document Create Environment Command</issue_title>
<issue_description># Document Create Environment Command
**Epic Subissue**: 10 of 10
**Parent Epic**: [#34](#34) - Create Environment Command
**Related**: [User Guide Commands](../user-guide/commands.md), [Create Environment Command Documentation](../user-guide/commands/create-environment.md)
## Overview
Add comprehensive user-facing documentation for the `create environment` command to the user guide. This documentation will help users understand how to create new deployment environments from configuration files.
The create environment command is now fully implemented (Subissues 1-7) and needs proper user-facing documentation in the `docs/user-guide/` directory.
## Goals
- [ ] Create detailed command documentation at `docs/user-guide/commands/create-environment.md`
- [ ] Update `docs/user-guide/commands.md` to mark create command as implemented
- [ ] Include practical examples for common use cases
- [ ] Document all command flags and configuration file formats
- [ ] Provide troubleshooting guidance for common errors
## 🏗️ Architecture Requirements
**Documentation Type**: User Guide
**Module Path**: `docs/user-guide/commands/`
**Pattern**: Command Reference Documentation
### Documentation Structure Requirements
- [ ] Follow existing command documentation pattern (see [docs/user-guide/commands/destroy.md](../user-guide/commands/destroy.md))
- [ ] Include command synopsis, description, usage examples, and troubleshooting
- [ ] Use clear, actionable language for user-facing documentation
- [ ] Provide both JSON and TOML configuration examples
### Anti-Patterns to Avoid
- ❌ Developer-focused implementation details in user guide
- ❌ Missing practical examples
- ❌ Unclear error troubleshooting guidance
- ❌ Inconsistent formatting with other command docs
## Specifications
### Documentation Structure
The command documentation should follow this structure:
1. **Command Overview**
- Brief description of what the command does
- When to use it
- Implementation status badge
2. **Syntax**
- Command signature with all flags
- Required vs optional parameters
3. **Configuration File Format**
- JSON format example
- TOML format example
- Field descriptions with validation rules
4. **Examples**
- Basic usage (minimal configuration)
- Advanced usage (custom working directory)
- Template generation workflow
5. **Common Use Cases**
- Development environment setup
- Testing environment setup
- Production environment setup
6. **Troubleshooting**
- Configuration validation errors
- File system permission issues
- Invalid SSH key paths
- Environment name conflicts
7. **Related Commands**
- Link to provision command
- Link to destroy command
- Link to template generation
### Content to Include
#### Command Overview Section
```markdown
# Create Environment Command
**Status**: ✅ Fully Implemented
Create a new deployment environment from a configuration file. This command initializes the environment with validated configuration, SSH credentials, and prepares it for provisioning.
**Use when**:
- Setting up a new deployment environment
- Initializing environment configuration from templates
- Preparing environments for provisioning
**Command**: `torrust-tracker-deployer create environment`
```
#### Syntax Section
````markdown
## Syntax
```bash
torrust-tracker-deployer create environment --env-file <path> [options]
```
````
### Required Flags
- `--env-file <path>` - Path to environment configuration file (JSON or TOML)
### Optional Flags
- `--working-dir <path>` - Working directory for environment data (default: `.`)
- `--log-output <mode>` - Logging output mode: `stderr`, `file`, `file-and-stderr` (default: `stderr`)
````<!-- markdownlint-disable-line MD040 -->
#### Configuration Format Section
```markdown
## Configuration File Format
### JSON Format
```json
{
"environment": {
"name": "my-environment"
},
"ssh_credentials": {
"private_key_path": "~/.ssh/id_rsa",
"public_key_path": "~/.ssh/id_rsa.pub",
"username": "deployer",
"port": 22
}
}
````
### TOML Format
```toml
[environment]
name = "my-environment"
[ssh_credentials]
private_key_path = "~/.ssh/id_rsa"
public_key_path = "~/.ssh/id_rsa.pub"
username = "deployer"
port = 22
```
### Field Descriptions
- **environment.name** (required): Unique environment identifier
- Must be lowercase alphanumeric with hyphens
- Used for directory names and resource identification
- **ssh_credentials.private_key_path** (required): Path to SSH private key
- Supports `~` for home directory expansion
- File must exist and be readable
- **ssh_credentials.public_key_path** (required): Path to SSH public key
- Supports `~` for home directory expansion...
</details>
- Fixes #52
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for you](https://github.com/torrust/torrust-tracker-deployer/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.
ACKs for top commit:
josecelano:
ACK 7fe3690
Tree-SHA512: 070ffcc553d9c68bd8b7f0679918c19c009b9e8fa532949f84b8d4f3daf6a5d3b1c4144f41b5971f4017a07b60039e221b1332f18226115eff7c917345d690b62 files changed
Lines changed: 657 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | | - | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
34 | 75 | | |
35 | 76 | | |
36 | 77 | | |
| |||
55 | 96 | | |
56 | 97 | | |
57 | 98 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 99 | | |
74 | 100 | | |
75 | 101 | | |
| |||
143 | 169 | | |
144 | 170 | | |
145 | 171 | | |
146 | | - | |
147 | | - | |
| 172 | + | |
| 173 | + | |
148 | 174 | | |
149 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
150 | 182 | | |
151 | 183 | | |
152 | | - | |
| 184 | + | |
153 | 185 | | |
154 | 186 | | |
155 | | - | |
| 187 | + | |
156 | 188 | | |
157 | 189 | | |
158 | 190 | | |
159 | 191 | | |
160 | 192 | | |
161 | 193 | | |
| 194 | + | |
| 195 | + | |
162 | 196 | | |
163 | | - | |
164 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
165 | 202 | | |
166 | 203 | | |
167 | 204 | | |
| |||
181 | 218 | | |
182 | 219 | | |
183 | 220 | | |
184 | | - | |
| 221 | + | |
185 | 222 | | |
186 | 223 | | |
187 | 224 | | |
188 | 225 | | |
189 | 226 | | |
190 | 227 | | |
| 228 | + | |
191 | 229 | | |
192 | 230 | | |
193 | 231 | | |
| |||
197 | 235 | | |
198 | 236 | | |
199 | 237 | | |
200 | | - | |
201 | | - | |
202 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
203 | 242 | | |
204 | 243 | | |
205 | 244 | | |
| 245 | + | |
206 | 246 | | |
207 | 247 | | |
208 | 248 | | |
0 commit comments