-
Notifications
You must be signed in to change notification settings - Fork 47
Review of deployment/development guides #816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ Deploys a Foreman server. This is the primary deployment type and the default en | |
|
|
||
| Deploys a Foreman Proxy node that connects to a Foreman server. | ||
|
|
||
| Before running the proxy deployment, an auth bundle must be generated on the Foreman server and copied to the proxy VM: | ||
| Before running the proxy deployment, an auth bundle must be generated on the Foreman server and copied to the control node: | ||
|
|
||
| 1. On the **Foreman server**, generate an auth bundle for the proxy hostname: | ||
|
|
||
|
|
@@ -43,18 +43,18 @@ Before running the proxy deployment, an auth bundle must be generated on the For | |
| > [!NOTE] | ||
| > The bundle includes the proxy's certificates and OAuth credentials needed for the proxy to communicate with the Foreman server. | ||
|
|
||
| 2. Copy the bundle to the **proxy VM**: | ||
| 2. Copy the bundle to the **control node**: | ||
|
lzap marked this conversation as resolved.
|
||
|
|
||
| ```console | ||
| # scp /var/lib/foremanctl/certs/bundles/proxy.example.com.tar.gz root@proxy.example.com:/root/proxy.example.com.tar.gz | ||
| ```bash | ||
| vagrant ssh quadlet -- sudo cat /var/lib/foremanctl/certs/bundles/proxy.example.com.tar.gz > proxy.example.com.tar.gz | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🤖 get_repo_knowledge executed:
Length of output: 1170 🏁 Script executed: #!/bin/bash
sed -n '35,60p' docs/developer/deployment.md
printf '\n--- bundle references ---\n'
rg -n -C 2 'bundles|proxy\.example\.com\.tar\.gz|OAuth|oauth|credentials' docs/developer/deployment.md docs 2>/dev/null | head -120Repository: theforeman/foremanctl Length of output: 9683 Sensitive Data Exposure (CWE-732): Incorrect Permission Assignment for Critical Resource Reachability: Internal · Exploitability: Moderate Create the local auth bundle with private permissions. The bundle contains certificates and OAuth credentials. Run the copy command with 🤖 Prompt for AI Agents
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, this is a dev docs... Shall we really make it ugly @evgeni ? :) I can do perhaps this:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't listen to the Rabbit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ``` | ||
|
|
||
| 3. On the **proxy VM**, run the deployment: | ||
| 3. On the **control node** (where foremanctl is installed), run the deployment remotely via SSH: | ||
|
ehelms marked this conversation as resolved.
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| ```console | ||
| # foremanctl deploy-proxy \ | ||
| # foremanctl deploy-proxy proxy.example.com \ | ||
| --flavor foreman-proxy-content \ | ||
| --auth-bundle /root/proxy.example.com.tar.gz \ | ||
| --auth-bundle $(pwd)/proxy.example.com.tar.gz \ | ||
| --foreman-fqdn quadlet.example.com | ||
| ``` | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -28,14 +28,17 @@ The development environment provides: | |||||
| ``` | ||||||
|
|
||||||
| 2. **Access the environment:** | ||||||
| - SSH into the VM: `vagrant ssh` | ||||||
| - To run commands on the VM, SSH into it: `vagrant ssh quadlet` | ||||||
| - Navigate to Foreman directory: `cd /home/vagrant/foreman` | ||||||
| - Start Rails server: `bundle exec foreman start` | ||||||
|
|
||||||
| 3. **Access URLs:** | ||||||
| - Foreman UI: `http://$(hostname -f):3000` (development server) | ||||||
| - Production-style UI: `https://$(hostname -f)` (via Apache proxy) | ||||||
|
|
||||||
| > [!NOTE] | ||||||
| > Do not run `./foremanctl` or `./forge` from inside the VM. These commands should be run on the **control node** (where foremanctl source is cloned) and use the `--target-host` parameter to deploy to the VM remotely via SSH. See [Deploying to a Remote Host](#deploying-to-a-remote-host) for details. | ||||||
|
|
||||||
| ### Deploying to a Remote Host | ||||||
|
|
||||||
| You can deploy directly to a remote host using the `--target-host` parameter: | ||||||
|
|
@@ -67,6 +70,26 @@ katello-production: | |||||
| disk_size: 50 | ||||||
| ``` | ||||||
|
|
||||||
| ### DNS | ||||||
|
|
||||||
| This repository does not use the `vagrant-hostmanager` plugin; instead, it automatically configures `/etc/hosts` inside all VMs during provisioning. However, to enable host-to-VM communication (e.g., using `ssh` or `scp` from your host, which is required for proxy/capsule node deployments), you need a working DNS resolution of the libvirt VMs. | ||||||
|
|
||||||
| This can be configured by editing the default libvirt network on your host: | ||||||
|
|
||||||
| ```bash | ||||||
| virsh net-edit default | ||||||
|
lzap marked this conversation as resolved.
|
||||||
| ``` | ||||||
|
|
||||||
| And ensuring that the domain name tag matches your `VAGRANT_DOMAIN` environment variable (which defaults to `example.com`): | ||||||
|
|
||||||
| ```xml | ||||||
| <network> | ||||||
| <domain name='example.com'/> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
to follow https://community.theforeman.org/t/setting-up-libvirt-with-dns-resolution-for-vagrant/46567 |
||||||
| </network> | ||||||
| ``` | ||||||
|
|
||||||
| Once VMs are running, the guest hostnames should resolve automatically on modern Linux distributions (tested on Fedora). | ||||||
|
lzap marked this conversation as resolved.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the kicker here is if you don't have resolved, you won't get it automatically. |
||||||
|
|
||||||
| ### SSH Authentication | ||||||
|
|
||||||
| When deploying to remote hosts that require SSH password authentication: | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| --- | ||
| - name: Setup proxy machine | ||
| hosts: | ||
| - proxy | ||
| - "{{ target_host }}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift 🔎 Supported by static analysis🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
cat >"$tmpdir/inventory" <<'EOF'
[proxy]
proxy1 ansible_connection=local
[other]
other1 ansible_connection=local
EOF
cat >"$tmpdir/playbook.yml" <<'EOF'
---
- name: Probe target selection
hosts:
- "{{ target_host }}"
gather_facts: false
tasks: []
EOF
ansible-playbook \
-i "$tmpdir/inventory" \
"$tmpdir/playbook.yml" \
-e target_host=all \
--list-hostsRepository: theforeman/foremanctl Length of output: 260 🤖 get_repo_knowledge executed:
Length of output: 1170 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- playbook ---'
cat -n src/playbooks/deploy-proxy/deploy-proxy.yaml
printf '%s\n' '--- target_host references ---'
rg -n -C 4 --glob '!vendor/**' --glob '!node_modules/**' 'target_host|deploy-proxy' .
printf '%s\n' '--- relevant playbook files ---'
git ls-files 'src/playbooks/deploy-proxy/*'Repository: theforeman/foremanctl Length of output: 11094 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- deploy-proxy metadata ---'
cat -n src/playbooks/deploy-proxy/metadata.obsah.yaml
printf '%s\n' '--- command and inventory wiring ---'
rg -n -C 5 --glob '*.py' --glob '*.go' --glob '*.rs' --glob '*.js' --glob '*.ts' --glob '*.yaml' --glob '*.yml' \
'ansible-playbook|inventory|target_host|metadata\.obsah|deploy-proxy' src development docs
printf '%s\n' '--- candidate command files ---'
git ls-files | rg '(^|/)(foremanctl|.*ansible.*|.*playbook.*|.*deploy.*)$'Repository: theforeman/foremanctl Length of output: 50377 🌐 Web query:
💡 Result: In Ansible, patterns are used to define the managed nodes or groups against which playbooks or ad hoc commands execute [1][2]. You can specify these patterns in the hosts field of a playbook or as arguments in the command line [1][2]. Regarding the syntax for multiple groups or hosts: 1. Separators: You can use either a colon (:) or a comma (,) to separate items in a pattern [1][2]. While both are supported, the comma is preferred, especially when dealing with IPv6 addresses or ranges to avoid ambiguity [1][2]. 2. Combining Patterns: You can combine patterns to create complex targeting logic [1][2]: - Union (Multiple groups/hosts): Use the colon or comma to target hosts in either group (e.g., webservers:dbservers or webservers,dbservers) [1][2]. - Exclusion: Use an exclamation mark (!) to exclude specific hosts or groups (e.g., webservers:!atlanta) [1][2]. - Intersection: Use an ampersand (&) to target only hosts that exist in both groups (e.g., webservers:&staging) [1][2]. 3. Combining Logic: These patterns can be chained for precise control, such as webservers:dbservers:&staging:!phoenix, which targets all machines in the webservers and dbservers groups that are also in the staging group, excluding those in the phoenix group [1][2]. 4. Command Line Usage: When running ad hoc commands or using the -i flag, you can provide a host list or file path. If you provide a single host or a comma-separated list on the command line for the -i flag, you must include a trailing comma (e.g., -i 127.0.0.2,) to indicate to Ansible that the input is a list of hosts rather than a file path [1][3]. For more information, see the official Ansible documentation on patterns [1][2]. Citations:
Restrict Line 4 passes 🤖 Prompt for AI Agents |
||
| become: true | ||
| vars: | ||
| flavor: foreman-proxy-content | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ variables: | |
| help: Base flavor to use in this deployment. | ||
| choices: | ||
| - foreman-proxy-content | ||
| target_host: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| help: Target hostname or IP address for the proxy deployment | ||
| action: store | ||
| auth_bundle: | ||
| help: Path to the auth bundle tar file. | ||
| type: AbsolutePath | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, you still call
foremanctlon the control node, but the bundle ends up on the Foreman server.