|
| 1 | +--- |
| 2 | +title: Install Infrahub Collect |
| 3 | +--- |
| 4 | + |
| 5 | +import Tabs from '@theme/Tabs'; |
| 6 | +import TabItem from '@theme/TabItem'; |
| 7 | + |
| 8 | +This guide shows you how to install Infrahub Collect on your system. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +Before installing Infrahub Collect, ensure you have: |
| 13 | + |
| 14 | +**For Docker deployments:** |
| 15 | + |
| 16 | +- Administrative or sudo access on your system |
| 17 | +- Docker with Docker Compose installed |
| 18 | + |
| 19 | +**For Kubernetes deployments:** |
| 20 | + |
| 21 | +- Administrative or sudo access on your system |
| 22 | +- kubectl configured with permissions to read pod logs and execute commands in pods (`pods/log` and `pods/exec`) in the Infrahub namespace |
| 23 | + |
| 24 | +**If building from source:** |
| 25 | + |
| 26 | +- Git and network access to clone the repository |
| 27 | +- Go 1.21 or later installed |
| 28 | + |
| 29 | +## Installation methods |
| 30 | + |
| 31 | +<Tabs> |
| 32 | +<TabItem value="direct" label="Direct Download" default> |
| 33 | + |
| 34 | +### Download the pre-built binary |
| 35 | + |
| 36 | +Download the pre-built binary directly: |
| 37 | + |
| 38 | +```bash |
| 39 | +# Download the appropriate binary for your system |
| 40 | +curl https://infrahub.opsmill.io/ops/$(uname -s)/$(uname -m)/infrahub-collect -o infrahub-collect |
| 41 | + |
| 42 | +# Make it executable |
| 43 | +chmod +x infrahub-collect |
| 44 | + |
| 45 | +# Move to a directory in your PATH (optional) |
| 46 | +sudo mv infrahub-collect /usr/local/bin/ |
| 47 | +``` |
| 48 | + |
| 49 | +</TabItem> |
| 50 | +<TabItem value="manual" label="Manual Selection"> |
| 51 | + |
| 52 | +### Select and download a specific version |
| 53 | + |
| 54 | +If you need a specific version or architecture, manually select the appropriate binary: |
| 55 | + |
| 56 | +1. Identify your system architecture: |
| 57 | + |
| 58 | + ```bash |
| 59 | + uname -s # Operating system (Linux/Darwin) |
| 60 | + uname -m # Architecture (x86_64/aarch64) |
| 61 | + ``` |
| 62 | + |
| 63 | +2. Download the matching binary: |
| 64 | + - **Linux AMD64**: `curl -L https://infrahub.opsmill.io/ops/Linux/x86_64/infrahub-collect -o infrahub-collect` |
| 65 | + - **Linux ARM64**: `curl -L https://infrahub.opsmill.io/ops/Linux/aarch64/infrahub-collect -o infrahub-collect` |
| 66 | + - **macOS AMD64**: `curl -L https://infrahub.opsmill.io/ops/Darwin/x86_64/infrahub-collect -o infrahub-collect` |
| 67 | + - **macOS ARM64**: `curl -L https://infrahub.opsmill.io/ops/Darwin/arm64/infrahub-collect -o infrahub-collect` |
| 68 | + |
| 69 | +3. Make executable and optionally install system-wide: |
| 70 | + |
| 71 | + ```bash |
| 72 | + chmod +x infrahub-collect |
| 73 | + sudo mv infrahub-collect /usr/local/bin/ # Optional |
| 74 | + ``` |
| 75 | + |
| 76 | +</TabItem> |
| 77 | +<TabItem value="source" label="Build from Source"> |
| 78 | + |
| 79 | +### Build from source code |
| 80 | + |
| 81 | +To install Infrahub Collect, build from source: |
| 82 | + |
| 83 | +1. Install Go 1.21 or later: |
| 84 | + |
| 85 | + ```bash |
| 86 | + # Check if Go is installed |
| 87 | + go version |
| 88 | + ``` |
| 89 | + |
| 90 | +2. Clone the repository: |
| 91 | + |
| 92 | + ```bash |
| 93 | + git clone https://github.com/opsmill/infrahub-ops-cli.git |
| 94 | + cd infrahub-ops-cli |
| 95 | + ``` |
| 96 | + |
| 97 | +3. Build the binaries: |
| 98 | + |
| 99 | + ```bash |
| 100 | + make build |
| 101 | + ``` |
| 102 | + |
| 103 | +4. Install to your PATH: |
| 104 | + |
| 105 | + ```bash |
| 106 | + sudo cp bin/infrahub-collect /usr/local/bin/ |
| 107 | + ``` |
| 108 | + |
| 109 | +</TabItem> |
| 110 | +</Tabs> |
| 111 | + |
| 112 | +The same binary collects from Docker Compose and Kubernetes deployments — there is no separate in-cluster installation. On Kubernetes, the tool runs from your workstation (or a CI runner) and reaches the cluster through kubectl. |
| 113 | + |
| 114 | +## Verify installation |
| 115 | + |
| 116 | +After installing the CLI, verify it is working correctly: |
| 117 | + |
| 118 | +```bash |
| 119 | +# Check versions |
| 120 | +infrahub-collect version |
| 121 | + |
| 122 | +# Verify environment detection |
| 123 | +infrahub-collect environment detect |
| 124 | + |
| 125 | +# Display help |
| 126 | +infrahub-collect --help |
| 127 | +``` |
| 128 | + |
| 129 | +Expected output: |
| 130 | + |
| 131 | +```bash |
| 132 | +Version: [git ref] |
| 133 | +``` |
| 134 | + |
| 135 | +## Configure environment |
| 136 | + |
| 137 | +Infrahub Collect uses environment variables for configuration. Set these based on your deployment: |
| 138 | + |
| 139 | +### Docker Compose deployments |
| 140 | + |
| 141 | +```bash |
| 142 | +# Optional: Target a specific project |
| 143 | +export INFRAHUB_PROJECT=infrahub-production |
| 144 | + |
| 145 | +# Optional: Custom bundle location |
| 146 | +export INFRAHUB_OUTPUT_DIR=/data/bundles/infrahub |
| 147 | +``` |
| 148 | + |
| 149 | +### Kubernetes deployments |
| 150 | + |
| 151 | +```bash |
| 152 | +# Set the namespace |
| 153 | +export INFRAHUB_K8S_NAMESPACE=infrahub |
| 154 | + |
| 155 | +# Set kubeconfig if not default |
| 156 | +export KUBECONFIG=/path/to/kubeconfig |
| 157 | +``` |
| 158 | + |
| 159 | +## Validation |
| 160 | + |
| 161 | +Confirm the CLI can connect to your Infrahub instance: |
| 162 | + |
| 163 | +```bash |
| 164 | +# List available deployments |
| 165 | +infrahub-collect environment list |
| 166 | + |
| 167 | +# Test environment detection |
| 168 | +infrahub-collect environment detect |
| 169 | +``` |
| 170 | + |
| 171 | +If these commands succeed, installation is complete. |
| 172 | + |
| 173 | +## Related resources |
| 174 | + |
| 175 | +- [Collect a troubleshooting bundle](./collect-troubleshooting-bundle.mdx) |
| 176 | +- [CLI command reference](../reference/commands.mdx) |
| 177 | +- [Configuration reference](../reference/configuration.mdx) |
0 commit comments