New OPS-centric setup. Integrated with wild-init and wild-setup.

This commit is contained in:
2025-06-21 14:22:22 -07:00
parent e55b9b2b8c
commit f90baac653
70 changed files with 128 additions and 197 deletions

View File

@@ -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."

82
bin/wild-setup Executable file
View File

@@ -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"

View File

@@ -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`!

View File

@@ -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

View File

@@ -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

17
setup/README.md Normal file
View File

@@ -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
```

View File

@@ -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:

View File

@@ -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"

View File

@@ -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"

View File

@@ -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}..."