|
| 1 | +# Local RP Dependency Setup |
| 2 | + |
| 3 | +- [Local RP Dependency Setup](#local-rp-dependency-setup) |
| 4 | + - [Install Package Dependencies](#install-package-dependencies) |
| 5 | + - [Fedora/RHEL Dependencies](#fedorarhel-dependencies) |
| 6 | + - [Fedora/RHEL Optional Dependencies](#fedorarhel-optional-dependencies) |
| 7 | + - [Debian Dependencies](#debian-dependencies) |
| 8 | + - [Debian Optional Dependencies](#debian-optional-dependencies) |
| 9 | + - [MacOS Dependencies](#macos-dependencies) |
| 10 | + - [Optional MacOS Dependencies](#optional-macos-dependencies) |
| 11 | + - [Install Go](#install-go) |
| 12 | + - [Install Go Manually](#install-go-manually) |
| 13 | + - [Install Python (`pyenv`)](#install-python-pyenv) |
| 14 | + - [Install AZ Client](#install-az-client) |
| 15 | + - [Install OpenVPN](#install-openvpn) |
| 16 | + - [Install Podman and Podman Docker](#install-podman-and-podman-docker) |
| 17 | + - [Configure Podman](#configure-podman) |
| 18 | + - [Install GolangCI Lint](#install-golangci-lint) |
| 19 | + - [Install YAMLLint](#install-yamllint) |
| 20 | +- [Miscellaneous OS Requirements](#miscellaneous-os-requirements) |
| 21 | + - [RHEL](#rhel) |
| 22 | + - [Debian](#debian) |
| 23 | + - [MacOS](#macos) |
| 24 | + - [Containerized RP Software Required](#containerized-rp-software-required) |
| 25 | + |
| 26 | +> [!NOTE] |
| 27 | +> To run an RP instance as a Go process using `go run` locally, additional tools are required and are outlined below. |
| 28 | +
|
| 29 | +## Install Package Dependencies |
| 30 | + |
| 31 | +### Fedora/RHEL Dependencies |
| 32 | + |
| 33 | +> [!IMPORTANT] |
| 34 | +> For other OS specific requirements, refer to the [Miscellaneous OS Requirements](#other-os-requirements) section. |
| 35 | +
|
| 36 | +1. General dependencies |
| 37 | + ```sh |
| 38 | + sudo dnf install -y \ |
| 39 | + gpgme-devel \ |
| 40 | + libassuan-devel \ |
| 41 | + openssl |
| 42 | + ``` |
| 43 | +2. Dependencies for Fedora 37+ |
| 44 | + ```sh |
| 45 | + sudo dnf install -y \ |
| 46 | + lvm2 \ |
| 47 | + lvm2-devel \ |
| 48 | + golang-github-containerd-btrfs-devel |
| 49 | + ``` |
| 50 | +3. Dependencies for `pyenv` |
| 51 | + ```sh |
| 52 | + sudo dnf install -y \ |
| 53 | + bzip2-devel \ |
| 54 | + ncurses-devel \ |
| 55 | + libffi-devel \ |
| 56 | + readline-devel \ |
| 57 | + sqlite-devel \ |
| 58 | + tk-devel \ |
| 59 | + xz-devel \ |
| 60 | + zlib-devel \ |
| 61 | + gcc \ |
| 62 | + make |
| 63 | + ``` |
| 64 | + |
| 65 | +#### Fedora/RHEL Optional Dependencies |
| 66 | +1. Install [Docker Compose](https://docs.docker.com/compose/install/linux/#install-using-the-repository) |
| 67 | + 1. Fedora/RHEL |
| 68 | + ```sh |
| 69 | + sudo dnf install -y \ |
| 70 | + docker-compose-plugin |
| 71 | + ``` |
| 72 | + 2. See [Install Go via `gvm`](#prepare-dev-environment/gvm.md) |
| 73 | + [gvm](#prepare-dev-environment/gvm.md) |
| 74 | + |
| 75 | +### Debian Dependencies |
| 76 | + |
| 77 | +1. Install the required dependencies |
| 78 | + ```sh |
| 79 | + sudo apt install -y \ |
| 80 | + libgpgme-dev \ |
| 81 | + libbtrfs-dev \ |
| 82 | + libdevmapper-dev |
| 83 | + ``` |
| 84 | + |
| 85 | +#### Debian Optional Dependencies |
| 86 | + 1. Install `docker-compose-plugin` |
| 87 | + ```sh |
| 88 | + sudo apt install -y |
| 89 | + docker-compose-plugin |
| 90 | + ``` |
| 91 | + |
| 92 | +### MacOS Dependencies |
| 93 | + |
| 94 | +1. Install the required dependencies |
| 95 | + ```sh |
| 96 | + brew install coreutils \ |
| 97 | + findutils \ |
| 98 | + gnu-tar \ |
| 99 | + grep \ |
| 100 | + gettext \ |
| 101 | + gpgme diffutils |
| 102 | + ``` |
| 103 | + |
| 104 | +#### Optional MacOS Dependencies |
| 105 | +> [!WARNING] |
| 106 | +> Pay attention to the notes after the `brew` installer runs as there will be instructions to follow to complete setup on MacOS. |
| 107 | +1. Install `docker-compose` |
| 108 | + ```sh |
| 109 | + brew install docker-compose |
| 110 | + ``` |
| 111 | + |
| 112 | +## Install Go |
| 113 | + |
| 114 | +### Install Go Manually |
| 115 | + |
| 116 | +> [!TIP] |
| 117 | +> Go versions installation and management can be simplified with `gvm`. |
| 118 | +> See [Install Go With `gvm`](dev-environment/gvm.md) |
| 119 | +1. [Download Go](https://golang.org/dl) matching the version in `go.mod`. |
| 120 | +2. Extract the archive |
| 121 | + |
| 122 | + ```sh |
| 123 | + cd $HOME/Downloads |
| 124 | + sudo tar -C /usr/local -xzf go1.22.12.linux-amd64.tar.gz |
| 125 | + ``` |
| 126 | +3. Add Go to `PATH` in your shell's RC file |
| 127 | +
|
| 128 | + ```sh |
| 129 | + export PATH="${PATH}:/usr/local/go/bin" |
| 130 | + ``` |
| 131 | +4. Configure `GOPATH` as an environment variable in your shell, as it is required by some dependencies for `make generate`. To use the default path, add the following to your shell's RC file |
| 132 | + |
| 133 | + ```sh |
| 134 | + export GOPATH=$(go env GOPATH) |
| 135 | + ``` |
| 136 | + |
| 137 | +### Install Python (`pyenv`) |
| 138 | + |
| 139 | +> [!IMPORTANT] |
| 140 | +> Python versions earlier than 3.6 or later than 3.10 are currently **not** supported. |
| 141 | + |
| 142 | +1. Install `pyenv` |
| 143 | + ```sh |
| 144 | + curl https://pyenv.run | bash |
| 145 | + ``` |
| 146 | +2. Append the following to your shell's RC file |
| 147 | + ```sh |
| 148 | + export PATH="$HOME/.pyenv/bin:$PATH" |
| 149 | + eval "$(pyenv init --path)" |
| 150 | + eval "$(pyenv init -)" |
| 151 | + ``` |
| 152 | +3. Install required Python version using `pyenv` |
| 153 | + ```sh |
| 154 | + pyenv install 3.10.0 |
| 155 | + ``` |
| 156 | +
|
| 157 | +## Install AZ Client |
| 158 | +
|
| 159 | +> [!NOTE] |
| 160 | +> Due to the `az` client requiring a specific Python version, you will find the instructions to install the `az` client in the [Getting Started](#getting-started) section. This will use `pyenv` to ensure the correct Python version limited to the local ARO-RP environment. |
| 161 | +> |
| 162 | +> ARO-RP comes with `make pyenv`, this will set up the environment and install the `az` client after setting the local Python version via `pyenv`. |
| 163 | +
|
| 164 | +## Install OpenVPN |
| 165 | +
|
| 166 | +1. Find the client you require [here](https://openvpn.net/community-downloads/) |
| 167 | +2. **Or:** on RHEL/Fedora run the following |
| 168 | + ```sh |
| 169 | + sudo dnf install openvpn |
| 170 | + ``` |
| 171 | +
|
| 172 | +> [!NOTE] |
| 173 | +> You can also use the built in Network Manager to add `.ovpn` configuration files. |
| 174 | +
|
| 175 | +## Install Podman and Podman Docker |
| 176 | +
|
| 177 | +> [!NOTE] |
| 178 | +> Podman is used for building container images and running the installer. |
| 179 | +
|
| 180 | +1. Install Podman |
| 181 | + ```sh |
| 182 | + sudo dnf install -y \ |
| 183 | + podman \ |
| 184 | + podman-docker |
| 185 | + ``` |
| 186 | +
|
| 187 | +### Configure Podman |
| 188 | +
|
| 189 | +> [!IMPORTANT] |
| 190 | +> Podman needs to be running in daemon mode when running the RP locally. |
| 191 | +
|
| 192 | +1. On Linux, you can enable socket activation to start Podman in daemon mode |
| 193 | + ```sh |
| 194 | + systemctl --user enable podman.socket |
| 195 | + ``` |
| 196 | +
|
| 197 | +> [!WARNING] |
| 198 | +> If you are using `podman-machine`, you will need to export the socket: |
| 199 | +> |
| 200 | +> ```sh |
| 201 | +> export ARO_PODMAN_SOCKET=unix://$HOME/.local/share/containers/podman/machine/qemu/podman.sock |
| 202 | +> ``` |
| 203 | +> |
| 204 | +> You will also need to ensure that `podman-machine` has enough resources: |
| 205 | +> |
| 206 | +> ```sh |
| 207 | +> podman machine stop |
| 208 | +> podman machine rm |
| 209 | +> podman machine init --cpus 4 --memory 5000 |
| 210 | +> podman machine start |
| 211 | +> ``` |
| 212 | +
|
| 213 | +2. Disable Docker compatibility mode for `az acr login` support |
| 214 | + ```sh |
| 215 | + sudo touch /etc/containers/nodocker |
| 216 | + ``` |
| 217 | +
|
| 218 | +## Install GolangCI Lint |
| 219 | +
|
| 220 | +1. Find latest version [here](https://github.com/golangci/golangci-lint/releases) |
| 221 | +2. Run the install |
| 222 | + ```sh |
| 223 | + # https://github.com/golangci/golangci-lint/releases |
| 224 | + GOLINT_VERSION="<REPLACE WITH LATEST>" |
| 225 | +
|
| 226 | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin "$GOLINT_VERSION" |
| 227 | + ``` |
| 228 | +
|
| 229 | +## Install YAMLLint |
| 230 | +
|
| 231 | +```sh |
| 232 | +sudo dnf install -y \ |
| 233 | + yamllint |
| 234 | +``` |
| 235 | +
|
| 236 | +--- |
| 237 | +
|
| 238 | +# Miscellaneous OS Requirements |
| 239 | +
|
| 240 | +## RHEL |
| 241 | +
|
| 242 | +1. Register the system with `subscription-manager register` |
| 243 | +2. Enable the [CodeReady Linux Builder](https://access.redhat.com/articles/4348511) repository to install *-devel packages |
| 244 | +3. Enable the [EPEL repository](https://docs.fedoraproject.org/en-US/epel/#_quickstart) for packages not in the base repositories (such as OpenVPN) |
| 245 | +
|
| 246 | +## Debian |
| 247 | +
|
| 248 | +> [!IMPORTANT] |
| 249 | +> Your actual `pkgconfig` path may differ; please adjust it accordingly. |
| 250 | +1. Ensure you have installed all [Debian dependencies](#debian-dependencies) |
| 251 | +2. Make sure that `PKG_CONFIG_PATH` contains the `pkgconfig` files of the above packages. For example: |
| 252 | + ```sh |
| 253 | + export PKG_CONFIG_PATH:/usr/lib/x86_64-linux-gnu/pkgconfig |
| 254 | + ``` |
| 255 | +
|
| 256 | +## MacOS |
| 257 | +
|
| 258 | +> [!NOTE] |
| 259 | +> Developers using macOS are encouraged to contribute to this repository. To ensure compatibility, macOS users should install GNU utilities on their systems. |
| 260 | +> |
| 261 | +> The goal is to minimize shell scripting and other platform-specific variations within the repository. Installing GNU utilities on macOS helps reduce discrepancies in command-line flags, usage and more, ensuring a consistent development experience across environments. |
| 262 | +
|
| 263 | +1. Ensure you have installed all [MacOS dependencies](#macos-dependencies) |
| 264 | +2. Link `gettext` to make commands available system-wide |
| 265 | + ```sh |
| 266 | + brew link gettext |
| 267 | + ``` |
| 268 | +3. Update your `PATH` in your shell's RC file to prepend your `PATH` with GBU Utils paths |
| 269 | + ```sh |
| 270 | + export PATH=$(find $(brew --prefix)/opt -type d -follow -name gnubin -print | paste -s -d ':' -):\$PATH |
| 271 | + ``` |
| 272 | +4. Add the following to your shell's RC file |
| 273 | + ```sh |
| 274 | + export LDFLAGS="-L$(brew --prefix)/lib" |
| 275 | + export CFLAGS="-I$(brew --prefix)/include" |
| 276 | + export CGO_LDFLAGS=$LDFLAGS |
| 277 | + export CGO_CFLAGS=$CFLAGS |
| 278 | + ``` |
| 279 | +5. Login to ACR |
| 280 | + > [!TIP] |
| 281 | + > The following steps ***may*** be applicable where you symlink `docker` to `podman` location. |
| 282 | +
|
| 283 | + ```sh |
| 284 | + ### CHECK SYMLINK ### |
| 285 | + ls -la $(whereis -q docker) |
| 286 | +
|
| 287 | + # Example Output: /Users/<USER>/.local/bin/docker -> /opt/homebrew/bin/podman |
| 288 | +
|
| 289 | + ### LOGIN TO ACR ### |
| 290 | + az acr login --name <TARGET_ACR> |
| 291 | + ``` |
| 292 | +
|
| 293 | +--- |
| 294 | +
|
| 295 | +## Containerized RP Software Required |
| 296 | +
|
| 297 | +> [!TIP] |
| 298 | +> For a minimal development environment, the recommended approach is to use the containerized setup. This runs the RP inside a container with your local workspace mounted, facilitating debugging and quick code changes. |
| 299 | +> |
| 300 | +> **See [Containerized Development Environment](containerized-dev-environment.md) for a complete setup guide.** |
| 301 | +
|
| 302 | +The containerized development environment requires only these locally installed tools: |
| 303 | +
|
| 304 | +1. az |
| 305 | +2. make |
| 306 | +3. podman |
| 307 | +4. openvpn (Optional for Hive cluster deployments) |
| 308 | +
|
| 309 | +> [!NOTE] |
| 310 | +> Instructions for installing these tools are provided in the sections below. Refer to the [Podman](#install-podman-and-podman-docker) section for setup details specific to your operating system. |
0 commit comments