|
| 1 | +# Posit Team Dedicated (PTD) |
| 2 | + |
| 3 | +## Project Structure |
| 4 | + |
| 5 | +The project is organized into several key components: |
| 6 | + |
| 7 | +- **`./cmd`**: Contains the main CLI tool (Go implementation) |
| 8 | +- **`./lib`**: Common Go libraries and utilities |
| 9 | +- **`./python-pulumi`**: Python package with Pulumi infrastructure-as-code resources |
| 10 | +- **`./examples`**: Example configurations for control rooms and workloads |
| 11 | +- **`./e2e`**: End-to-end tests |
| 12 | +- **`./docs`**: Documentation (see [docs/README.md](docs/README.md) for structure) |
| 13 | + - **`./docs/cli`**: CLI reference documentation |
| 14 | + - **`./docs/team-operator`**: Team Operator documentation |
| 15 | + - **`./docs/guides`**: How-to guides for common tasks |
| 16 | + - **`./docs/infrastructure`**: Infrastructure documentation |
| 17 | +- **`./Justfile`**: Command runner file with various tasks (`just -l` to list commands) |
| 18 | + |
| 19 | +### Team Operator |
| 20 | + |
| 21 | +The Team Operator is a Kubernetes operator that manages the deployment and configuration of Posit Team products within a Kubernetes cluster. It is maintained in a separate public repository: [posit-dev/team-operator](https://github.com/posit-dev/team-operator). |
| 22 | + |
| 23 | +PTD consumes the Team Operator via its public Helm chart at `oci://ghcr.io/posit-dev/charts/team-operator`. |
| 24 | + |
| 25 | +**Testing with adhoc images:** PR builds from posit-dev/team-operator publish adhoc images to GHCR. To test: |
| 26 | +```yaml |
| 27 | +# In ptd.yaml cluster spec |
| 28 | +adhoc_team_operator_image: "ghcr.io/posit-dev/team-operator:adhoc-{branch}-{version}" |
| 29 | +``` |
| 30 | +
|
| 31 | +## CLI Configuration |
| 32 | +
|
| 33 | +The PTD CLI uses Viper for configuration management. Configuration can be set via: |
| 34 | +- **CLI flags**: Highest precedence (e.g., `--targets-config-dir`) |
| 35 | +- **Environment variables**: Second precedence (e.g., `PTD_TARGETS_CONFIG_DIR`) |
| 36 | +- **Config file**: Third precedence (`~/.config/ptd/ptdconfig.yaml`) |
| 37 | +- **Defaults**: Lowest precedence |
| 38 | + |
| 39 | +### Targets Configuration Directory |
| 40 | + |
| 41 | +PTD expects target configurations in a targets directory. Configure it via: |
| 42 | + |
| 43 | +```yaml |
| 44 | +# ~/.config/ptd/ptdconfig.yaml |
| 45 | +targets_config_dir: /path/to/your/targets |
| 46 | +``` |
| 47 | + |
| 48 | +Or via environment variable: |
| 49 | +```bash |
| 50 | +export PTD_TARGETS_CONFIG_DIR=/path/to/your/targets |
| 51 | +``` |
| 52 | + |
| 53 | +Or via CLI flag: |
| 54 | +```bash |
| 55 | +ptd --targets-config-dir /path/to/your/targets ensure workload01 |
| 56 | +``` |
| 57 | + |
| 58 | +The targets configuration directory must contain: |
| 59 | +- `__ctrl__/`: Control room configurations |
| 60 | +- `__work__/`: Workload configurations |
| 61 | + |
| 62 | +See [examples/](examples/) for example configurations. |
| 63 | + |
| 64 | +### Go→Python Integration |
| 65 | + |
| 66 | +The Go CLI communicates the infrastructure path to Python Pulumi stacks via the `PTD_ROOT` environment variable: |
| 67 | +- **Go**: Sets `PTD_ROOT` in `lib/pulumi/python.go` when invoking Python |
| 68 | +- **Python**: Reads `PTD_ROOT` in `python-pulumi/src/ptd/paths.py` |
| 69 | +- **Tests**: Python tests must set `PTD_ROOT` via `monkeypatch.setenv()` |
| 70 | + |
| 71 | +## Build and Development Commands |
| 72 | + |
| 73 | +### Overall Project Commands (from root Justfile) |
| 74 | + |
| 75 | +- `just deps`: Install dependencies |
| 76 | +- `just check`: Check all (includes linting and formatting) |
| 77 | +- `just test`: Test all |
| 78 | +- `just build`: Build all |
| 79 | +- `just format`: Run automatic formatting |
| 80 | + |
| 81 | +#### Check Commands |
| 82 | + |
| 83 | +- `just check-python-pulumi`: Check Python Pulumi code |
| 84 | + |
| 85 | +#### Build Commands |
| 86 | + |
| 87 | +- `just build-cmd`: Build command-line tool |
| 88 | + |
| 89 | +#### Test Commands |
| 90 | + |
| 91 | +- `just test-cmd`: Test command-line tool |
| 92 | +- `just test-e2e`: Run end-to-end tests (requires URL argument) |
| 93 | +- `just test-lib`: Test library code |
| 94 | +- `just test-python-pulumi`: Test Python Pulumi code |
| 95 | + |
| 96 | +#### AWS Development |
| 97 | + |
| 98 | +- `just aws-unset`: Unset all AWS environment variables |
| 99 | +- `just latest-images`: Show latest ECR images |
| 100 | + |
| 101 | +## Contributing |
| 102 | + |
| 103 | +When contributing to the project: |
| 104 | + |
| 105 | +1. Ensure that Snyk tests pass before merging a PR |
| 106 | +2. Follow the development workflows described in the repository files |
| 107 | +3. Use the provided Justfiles for common tasks |
| 108 | +4. Always run `just format` before committing changes to ensure code style consistency |
| 109 | + |
| 110 | +# Additional Instructions |
| 111 | +- LLM coding instructions shared with copilot: [.github/copilot/copilot-instructions.md](.github/copilot/copilot-instructions.md) |
| 112 | +- Follow the template in [.github/pull_request_template.md](.github/pull_request_template.md) to format PR descriptions correctly |
0 commit comments