Settle on v1 setup method. Test run completed successfully from bootstrap to service setup.
- Refactor dnsmasq configuration and scripts for improved variable handling and clarity - Updated dnsmasq configuration files to use direct variable references instead of data source functions for better readability. - Modified setup scripts to ensure they are run from the correct environment and directory, checking for the WC_HOME variable. - Changed paths in README and scripts to reflect the new directory structure. - Enhanced error handling in setup scripts to provide clearer guidance on required configurations. - Adjusted kernel and initramfs URLs in boot.ipxe to use the updated variable references.
This commit is contained in:
@@ -4,10 +4,10 @@ PRESET_NET_ETHERNET_ENABLED="1"
|
||||
PRESET_NET_WIFI_ENABLED="0"
|
||||
|
||||
PRESET_NET_USE_STATIC="1"
|
||||
PRESET_NET_STATIC_IP="{{ (ds "config").cloud.dns.ip }}"
|
||||
PRESET_NET_STATIC_IP="{{ .cloud.dns.ip }}"
|
||||
PRESET_NET_STATIC_MASK="255.255.255.0"
|
||||
PRESET_NET_STATIC_GATEWAY="{{ (ds "config").cloud.router.ip }}"
|
||||
PRESET_NET_STATIC_DNS="{{ (ds "config").cloud.dns.ip }}"
|
||||
PRESET_NET_STATIC_GATEWAY="{{ .cloud.router.ip }}"
|
||||
PRESET_NET_STATIC_DNS="{{ .cloud.dns.ip }}"
|
||||
|
||||
# For example:
|
||||
# PRESET_NET_STATIC_IP="192.168.8.50"
|
||||
|
@@ -27,14 +27,15 @@ A "PXE client" is any machine that is booting using PXE. This is a great way to
|
||||
|
||||
- Install a Linux machine on your LAN. Record it's IP address in your `config:cloud.dns.ip`.
|
||||
- Ensure it is accessible with ssh.
|
||||
- Run `setup/dnsmasq/bin/create-setup-bundle.sh`
|
||||
- Run `setup/dnsmasq/bin/transfer-setup-bundle.sh`
|
||||
- From your wild-cloud directory, run `wild-central-generate-setup`.
|
||||
- Run `cluster/dnsmasq/bin/create-setup-bundle.sh`
|
||||
- Run `cluster/dnsmasq/bin/transfer-setup-bundle.sh`
|
||||
|
||||
Now ssh into your dnsmasq machine and do the following:
|
||||
|
||||
```bash
|
||||
sudo -i
|
||||
cd dnsmasq-setup
|
||||
cd /root/dnsmasq-setup
|
||||
./setup.sh
|
||||
```
|
||||
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -d ".wildcloud" ]; then
|
||||
echo "Error: You must run this script from a wild-cloud directory"
|
||||
# Check if WC_HOME is set
|
||||
if [ -z "${WC_HOME:-}" ]; then
|
||||
echo "Error: WC_HOME environment variable not set. Run \`source ./env.sh\`."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -9,7 +10,7 @@ WILDCLOUD_ROOT=$(wild-config wildcloud.root) || exit 1
|
||||
|
||||
# ---
|
||||
|
||||
DNSMASQ_SETUP_DIR="./setup/dnsmasq"
|
||||
DNSMASQ_SETUP_DIR="${WC_ROOT}/setup/dnsmasq"
|
||||
BUNDLE_DIR="${DNSMASQ_SETUP_DIR}/setup-bundle"
|
||||
mkdir -p "${BUNDLE_DIR}"
|
||||
|
||||
@@ -20,16 +21,20 @@ PXE_WEB_ROOT="${BUNDLE_DIR}/ipxe-web"
|
||||
mkdir -p "${PXE_WEB_ROOT}/amd64"
|
||||
cp "${DNSMASQ_SETUP_DIR}/boot.ipxe" "${PXE_WEB_ROOT}/boot.ipxe"
|
||||
|
||||
# Create Talos bare metal boot assets.
|
||||
# This uses the Talos factory API to create boot assets for bare metal nodes.
|
||||
# These assets include the kernel and initramfs needed for PXE booting Talos on bare metal.
|
||||
echo "Creating Talos bare metal boot assets..."
|
||||
TALOS_ID=$(curl -X POST --data-binary @${DNSMASQ_SETUP_DIR}/bare-metal.yaml https://factory.talos.dev/schematics | jq -r '.id')
|
||||
# Get Talos schematic ID from centralized config.
|
||||
# The schematic should be uploaded via wild-talos-schema first.
|
||||
echo "Getting Talos schematic ID from config..."
|
||||
TALOS_ID=$(wild-config cluster.nodes.talos.schematicId)
|
||||
if [ -z "${TALOS_ID}" ] || [ "${TALOS_ID}" = "null" ]; then
|
||||
echo "Error: Failed to create Talos bare metal boot assets"
|
||||
echo "Error: No schematic ID found in config.yaml"
|
||||
echo "Run 'wild-talos-schema' first to upload schematic and get ID"
|
||||
exit 1
|
||||
fi
|
||||
echo "Successfully created Talos bare metal boot assets with ID: ${TALOS_ID}"
|
||||
echo "Using Talos schematic ID: ${TALOS_ID}"
|
||||
|
||||
# Verify schematic includes expected extensions
|
||||
echo "Schematic includes:"
|
||||
yq eval '.cluster.nodes.talos.schematic.customization.systemExtensions.officialExtensions[]' ./config.yaml | sed 's/^/ - /'
|
||||
|
||||
# Download kernel to ipxe-web if it's not already there.
|
||||
TALOS_VERSION=$(wild-config cluster.nodes.talos.version) || exit 1
|
||||
|
@@ -1,12 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -d ".wildcloud" ]; then
|
||||
echo "Error: You must run this script from a wild-cloud directory"
|
||||
# Check if WC_HOME is set
|
||||
if [ -z "${WC_HOME:-}" ]; then
|
||||
echo "Error: WC_HOME environment variable not set. Run \`source ./env.sh\`."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SERVER_HOST=$(wild-config cloud.dns.ip2) || exit 1
|
||||
SETUP_DIR="./setup/dnsmasq/setup-bundle"
|
||||
SERVER_HOST=$(wild-config cloud.dns.ip) || exit 1
|
||||
SETUP_DIR="${WC_HOME}/setup/dnsmasq/setup-bundle"
|
||||
DESTINATION_DIR="~/dnsmasq-setup"
|
||||
|
||||
echo "Copying DNSMasq setup files to ${SERVER_HOST}:${DESTINATION_DIR}..."
|
||||
|
@@ -1,5 +1,5 @@
|
||||
!ipxe
|
||||
imgfree
|
||||
kernel http://{{ (ds "config").cloud.dns.ip }}/amd64/vmlinuz talos.platform=metal console=tty0 init_on_alloc=1 slab_nomerge pti=on consoleblank=0 nvme_core.io_timeout=4294967295 printk.devkmsg=on ima_template=ima-ng ima_appraise=fix ima_hash=sha512 selinux=1 net.ifnames=0
|
||||
initrd http://{{ (ds "config").cloud.dns.ip }}/amd64/initramfs.xz
|
||||
kernel http://{{ .cloud.dns.ip }}/amd64/vmlinuz talos.platform=metal console=tty0 init_on_alloc=1 slab_nomerge pti=on consoleblank=0 nvme_core.io_timeout=4294967295 printk.devkmsg=on ima_template=ima-ng ima_appraise=fix ima_hash=sha512 selinux=1 net.ifnames=0
|
||||
initrd http://{{ .cloud.dns.ip }}/amd64/initramfs.xz
|
||||
boot
|
||||
|
@@ -1,26 +1,24 @@
|
||||
# Configuration file for dnsmasq.
|
||||
|
||||
# Basic Settings
|
||||
interface={{ (ds "config").cloud.dnsmasq.interface }}
|
||||
listen-address={{ (ds "config").cloud.dns.ip }}
|
||||
interface={{ .cloud.dnsmasq.interface }}
|
||||
listen-address={{ .cloud.dns.ip }}
|
||||
domain-needed
|
||||
bogus-priv
|
||||
no-resolv
|
||||
|
||||
# DNS Forwarding
|
||||
# local=/{{ (ds "config").cloud.domain }}/
|
||||
# address=/{{ (ds "config").cloud.domain }}/{{ (ds "config").cluster.endpointIp }}
|
||||
# local=/{{ (ds "config").cloud.internalDomain }}/
|
||||
# address=/{{ (ds "config").cloud.internalDomain }}/{{ (ds "config").cluster.endpointIp }}
|
||||
server=/{{ (ds "config").cloud.domain }}/{{ (ds "config").cluster.endpointIp }}
|
||||
server=/{{ (ds "config").cloud.internalDomain }}/{{ (ds "config").cluster.endpointIp }}
|
||||
local=/{{ .cloud.domain }}/
|
||||
address=/{{ .cloud.domain }}/{{ .cluster.loadBalancerIp }}
|
||||
local=/{{ .cloud.internalDomain }}/
|
||||
address=/{{ .cloud.internalDomain }}/{{ .cluster.loadBalancerIp }}
|
||||
server=1.1.1.1
|
||||
server=8.8.8.8
|
||||
|
||||
# --- DHCP Settings ---
|
||||
dhcp-range={{ (ds "config").cloud.dhcpRange }},12h
|
||||
dhcp-option=3,{{ (ds "config").cloud.router.ip }} # gateway to assign
|
||||
dhcp-option=6,{{ (ds "config").cloud.dns.ip }} # dns to assign
|
||||
dhcp-range={{ .cloud.dhcpRange }},12h
|
||||
dhcp-option=3,{{ .cloud.router.ip }} # gateway to assign
|
||||
dhcp-option=6,{{ .cloud.dns.ip }} # dns to assign
|
||||
|
||||
# --- PXE Booting ---
|
||||
enable-tftp
|
||||
@@ -34,7 +32,7 @@ dhcp-match=set:efi-arm64,option:client-arch,11
|
||||
dhcp-boot=tag:efi-arm64,ipxe-arm64.efi
|
||||
|
||||
dhcp-userclass=set:ipxe,iPXE
|
||||
dhcp-boot=tag:ipxe,http://{{ (ds "config").cloud.dns.ip }}/boot.ipxe
|
||||
dhcp-boot=tag:ipxe,http://{{ .cloud.dns.ip }}/boot.ipxe
|
||||
|
||||
log-queries
|
||||
log-dhcp
|
||||
|
@@ -73,15 +73,15 @@ no-resolv
|
||||
# Add local-only domains here, queries in these domains are answered
|
||||
# from /etc/hosts or DHCP only.
|
||||
#local=/localnet/
|
||||
local=/{{ (ds "config").cloud.domain }}/
|
||||
local=/{{ (ds "config").cloud.internalDomain }}/
|
||||
local=/{{ .cloud.domain }}/
|
||||
local=/{{ .cloud.internalDomain }}/
|
||||
|
||||
# Add domains which you want to force to an IP address here.
|
||||
# The example below send any host in double-click.net to a local
|
||||
# web-server.
|
||||
#address=/double-click.net/127.0.0.1
|
||||
address=/{{ (ds "config").cloud.domain }}/{{ (ds "config").cluster.endpointIp }}
|
||||
address=/{{ (ds "config").cloud.internalDomain }}/{{ (ds "config").cluster.endpointIp }}
|
||||
address=/{{ .cloud.domain }}/{{ .cluster.loadBalancerIp }}
|
||||
address=/{{ .cloud.internalDomain }}/{{ .cluster.loadBalancerIp }}
|
||||
|
||||
# --address (and --server) work with IPv6 addresses too.
|
||||
#address=/www.thekelleys.org.uk/fe80::20d:60ff:fe36:f83
|
||||
@@ -170,7 +170,7 @@ interface=eth0
|
||||
# a lease time. If you have more than one network, you will need to
|
||||
# repeat this for each network on which you want to supply DHCP
|
||||
# service.
|
||||
dhcp-range={{ (ds "config").cloud.dhcpRange }},12h
|
||||
dhcp-range={{ .cloud.dhcpRange }},12h
|
||||
|
||||
# This is an example of a DHCP range where the netmask is given. This
|
||||
# is needed for networks we reach the dnsmasq DHCP server via a relay
|
||||
@@ -345,7 +345,7 @@ dhcp-range={{ (ds "config").cloud.dhcpRange }},12h
|
||||
# Override the default route supplied by dnsmasq, which assumes the
|
||||
# router is the same machine as the one running dnsmasq.
|
||||
#dhcp-option=3,1.2.3.4
|
||||
dhcp-option=3,{{ (ds "config").cluster.router.ip }}
|
||||
dhcp-option=3,{{ .cluster.router.ip }}
|
||||
|
||||
# Do the same thing, but using the option name
|
||||
#dhcp-option=option:router,1.2.3.4
|
||||
@@ -361,7 +361,7 @@ dhcp-option=3,{{ (ds "config").cluster.router.ip }}
|
||||
|
||||
# Send DHCPv6 option. Note [] around IPv6 addresses.
|
||||
#dhcp-option=option6:dns-server,[1234::77],[1234::88]
|
||||
# dhcp-option=option6:dns-server,{{ (ds "config").cluster.dns.ip }}
|
||||
# dhcp-option=option6:dns-server,{{ .cluster.dns.ip }}
|
||||
|
||||
# Send DHCPv6 option for namservers as the machine running
|
||||
# dnsmasq and another.
|
||||
|
Reference in New Issue
Block a user