diff --git a/bin/wild-central-generate-setup b/bin/wild-central-generate-setup deleted file mode 100755 index 577970e..0000000 --- a/bin/wild-central-generate-setup +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -set -e -set -o pipefail - -if [ ! -d ".wildcloud" ]; then - echo "Error: You must run this script from a wild-cloud directory" - exit 1 -fi - -WILDCLOUD_ROOT=$(wild-config wildcloud.root) || exit 1 -TEMPLATE_DIR="${WILDCLOUD_ROOT}/central-setup/dnsmasq" -SETUP_DIR="cluster/dnsmasq" - -if [ ! -d "${TEMPLATE_DIR}" ]; then - echo "Error: Template directory not found at ${TEMPLATE_DIR}" - exit 1 -fi - -if [ -d "${SETUP_DIR}" ]; then - echo "Warning: ${SETUP_DIR} already exists" - read -p "Overwrite? (y/N): " -n 1 -r - echo - [[ ! $REPLY =~ ^[Yy]$ ]] && exit 1 - rm -rf "${SETUP_DIR}" -fi - -# Copy and process templates -cp -r "${TEMPLATE_DIR}" "${SETUP_DIR}" - -find "${SETUP_DIR}" -type f \( -name "*.yaml" -o -name "*.ipxe" -o -name "*.conf" \) | while read -r file; do - echo "Processing: ${file}" - wild-compile-template < "${file}" > "${file}.tmp" && mv "${file}.tmp" "${file}" -done - -echo "Successfully created dnsmasq setup files from templates." diff --git a/bin/wild-setup b/bin/wild-setup new file mode 100755 index 0000000..975c645 --- /dev/null +++ b/bin/wild-setup @@ -0,0 +1,82 @@ +#!/bin/bash + +set -e +set -o pipefail + +if [ ! -d ".wildcloud" ]; then + echo "Error: You must run this script from a wild-cloud directory" + exit 1 +fi + +WILDCLOUD_ROOT=$(wild-config wildcloud.root) || exit 1 + + +# Dnsmasq + +SOURCE_DIR="${WILDCLOUD_ROOT}/setup" +DEST_DIR="setup" +mkdir -p "${DEST_DIR}" + +if [ -d "${DEST_DIR}/dnsmasq" ]; then + echo "Warning: ${DEST_DIR}/dnsmasq already exists" + read -p "Overwrite? (y/N): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Skipping dnsmasq setup" + else + rm -rf "${DEST_DIR}/dnsmasq" + cp -r "${SOURCE_DIR}/dnsmasq" "${DEST_DIR}/dnsmasq" + find "${DEST_DIR}/dnsmasq" -type f \( -name "*.yaml" -o -name "*.ipxe" -o -name "*.conf" \) | while read -r file; do + echo "Processing: ${file}" + wild-compile-template < "${file}" > "${file}.tmp" && mv "${file}.tmp" "${file}" + done + echo "Successfully created dnsmasq setup files from templates." + fi +else + cp -r "${SOURCE_DIR}/dnsmasq" "${DEST_DIR}/dnsmasq" + find "${DEST_DIR}/dnsmasq" -type f \( -name "*.yaml" -o -name "*.ipxe" -o -name "*.conf" \) | while read -r file; do + echo "Processing: ${file}" + wild-compile-template < "${file}" > "${file}.tmp" && mv "${file}.tmp" "${file}" + done + echo "Successfully created dnsmasq setup files from templates." +fi + + +# Cluster-nodes + +if [ -d "${DEST_DIR}/cluster-nodes" ]; then + echo "Warning: ${DEST_DIR}/cluster-nodes already exists" + read -p "Overwrite? (y/N): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Skipping cluster-nodes setup" + else + rm -rf "${DEST_DIR}/cluster-nodes" + cp -r "${SOURCE_DIR}/cluster-nodes" "${DEST_DIR}/cluster-nodes" + echo "Successfully created cluster-nodes setup files." + fi +else + cp -r "${SOURCE_DIR}/cluster-nodes" "${DEST_DIR}/cluster-nodes" + echo "Successfully created cluster-nodes setup files." +fi + + +# Cluster +if [ -d "${DEST_DIR}/cluster" ]; then + echo "Warning: ${DEST_DIR}/cluster already exists" + read -p "Overwrite? (y/N): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Skipping cluster setup" + else + rm -rf "${DEST_DIR}/cluster" + cp -r "${SOURCE_DIR}/cluster" "${DEST_DIR}/cluster" + echo "Successfully created cluster setup files." + fi +else + cp -r "${SOURCE_DIR}/cluster" "${DEST_DIR}/cluster" + echo "Successfully created cluster setup files." +fi + +# Instructions +cp "${SOURCE_DIR}/README.md" "${DEST_DIR}/README.md" diff --git a/central-setup/README.md b/central-setup/README.md deleted file mode 100644 index a8f5f65..0000000 --- a/central-setup/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Central setup - -**Central** is a separate machine on your network that provides core wild-cloud services. - -Right now, this is entirely `dnsmasq` to provide: - -- LAN DNS w/ forwarding of internal and external cloud domains to the cluster. -- PXE for setting up cluster nodes. - -Read the [dnsmasq README.md](./dnsmasq/README.md) for how we set things up right now. - -## _Future_ setup - -We _may_ follow a Central network appliance in the future, where one could install an apt package and use Central like a LAN router. - -Development repo: https://github.com/civil-society-dev/wild-central - -The setup will look something like this: - -```bash -# Download and install GPG key -curl -fsSL https://mywildcloud.org/apt/wild-cloud-central.gpg | sudo tee /usr/share/keyrings/wild-cloud-central-archive-keyring.gpg > /dev/null - -# Add repository (modern .sources format) -sudo tee /etc/apt/sources.list.d/wild-cloud-central.sources << 'EOF' -Types: deb -URIs: https://mywildcloud.org/apt -Suites: stable -Components: main -Signed-By: /usr/share/keyrings/wild-cloud-central-archive-keyring.gpg -EOF - -# Update and install -sudo apt update -sudo apt install wild-cloud-central -``` - -browse to `http://localhost:5050`! diff --git a/docs/SETUP.md b/docs/SETUP.md index 44fe32f..7ec832c 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -1,91 +1,16 @@ # Setting Up Your Wild-cloud -## Initial setup +Add the `bin` directory to your path. -- Add `bin` directory to your path. - -## Set up your personal cloud operations directory +Initialize a personal wild-cloud in any empty directory, for example: ```bash cd ~ mkdir ~/my-wild-cloud cd my-wild-cloud wild-init -cp config.example.yaml config.yaml -cp secrets.example.yaml secrets.yaml ``` -## Configuring your wild-cloud +Now, continue setup by following the instructions inside the new `README.md` in your personal wild-cloud directory: -Now, update your config.yaml and secrets.yaml. - -Instructions TBD. - -## Set up your Cloud Central - -```bash -bin/wild-central-generate-setup -``` - -## Set up Control Nodes - -### 2. Install K3s (Lightweight Kubernetes) - -See [Cluster Node Setup](../cluster-node-setup/README.md). - -## Install Infrastructure Components - -> Currently, these are set up to run from this directory. This will be moved to (1) a `bin/wild-generate-infrastructure-setup` script to copy them all to your personal cloud dir, (2) `wild-cli` (to do the same), or (3) `wild-central`, once I get my mind made up. - -One command sets up your entire cloud infrastructure: - -```bash -./infrastructure_setup/setup-all.sh -``` - -This installs and configures: - -- **MetalLB**: Provides IP addresses for services -- **LongHorn**: Provides distributed block storage on the cluster -- **Traefik**: Handles ingress (routing) with automatic HTTPS -- **cert-manager**: Manages TLS certificates automatically -- **CoreDNS**: Provides internal DNS resolution -- **ExternalDNS**: Updates DNS records automatically -- **Kubernetes Dashboard**: Web UI for managing your cluster - -## Next Steps - -Now that your infrastructure is set up, you can: - -1. **Deploy Applications**: See [Applications Guide](./APPS.md) for deploying services and applications -2. **Access Dashboard**: Visit `https://dashboard.internal.yourdomain.com` and use the token from `./bin/dashboard-token` -3. **Validate Setup**: Run `./infrastructure_setup/validate_setup.sh` to ensure everything is working - -## Validation and Troubleshooting - -Run the validation script to ensure everything is working correctly: - -```bash -./infrastructure_setup/validate_setup.sh -``` - -This script checks: - -- All infrastructure components -- DNS resolution -- Service connectivity -- Certificate issuance -- Network configuration - -If issues are found, the script provides specific remediation steps. - -## What's Next? - -Now that your personal cloud is running, consider: - -- Setting up backups with [Velero](https://velero.io/) -- Adding monitoring with Prometheus and Grafana -- Deploying applications like Nextcloud, Home Assistant, or Gitea -- Exploring the Kubernetes Dashboard to monitor your services - -Welcome to your personal cloud journey! You now have the foundation for hosting your own services and taking control of your digital life. +~/my-wild-cloud/README.md diff --git a/my-scaffold/README.md b/my-scaffold/README.md index 1f281f6..18ab389 100644 --- a/my-scaffold/README.md +++ b/my-scaffold/README.md @@ -1,32 +1,29 @@ # Your Wild-Cloud -## Getting started +## One-time Setup -### Install wild-cloud tools +Congratulations! Everything you need for setting up and managing your wild-cloud is in this directory. -``` -# TBD -``` - -### Set up wild-cloud hardware - -TBD - -### Create your wild-cloud +The first step is to set up your configuration and secrets. ```bash -wild init # Creates a .wildcloud dir and copies templates. -wild update # Updates templates -wild cluster init # Copies cluster templates - -# Make your config and secrets changes. - -wild cluster build -wild cluster apply -# Optional: Check in cluster files. +mv config.example.yaml config.yaml +mv secrets.example.yaml secrets.yaml ``` -### Install Wild-Cloud apps +> Configuration instructions TBD. + +Generate your custom setup: + +```bash +wild-setup +``` + +Now, continue setup with your custom [setup instructions](./setup/README.md). + +## Using your wild-cloud + +### Installing Wild-Cloud apps ```bash wild-apps-list diff --git a/setup/README.md b/setup/README.md new file mode 100644 index 0000000..968a2c8 --- /dev/null +++ b/setup/README.md @@ -0,0 +1,17 @@ +# Setup instructions + +Follow the instructions to [set up a dnsmasq machine](./dnsmasq/README.md). + +Follow the instructions to [set up cluster nodes](./cluster-nodes/README.md). + +Set up cluster services: + +```bash +./setup/cluster/setup-all.sh +``` + +Now make sure everything works: + +```bash +./setup/cluster/validate-setup.sh +``` diff --git a/cluster-node-setup/README.md b/setup/cluster-nodes/README.md similarity index 100% rename from cluster-node-setup/README.md rename to setup/cluster-nodes/README.md diff --git a/cluster-node-setup/generated/.gitkeep b/setup/cluster-nodes/generated/.gitkeep similarity index 100% rename from cluster-node-setup/generated/.gitkeep rename to setup/cluster-nodes/generated/.gitkeep diff --git a/cluster-node-setup/old/setup_node.sh b/setup/cluster-nodes/old/setup_node.sh similarity index 100% rename from cluster-node-setup/old/setup_node.sh rename to setup/cluster-nodes/old/setup_node.sh diff --git a/cluster-node-setup/patch/controlplane.yaml b/setup/cluster-nodes/patch/controlplane.yaml similarity index 100% rename from cluster-node-setup/patch/controlplane.yaml rename to setup/cluster-nodes/patch/controlplane.yaml diff --git a/cluster-node-setup/patch/worker.yaml b/setup/cluster-nodes/patch/worker.yaml similarity index 100% rename from cluster-node-setup/patch/worker.yaml rename to setup/cluster-nodes/patch/worker.yaml diff --git a/infrastructure_setup/README.md b/setup/cluster/README.md similarity index 100% rename from infrastructure_setup/README.md rename to setup/cluster/README.md diff --git a/infrastructure_setup/cert-manager/cert-manager.yaml b/setup/cluster/cert-manager/cert-manager.yaml similarity index 100% rename from infrastructure_setup/cert-manager/cert-manager.yaml rename to setup/cluster/cert-manager/cert-manager.yaml diff --git a/infrastructure_setup/cert-manager/internal-wildcard-certificate.yaml b/setup/cluster/cert-manager/internal-wildcard-certificate.yaml similarity index 100% rename from infrastructure_setup/cert-manager/internal-wildcard-certificate.yaml rename to setup/cluster/cert-manager/internal-wildcard-certificate.yaml diff --git a/infrastructure_setup/cert-manager/letsencrypt-prod-dns01.yaml b/setup/cluster/cert-manager/letsencrypt-prod-dns01.yaml similarity index 100% rename from infrastructure_setup/cert-manager/letsencrypt-prod-dns01.yaml rename to setup/cluster/cert-manager/letsencrypt-prod-dns01.yaml diff --git a/infrastructure_setup/cert-manager/letsencrypt-staging-dns01.yaml b/setup/cluster/cert-manager/letsencrypt-staging-dns01.yaml similarity index 100% rename from infrastructure_setup/cert-manager/letsencrypt-staging-dns01.yaml rename to setup/cluster/cert-manager/letsencrypt-staging-dns01.yaml diff --git a/infrastructure_setup/cert-manager/wildcard-certificate.yaml b/setup/cluster/cert-manager/wildcard-certificate.yaml similarity index 100% rename from infrastructure_setup/cert-manager/wildcard-certificate.yaml rename to setup/cluster/cert-manager/wildcard-certificate.yaml diff --git a/infrastructure_setup/coredns/README.md b/setup/cluster/coredns/README.md similarity index 100% rename from infrastructure_setup/coredns/README.md rename to setup/cluster/coredns/README.md diff --git a/infrastructure_setup/coredns/coredns-custom-config.yaml b/setup/cluster/coredns/coredns-custom-config.yaml similarity index 100% rename from infrastructure_setup/coredns/coredns-custom-config.yaml rename to setup/cluster/coredns/coredns-custom-config.yaml diff --git a/infrastructure_setup/coredns/coredns-lb-service.yaml b/setup/cluster/coredns/coredns-lb-service.yaml similarity index 100% rename from infrastructure_setup/coredns/coredns-lb-service.yaml rename to setup/cluster/coredns/coredns-lb-service.yaml diff --git a/infrastructure_setup/docker-registry/config/example.env b/setup/cluster/docker-registry/config/example.env similarity index 100% rename from infrastructure_setup/docker-registry/config/example.env rename to setup/cluster/docker-registry/config/example.env diff --git a/infrastructure_setup/docker-registry/deployment.yaml b/setup/cluster/docker-registry/deployment.yaml similarity index 100% rename from infrastructure_setup/docker-registry/deployment.yaml rename to setup/cluster/docker-registry/deployment.yaml diff --git a/infrastructure_setup/docker-registry/ingress.yaml b/setup/cluster/docker-registry/ingress.yaml similarity index 100% rename from infrastructure_setup/docker-registry/ingress.yaml rename to setup/cluster/docker-registry/ingress.yaml diff --git a/infrastructure_setup/docker-registry/kustomization.yaml b/setup/cluster/docker-registry/kustomization.yaml similarity index 100% rename from infrastructure_setup/docker-registry/kustomization.yaml rename to setup/cluster/docker-registry/kustomization.yaml diff --git a/infrastructure_setup/docker-registry/namespace.yaml b/setup/cluster/docker-registry/namespace.yaml similarity index 100% rename from infrastructure_setup/docker-registry/namespace.yaml rename to setup/cluster/docker-registry/namespace.yaml diff --git a/infrastructure_setup/docker-registry/pvc.yaml b/setup/cluster/docker-registry/pvc.yaml similarity index 100% rename from infrastructure_setup/docker-registry/pvc.yaml rename to setup/cluster/docker-registry/pvc.yaml diff --git a/infrastructure_setup/docker-registry/service.yaml b/setup/cluster/docker-registry/service.yaml similarity index 100% rename from infrastructure_setup/docker-registry/service.yaml rename to setup/cluster/docker-registry/service.yaml diff --git a/infrastructure_setup/externaldns/README.md b/setup/cluster/externaldns/README.md similarity index 100% rename from infrastructure_setup/externaldns/README.md rename to setup/cluster/externaldns/README.md diff --git a/infrastructure_setup/externaldns/externaldns-cloudflare.yaml b/setup/cluster/externaldns/externaldns-cloudflare.yaml similarity index 100% rename from infrastructure_setup/externaldns/externaldns-cloudflare.yaml rename to setup/cluster/externaldns/externaldns-cloudflare.yaml diff --git a/infrastructure_setup/externaldns/externaldns-rbac.yaml b/setup/cluster/externaldns/externaldns-rbac.yaml similarity index 100% rename from infrastructure_setup/externaldns/externaldns-rbac.yaml rename to setup/cluster/externaldns/externaldns-rbac.yaml diff --git a/infrastructure_setup/get_helm.sh b/setup/cluster/get_helm.sh similarity index 100% rename from infrastructure_setup/get_helm.sh rename to setup/cluster/get_helm.sh diff --git a/infrastructure_setup/kubernetes-dashboard/dashboard-admin-rbac.yaml b/setup/cluster/kubernetes-dashboard/dashboard-admin-rbac.yaml similarity index 100% rename from infrastructure_setup/kubernetes-dashboard/dashboard-admin-rbac.yaml rename to setup/cluster/kubernetes-dashboard/dashboard-admin-rbac.yaml diff --git a/infrastructure_setup/kubernetes-dashboard/dashboard-kube-system.yaml b/setup/cluster/kubernetes-dashboard/dashboard-kube-system.yaml similarity index 100% rename from infrastructure_setup/kubernetes-dashboard/dashboard-kube-system.yaml rename to setup/cluster/kubernetes-dashboard/dashboard-kube-system.yaml diff --git a/infrastructure_setup/longhorn/README.md b/setup/cluster/longhorn/README.md similarity index 100% rename from infrastructure_setup/longhorn/README.md rename to setup/cluster/longhorn/README.md diff --git a/infrastructure_setup/longhorn/kustomization.yaml b/setup/cluster/longhorn/kustomization.yaml similarity index 100% rename from infrastructure_setup/longhorn/kustomization.yaml rename to setup/cluster/longhorn/kustomization.yaml diff --git a/infrastructure_setup/longhorn/longhorn.yaml b/setup/cluster/longhorn/longhorn.yaml similarity index 100% rename from infrastructure_setup/longhorn/longhorn.yaml rename to setup/cluster/longhorn/longhorn.yaml diff --git a/infrastructure_setup/metallb/configuration/kustomization.yaml b/setup/cluster/metallb/configuration/kustomization.yaml similarity index 100% rename from infrastructure_setup/metallb/configuration/kustomization.yaml rename to setup/cluster/metallb/configuration/kustomization.yaml diff --git a/infrastructure_setup/metallb/configuration/pool.yaml b/setup/cluster/metallb/configuration/pool.yaml similarity index 100% rename from infrastructure_setup/metallb/configuration/pool.yaml rename to setup/cluster/metallb/configuration/pool.yaml diff --git a/infrastructure_setup/metallb/installation/kustomization.yaml b/setup/cluster/metallb/installation/kustomization.yaml similarity index 100% rename from infrastructure_setup/metallb/installation/kustomization.yaml rename to setup/cluster/metallb/installation/kustomization.yaml diff --git a/infrastructure_setup/nfs/kustomization.yaml b/setup/cluster/nfs/kustomization.yaml similarity index 100% rename from infrastructure_setup/nfs/kustomization.yaml rename to setup/cluster/nfs/kustomization.yaml diff --git a/infrastructure_setup/nfs/persistent-volume.yaml b/setup/cluster/nfs/persistent-volume.yaml similarity index 100% rename from infrastructure_setup/nfs/persistent-volume.yaml rename to setup/cluster/nfs/persistent-volume.yaml diff --git a/infrastructure_setup/nfs/storage-class.yaml b/setup/cluster/nfs/storage-class.yaml similarity index 100% rename from infrastructure_setup/nfs/storage-class.yaml rename to setup/cluster/nfs/storage-class.yaml diff --git a/infrastructure_setup/setup-all.sh b/setup/cluster/setup-all.sh similarity index 100% rename from infrastructure_setup/setup-all.sh rename to setup/cluster/setup-all.sh diff --git a/infrastructure_setup/setup-cert-manager.sh b/setup/cluster/setup-cert-manager.sh similarity index 100% rename from infrastructure_setup/setup-cert-manager.sh rename to setup/cluster/setup-cert-manager.sh diff --git a/infrastructure_setup/setup-coredns.sh b/setup/cluster/setup-coredns.sh similarity index 100% rename from infrastructure_setup/setup-coredns.sh rename to setup/cluster/setup-coredns.sh diff --git a/infrastructure_setup/setup-dashboard.sh b/setup/cluster/setup-dashboard.sh similarity index 100% rename from infrastructure_setup/setup-dashboard.sh rename to setup/cluster/setup-dashboard.sh diff --git a/infrastructure_setup/setup-externaldns.sh b/setup/cluster/setup-externaldns.sh similarity index 100% rename from infrastructure_setup/setup-externaldns.sh rename to setup/cluster/setup-externaldns.sh diff --git a/infrastructure_setup/setup-longhorn.sh b/setup/cluster/setup-longhorn.sh similarity index 100% rename from infrastructure_setup/setup-longhorn.sh rename to setup/cluster/setup-longhorn.sh diff --git a/infrastructure_setup/setup-metallb.sh b/setup/cluster/setup-metallb.sh similarity index 100% rename from infrastructure_setup/setup-metallb.sh rename to setup/cluster/setup-metallb.sh diff --git a/infrastructure_setup/setup-nfs-host.sh b/setup/cluster/setup-nfs-host.sh similarity index 100% rename from infrastructure_setup/setup-nfs-host.sh rename to setup/cluster/setup-nfs-host.sh diff --git a/infrastructure_setup/setup-nfs.sh b/setup/cluster/setup-nfs.sh similarity index 100% rename from infrastructure_setup/setup-nfs.sh rename to setup/cluster/setup-nfs.sh diff --git a/infrastructure_setup/setup-registry.sh b/setup/cluster/setup-registry.sh similarity index 100% rename from infrastructure_setup/setup-registry.sh rename to setup/cluster/setup-registry.sh diff --git a/infrastructure_setup/setup-traefik.sh b/setup/cluster/setup-traefik.sh similarity index 100% rename from infrastructure_setup/setup-traefik.sh rename to setup/cluster/setup-traefik.sh diff --git a/infrastructure_setup/setup-utils.sh b/setup/cluster/setup-utils.sh similarity index 100% rename from infrastructure_setup/setup-utils.sh rename to setup/cluster/setup-utils.sh diff --git a/infrastructure_setup/traefik/README.md b/setup/cluster/traefik/README.md similarity index 100% rename from infrastructure_setup/traefik/README.md rename to setup/cluster/traefik/README.md diff --git a/infrastructure_setup/traefik/internal-middleware.yaml b/setup/cluster/traefik/internal-middleware.yaml similarity index 100% rename from infrastructure_setup/traefik/internal-middleware.yaml rename to setup/cluster/traefik/internal-middleware.yaml diff --git a/infrastructure_setup/traefik/traefik-service.yaml b/setup/cluster/traefik/traefik-service.yaml similarity index 100% rename from infrastructure_setup/traefik/traefik-service.yaml rename to setup/cluster/traefik/traefik-service.yaml diff --git a/infrastructure_setup/utils/netdebug.yaml b/setup/cluster/utils/netdebug.yaml similarity index 100% rename from infrastructure_setup/utils/netdebug.yaml rename to setup/cluster/utils/netdebug.yaml diff --git a/infrastructure_setup/validate_setup.sh b/setup/cluster/validate-setup.sh similarity index 100% rename from infrastructure_setup/validate_setup.sh rename to setup/cluster/validate-setup.sh diff --git a/central-setup/dnsmasq/.gitignore b/setup/dnsmasq/.gitignore similarity index 100% rename from central-setup/dnsmasq/.gitignore rename to setup/dnsmasq/.gitignore diff --git a/central-setup/dnsmasq/.not_logged_in_yet b/setup/dnsmasq/.not_logged_in_yet similarity index 100% rename from central-setup/dnsmasq/.not_logged_in_yet rename to setup/dnsmasq/.not_logged_in_yet diff --git a/central-setup/dnsmasq/README.md b/setup/dnsmasq/README.md similarity index 91% rename from central-setup/dnsmasq/README.md rename to setup/dnsmasq/README.md index 5d5d04d..483117f 100644 --- a/central-setup/dnsmasq/README.md +++ b/setup/dnsmasq/README.md @@ -27,9 +27,8 @@ 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. -- 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` +- Run `setup/dnsmasq/bin/create-setup-bundle.sh` +- Run `setup/dnsmasq/bin/transfer-setup-bundle.sh` Now ssh into your dnsmasq machine and do the following: diff --git a/central-setup/dnsmasq/bare-metal.yaml b/setup/dnsmasq/bare-metal.yaml similarity index 100% rename from central-setup/dnsmasq/bare-metal.yaml rename to setup/dnsmasq/bare-metal.yaml diff --git a/central-setup/dnsmasq/bin/create-setup-bundle.sh b/setup/dnsmasq/bin/create-setup-bundle.sh similarity index 81% rename from central-setup/dnsmasq/bin/create-setup-bundle.sh rename to setup/dnsmasq/bin/create-setup-bundle.sh index aed85c2..4c5bcb6 100755 --- a/central-setup/dnsmasq/bin/create-setup-bundle.sh +++ b/setup/dnsmasq/bin/create-setup-bundle.sh @@ -1,30 +1,15 @@ #!/bin/bash -# Set up - -# Initialize wildcloud environment. - if [ ! -d ".wildcloud" ]; then echo "Error: You must run this script from a wild-cloud directory" exit 1 fi -WILDCLOUD_CONFIG_FILE="./config.yaml" -if [ ! -f ${WILDCLOUD_CONFIG_FILE} ]; then - echo "Error: ${WILDCLOUD_CONFIG_FILE} not found" - exit 1 -fi - - -WILDCLOUD_ROOT=$(yq eval '.wildcloud.root' ${WILDCLOUD_CONFIG_FILE}) -if [ -z "${WILDCLOUD_ROOT}" ] || [ "${WILDCLOUD_ROOT}" = "null" ]; then - echo "Error: wildcloud.root not found in ${WILDCLOUD_CONFIG_FILE}" - exit 1 -fi +WILDCLOUD_ROOT=$(wild-config wildcloud.root) || exit 1 # --- -DNSMASQ_SETUP_DIR="./cluster/dnsmasq" +DNSMASQ_SETUP_DIR="./setup/dnsmasq" BUNDLE_DIR="${DNSMASQ_SETUP_DIR}/setup-bundle" mkdir -p "${BUNDLE_DIR}" @@ -47,7 +32,7 @@ fi echo "Successfully created Talos bare metal boot assets with ID: ${TALOS_ID}" # Download kernel to ipxe-web if it's not already there. -TALOS_VERSION=$(wild-config .cluster.nodes.talos.version) || exit 1 +TALOS_VERSION=$(wild-config cluster.nodes.talos.version) || exit 1 if [ ! -f "${PXE_WEB_ROOT}/amd64/vmlinuz" ]; then echo "Downloading Talos kernel..." wget -O "${PXE_WEB_ROOT}/amd64/vmlinuz" "https://pxe.factory.talos.dev/image/${TALOS_ID}/${TALOS_VERSION}/kernel-amd64" diff --git a/central-setup/dnsmasq/bin/setup.sh b/setup/dnsmasq/bin/setup.sh similarity index 97% rename from central-setup/dnsmasq/bin/setup.sh rename to setup/dnsmasq/bin/setup.sh index 3eb533d..e3eb79a 100755 --- a/central-setup/dnsmasq/bin/setup.sh +++ b/setup/dnsmasq/bin/setup.sh @@ -8,7 +8,7 @@ sudo apt-get update echo "Installing dnsmasq and nginx." sudo apt install -y dnsmasq nginx -DNSMASQ_SETUP_DIR="/tmp/dnsmasq-setup" +DNSMASQ_SETUP_DIR="." PXE_FTPD_DIR="${DNSMASQ_SETUP_DIR}/pxe-ftpd" PXE_WEB_ROOT="${DNSMASQ_SETUP_DIR}/pxe-web" diff --git a/central-setup/dnsmasq/bin/transfer-setup-bundle.sh b/setup/dnsmasq/bin/transfer-setup-bundle.sh similarity index 89% rename from central-setup/dnsmasq/bin/transfer-setup-bundle.sh rename to setup/dnsmasq/bin/transfer-setup-bundle.sh index dd28d6e..1d71a1d 100755 --- a/central-setup/dnsmasq/bin/transfer-setup-bundle.sh +++ b/setup/dnsmasq/bin/transfer-setup-bundle.sh @@ -6,7 +6,7 @@ if [ ! -d ".wildcloud" ]; then fi SERVER_HOST=$(wild-config cloud.dns.ip2) || exit 1 -SETUP_DIR="./cluster/dnsmasq/setup-bundle" +SETUP_DIR="./setup/dnsmasq/setup-bundle" DESTINATION_DIR="~/dnsmasq-setup" echo "Copying DNSMasq setup files to ${SERVER_HOST}:${DESTINATION_DIR}..." diff --git a/central-setup/dnsmasq/boot.ipxe b/setup/dnsmasq/boot.ipxe similarity index 100% rename from central-setup/dnsmasq/boot.ipxe rename to setup/dnsmasq/boot.ipxe diff --git a/central-setup/dnsmasq/dnsmasq.conf b/setup/dnsmasq/dnsmasq.conf similarity index 100% rename from central-setup/dnsmasq/dnsmasq.conf rename to setup/dnsmasq/dnsmasq.conf diff --git a/central-setup/dnsmasq/dnsmasq.reference b/setup/dnsmasq/dnsmasq.reference similarity index 100% rename from central-setup/dnsmasq/dnsmasq.reference rename to setup/dnsmasq/dnsmasq.reference diff --git a/central-setup/dnsmasq/nginx.conf b/setup/dnsmasq/nginx.conf similarity index 100% rename from central-setup/dnsmasq/nginx.conf rename to setup/dnsmasq/nginx.conf