- Add Terraform configuration for GCP instance and storage - Add startup script for K3s installation and configuration - Add pipeline scripts for deployment and management - Add Forgejo deployment manifests and configuration
81 lines
2.6 KiB
Markdown
81 lines
2.6 KiB
Markdown
|
|
# infctl-cli
|
|
|
|
`infctl-cli` is a Go command-line tool for orchestrating deployment pipelines using shell scripts and Kubernetes manifests. The tool is configured via JSON files and executes tasks as defined in a pipeline configuration.
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
infctl-cli/
|
|
├── main.go # Application entry point
|
|
├── go.mod # Go module definition
|
|
├── app/ # Core application logic
|
|
│ ├── app.go # Pipeline orchestration and state management
|
|
│ └── k8s.go # Kubernetes operations
|
|
├── config/ # Configuration management
|
|
│ ├── base.go # Base configuration handling
|
|
│ └── project.go # Project configuration handling
|
|
├── docs/ # Documentation
|
|
│ ├── API_REFERENCE.md # API reference
|
|
│ └── CONFIG_SCHEMA.md # Config schema
|
|
├── scripts/ # Shell scripts executed by the CLI
|
|
├── k8s-manifests/ # Kubernetes manifests
|
|
├── templates/ # Template files
|
|
└── files/ # Static configuration files
|
|
```
|
|
|
|
## Configuration Files
|
|
|
|
Three JSON files are used:
|
|
|
|
- `base.json`: Base configuration (e.g., `projects_directory`, images, environment file path)
|
|
- `config.json`: Project-specific configuration (e.g., project name, directory, URLs, port)
|
|
- `pipeline.json`: Defines the sequence of scripts and manifests to execute
|
|
|
|
Example configuration files are provided as `.example` files in the repository.
|
|
|
|
## Usage
|
|
|
|
Build the CLI:
|
|
|
|
```bash
|
|
go mod download
|
|
go build -o infctl-cli .
|
|
```
|
|
|
|
Run the CLI with a pipeline file:
|
|
|
|
```bash
|
|
./infctl-cli --deployment-file pipeline.json
|
|
# or
|
|
./infctl-cli -f pipeline.json
|
|
```
|
|
|
|
The CLI will:
|
|
|
|
1. Load base and project configuration
|
|
2. Initialize SQLite database for state management
|
|
3. Execute the pipeline defined in the JSON file
|
|
4. Run scripts from the `scripts/` directory
|
|
5. Apply Kubernetes manifests from the `k8s-manifests/` directory
|
|
|
|
## Scripts
|
|
|
|
Shell scripts in `scripts/` are executed as defined in the pipeline configuration. Scripts are responsible for infrastructure setup, secret creation, configmap generation, and other deployment tasks. The pipeline JSON determines the order and parameters for each script.
|
|
|
|
## Kubernetes Manifests
|
|
|
|
Manifests in `k8s-manifests/` are applied using kubectl and kustomize. The pipeline configuration specifies which manifests to apply and in what order.
|
|
|
|
## Testing
|
|
|
|
Run tests with:
|
|
|
|
```bash
|
|
go test ./... -v
|
|
```
|
|
|
|
## License
|
|
|
|
This project is licensed under the GNU General Public License v3.0. See `LICENSE` for details.
|
|
|