Initial commit.

This commit is contained in:
2025-10-11 17:15:56 +00:00
commit 2b61d99951
23 changed files with 1755 additions and 0 deletions

10
debian/DEBIAN/control vendored Normal file
View File

@@ -0,0 +1,10 @@
Package: wild-cloud-central
Version: VERSION_PLACEHOLDER
Section: net
Priority: optional
Architecture: ARCH_PLACEHOLDER
Depends: dnsmasq, nginx
Maintainer: Wild Cloud Team <paul@payne.io>
Description: Wild Cloud Central Management Service
A web-based management service for wild-cloud infrastructure
providing DNS, DHCP, and PXE boot services configuration.

62
debian/DEBIAN/postinst vendored Normal file
View File

@@ -0,0 +1,62 @@
#!/bin/bash
set -e
case "$1" in
configure)
echo "Configuring wild-cloud-central..."
# Create wildcloud user if it doesn't exist
if ! id wildcloud >/dev/null 2>&1; then
useradd --system --home-dir /var/lib/wild-cloud-central --create-home --shell /bin/false wildcloud
fi
# Create required directories
mkdir -p /var/lib/wild-cloud-central
mkdir -p /var/log/wild-cloud-central
mkdir -p /var/www/html/talos
mkdir -p /var/ftpd
# Set ownership of wildcloud-managed files and directories
chown wildcloud:wildcloud /var/lib/wild-cloud-central
chown wildcloud:wildcloud /var/log/wild-cloud-central
# Force ownership of talos directory (critical for PXE assets)
echo "Setting ownership of /var/www/html/talos/ to wildcloud"
chown -R wildcloud:wildcloud /var/www/html/talos/
echo "Setting ownership of /var/ftpd/ to wildcloud"
chown -R wildcloud:wildcloud /var/ftpd
# Set ownership of dnsmasq.conf if it exists
if [ -f /etc/dnsmasq.conf ]; then
chown wildcloud:wildcloud /etc/dnsmasq.conf
# TODO: /etc/dnsmasq.d/wild-cloud.conf
fi
# Install sudoers file
if [ -f /etc/wild-cloud-central/wild-cloud-central.sudoers ]; then
mkdir -p /etc/sudoers.d
cp /etc/wild-cloud-central/wild-cloud-central.sudoers /etc/sudoers.d/wild-cloud-central
chmod 440 /etc/sudoers.d/wild-cloud-central
fi
# Enable and start the service
systemctl daemon-reload
systemctl enable wild-cloud-central.service
echo "wild-cloud-central configured successfully"
echo "Start the service with: sudo systemctl start wild-cloud-central"
echo "View logs with: sudo journalctl -u wild-cloud-central -f"
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

46
debian/DEBIAN/postrm vendored Normal file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
set -e
case "$1" in
purge)
echo "Purging wild-cloud-central configuration..."
# Remove sudoers file
if [ -f /etc/sudoers.d/wild-cloud-central ]; then
rm -f /etc/sudoers.d/wild-cloud-central
fi
# Remove configuration directory
if [ -d /etc/wild-cloud-central ]; then
rm -rf /etc/wild-cloud-central
fi
# Remove log directory
if [ -d /var/log/wild-cloud-central ]; then
rm -rf /var/log/wild-cloud-central
fi
# Remove lib directory
if [ -d /var/lib/wild-cloud-central ]; then
rm -rf /var/lib/wild-cloud-central
fi
# Remove wildcloud user
if id wildcloud >/dev/null 2>&1; then
userdel wildcloud || true
fi
echo "wild-cloud-central purged successfully"
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

28
debian/DEBIAN/prerm vendored Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -e
case "$1" in
remove|upgrade|deconfigure)
echo "Stopping wild-cloud-central service..."
# Stop and disable the service
if systemctl is-active --quiet wild-cloud-central; then
systemctl stop wild-cloud-central
fi
if systemctl is-enabled --quiet wild-cloud-central; then
systemctl disable wild-cloud-central
fi
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

View File

@@ -0,0 +1,41 @@
server {
listen 80;
server_name _;
# Wild Central Management Interface
root /var/www/html/wild-central;
index index.html;
# API proxy to wild-cloud-central service
location /api/ {
proxy_pass http://localhost:5055;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Serve Talos PXE boot assets
location /talos/ {
alias /var/www/html/talos/;
autoindex on;
add_header Cache-Control "public, max-age=3600";
}
# iPXE boot script
location /boot.ipxe {
root /var/www/html/talos;
add_header Content-Type "text/plain";
}
# Kernel and initramfs
location /amd64/ {
alias /var/www/html/talos/amd64/;
add_header Cache-Control "public, max-age=86400";
}
# Static files
location / {
try_files $uri $uri/ =404;
}
}

View File

@@ -0,0 +1,27 @@
[Unit]
Description=Wild Cloud Central Service
Documentation=https://github.com/wildcloud/wild-central
After=network.target
Wants=network.target
[Service]
Type=simple
User=wildcloud
Group=wildcloud
ExecStart=/usr/bin/wild-cloud-central
Restart=always
RestartSec=5
Environment=CONFIG_PATH=/etc/wild-cloud-central/config.yaml
StandardOutput=journal
StandardError=journal
SyslogIdentifier=wild-cloud-central
# Security settings
NoNewPrivileges=no
PrivateTmp=yes
ProtectSystem=no
ProtectHome=yes
ReadWritePaths=/etc/wild-cloud-central /var/lib/wild-cloud-central /var/log/wild-cloud-central /etc/dnsmasq.conf /var/www/html/talos /var/ftpd
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,18 @@
server:
port: 5055
host: 0.0.0.0
cloud:
domain: wildcloud.local
internalDomain: cluster.local
dns:
ip: 192.168.8.50
router:
ip: 192.168.8.1
dhcpRange: 192.168.8.100,192.168.8.200
dnsmasq:
interface: eth0
cluster:
endpointIp: 192.168.8.60
nodes:
talos:
version: v1.8.0

View File

@@ -0,0 +1,2 @@
# Allow wildcloud user to manage dnsmasq service without password
wildcloud ALL=NOPASSWD: /usr/bin/systemctl start dnsmasq.service, /usr/bin/systemctl stop dnsmasq.service, /usr/bin/systemctl restart dnsmasq.service, /usr/bin/systemctl status dnsmasq.service