Added documentation for the numbus-server

This commit is contained in:
Raphaël Numbus
2026-03-18 13:26:13 +01:00
parent d09e261b14
commit b156bf443e
20 changed files with 581 additions and 161 deletions
+126 -117
View File
@@ -30,23 +30,22 @@ NECESSARY_BACKUP_SERVER_VARIABLES_LIST=(
NETWORK_SUBNET
NETWORK_ROUTER_IP
NETWORK_HOME_SERVER_IP
# SERVICES SETTINGS
SERVICES_DOMAIN_NAME
SERVICES_SELECTED_SYSTEM
SERVICES_SELECTED_WEB_APPLICATIONS
)
OPTIONAL_BACKUP_SERVER_VARIABLES_LIST=(
# SERVICES SETTINGS
SELECTED_DNS_SERVICE_SUBDOMAIN
SELECTED_WEB_APPLICATIONS_SUBDOMAIN
SERVICES_DOMAIN_NAME
SERVICES_SELECTED_SYSTEM_PACKAGES
SERVICES_SELECTED_SYSTEM_SERVICES
SERVICES_SELECTED_WEB_APPLICATIONS
SERVIVCES_SELECTED_WEB_APPLICATIONS_SUBDOMAIN
)
NECESSARY_COMPUTER_VARIABLES_LIST=(
#LIVE TARGET SETTINGS
# LIVE TARGET SETTINGS
LIVE_TARGET_IP
LIVE_TARGET_PASSWD
#COMPUTER SETTINGS
# COMPUTER SETTINGS
COMPUTER_LANGUAGE
COMPUTER_LOCALE
COMPUTER_TIMEZONE
@@ -54,16 +53,22 @@ NECESSARY_COMPUTER_VARIABLES_LIST=(
COMPUTER_USER_EMAIL
COMPUTER_ADMIN_EMAIL
COMPUTER_AUTHORIZED_SSH_PUBKEYS
#NETWORK SETTINGS
NETWORK_SUBNET
NETWORK_ROUTER_IP
NETWORK_HOME_COMPUTER_IP
# USER SETTINGS
USER_ADMINISTRATORS
USER_NORMAL_USERS
)
OPTIONAL_COMPUTER_VARIABLES_LIST=(
# NETWORK SETTINGS
NETWORK_SUBNET
NETWORK_ROUTER_IP
NETWORK_HOME_COMPUTER_IP
# SERVICES SETTINGS
SERVICES_SELECTED_SYSTEM
SERVICES_SELECTED_APPLICATIONS
SERVICES_SELECTED_SYSTEM_PACKAGES
SERVICES_SELECTED_DESKTOP_ENVIRONMENT
SERVICE_SELECTED_GNOME_EXTENSIONS
SERVICES_SELECTED_FLATPAK_APPLICATIONS
SERVICES_SELECTED_WEB_APPLICATIONS
)
NECESSARY_SERVER_VARIABLES_LIST=(
@@ -122,16 +127,18 @@ NECESSARY_TV_VARIABLES_LIST=(
OPTIONAL_TV_VARIABLES_LIST=(
# SERVICES SETTINGS
SERVICES_SELECTED_SYSTEM
SERVICES_SELECTED_SYSTEM_PACKAGES
SERVICES_SELECTED_FLATPAK_APPLICATIONS
SERVICES_SELECTED_WEB_APPLICATIONS
)
# Available services
# Available DNS services
DNS_SERVICES_LIST=(
"pi-hole"
"adguard"
)
# Available services
WEB_APPLICATIONS_LIST=(
"crafty"
"frigate"
@@ -151,6 +158,7 @@ WEB_APPLICATIONS_LIST=(
"vscodium"
)
# Available system services
SYSTEM_SERVICES_LIST=(
"clamav"
"virtualization"
@@ -158,27 +166,27 @@ SYSTEM_SERVICES_LIST=(
# Services descriptions
DNS_SERVICES_DESCRIPTION=(
"Pi-Hole : Simple open-source DNS black hole"
"AdGuard : Feature rich DNS service"
"Pi-hole : Simple, fully open network-wide Ad Blocker"
"AdGuard : Feature-rich network-wide Ad Blocker"
)
WEB_APPLICATIONS_DESCRIPTION=(
"Crafty : A web-based control panel for Minecraft servers"
"Frigate [Home Assistant required] : AI-powered NVR for smart security cameras"
"Gitea : A lightweight, self-hosted Git service like GitHub"
"Home-Assistant : Open-source home automation to control all your devices"
"Homepage : A modern dashboard to organize your applications and services"
"Immich : Self-hosted Google Photos alternative for photos and videos"
"Frigate [Home Assistant required] : NVR with real-time local object detection for IP cameras"
"Gitea : Painless self-hosted Git service"
"Home-Assistant : Open source home automation that puts local control and privacy first"
"Homepage : A modern, secure, highly customizable application dashboard"
"Immich : High performance self-hosted photo and video management solution"
"IT-tools : Handy collection of online tools for developers"
"Jellyfin : A self-hosted media server to stream your movies and music"
"N8n : Workflow automation tool"
"netboot.xyz : PXE boot various OS installers and utilities"
"Nextcloud : A self-hosted productivity platform, like Google Drive & Office"
"Ntfy : Send push notifications to your phone or desktop via HTTP"
"Odoo : Open-source business management suite (ERP & CRM)"
"Passbolt: An open-source, security-first password manager for teams"
"Jellyfin : The Free Software Media System"
"N8n : Workflow automation for technical people"
"netboot.xyz : Network boot various operating system installers and utilities"
"Nextcloud : The most popular self-hosted collaboration platform"
"Ntfy : Send push notifications to your phone or desktop via PUT/POST"
"Odoo : Open Source ERP and CRM"
"Passbolt : Open source password manager for teams"
"Uptime-Kuma : A fancy self-hosted monitoring tool"
"VSCodium : An open-source version of VScode in your web browser"
"VSCodium : Free/Libre Open Source Software Binaries of VS Code"
)
SYSTEM_SERVICES_DESCRIPTION=(
@@ -1032,99 +1040,54 @@ it simple and use defaults) and take care to note down all the passwords. Change
set -euo pipefail
fastfetch --logo nixos --structure ' '
clear
fastfetch --logo nixos --logo-padding-left 4 --structure ' '
cat << EOF
██████ █████ █████
▒██████ ▒███ ▒▒███
▒███▒███ ▒███ █████ ███ █████████████ ▒███████ █████ ███ █████
▒███▒▒██████ ▒▒███ ▒███ ▒▒███▒███▒███ ▒███▒███▒███ ▒███ ███▒▒
▒███ ▒▒█████ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒▒█████
███ ▒▒█████ ▒██████ ▒███ ███ ▒███ ▒███ ▒███ ██████ ▒▒▒▒███
█████ ▒▒█████ ▒▒████████ █████▒███ █████ ████████ ▒▒████████ ██████
▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒
█████████
███▒▒▒▒▒███
▒███ ▒▒▒ ██████ ████████ █████ █████ ██████ ████████
▒▒█████████ ███▒▒███▒▒███▒▒███▒▒███ ▒▒███ ███▒▒███▒▒███▒▒███
▒▒▒▒▒▒▒▒███▒███████ ▒███ ▒▒▒ ▒███ ▒███ ▒███████ ▒███ ▒▒▒
███ ▒███▒███▒▒▒ ▒███ ▒▒███ ███ ▒███▒▒▒ ▒███
▒▒█████████ ▒▒██████ █████ ▒▒█████ ▒▒██████ █████
▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒
EOF
gum style --align center --width 80 --foreground 212 "
██████ █████ █████
▒▒██████ ▒▒███ ▒▒███
▒██████ ▒███ █████ ████ █████████████ ▒███████ █████ ████ █████
▒███▒▒███▒███ ▒███ ▒▒███ ▒▒███▒▒███▒▒███ ▒███▒▒███▒▒███ ▒▒███ ███▒▒
▒███ ▒▒██████ ▒███ ▒▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒▒█████
▒███ ▒▒█████ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒▒▒▒███
█████ ▒▒█████ ▒████████ █████▒███ █████ ████████ ▒▒████████ ██████
▒▒▒▒▒ ▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒
█████████
███▒▒▒▒▒███
▒███ ▒▒▒ ██████ ████████ █████ █████ ██████ ████████
▒▒█████████ ███▒▒███▒▒███▒▒███▒▒███ ▒▒███ ███▒▒███▒▒███▒▒███
▒▒▒▒▒▒▒▒███▒███████ ▒███ ▒▒▒ ▒███ ▒███ ▒███████ ▒███ ▒▒▒
███ ▒███▒███▒▒▒ ▒███ ▒▒███ ███ ▒███▒▒▒ ▒███
▒▒█████████ ▒▒██████ █████ ▒▒█████ ▒▒██████ █████
▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒
"
sleep 1
# Choose the action
ACTION_ANSWER=$(gum choose \
"[1.A] 🌍 Deploy interactively a numbus-server" \
"[1.B] 🌍 Deploy non-interactively (with a config file) a numbus-server" \
"[2.A] 💾 Deploy interactively a numbus-backup-server" \
"[2.B] 💾 Deploy non-interactively (with a config file) a numbus-backup-server" \
"[3.A] 💻 Deploy interactively a numbus-computer" \
"[3.B] 💻 Deploy non-interactively (with a config file) a numbus-computer" \
"[4.A] 📺 Deploy interactively a numbus-tv" \
"[4.B] 📺 Deploy non-interactively (with a config file) a numbus-tv" )
SELECTED_DEVICE=$(gum choose --header "📦 Select the device type to deploy:" \
"numbus-server" \
"numbus-backup-server" \
"numbus-computer" \
"numbus-tv" \
)
if [[ "$ACTION_ANSWER" == "[1] 🌐 Deploy NixOS on a remote machine" ]]; then
TARGET_USER="nixos"
echo -e "\n➡️ Proceeding with deployment…"
gum style --border normal --margin "1" --padding "1 2" --border-foreground 212 "➡️ On the target host : start the computer and boot into the NixOS iso.
Launch a console and set up a new user password"
gum confirm "Do you understand and wish to proceed?" || { echo "❌ Aborting as requested"; exit 1; }
strictly_necessary_information
necessary_information
hierarchy_preparation
setup_ssh
hardware_detection
services_selection
disks_selection
server_config_generation
network_config_generation
services_config_generation
mail_config_generation
disk_config_generation
keys_generation
sum_up
cloudflare_dns_setup
export_configuration
deploy
postrun_action
SELECTED_MODE=$(gum choose --header "🛠️ Select the deployment strategy for ${SELECTED_DEVICE}:" \
"Semi-interactive (recommended - use a config file)" \
"Interactive (manual input)" \
"Update and Maintain (existing installation)" \
)
elif [[ "$ACTION_ANSWER" == "[2] 💽 Deploy NixOS on a remote machine with a file configuration" ]]; then
TARGET_USER="nixos"
echo -e "\n➡️ Proceeding with deployment using a config file…"
gum style --border normal --margin "1" --padding "1 2" --border-foreground 212 "➡️ On the target host : start the computer and boot into the NixOS iso.
Launch a console and set up a new user password"
gum confirm "Do you understand and wish to proceed?" || { echo "❌ Aborting as requested"; exit 1; }
import_variables
hierarchy_preparation
setup_ssh
hardware_detection
disks_selection
server_config_generation
network_config_generation
services_config_generation
mail_config_generation
disk_config_generation
keys_generation
sum_up
cloudflare_dns_setup
export_configuration
deploy
postrun_action
elif [[ "$ACTION_ANSWER" == "[3] 🛠️ Update a NixOS remote machine" ]]; then
if [[ "${SELECTED_MODE}" == "Update and Maintain"* ]]; then
TARGET_USER="numbus-admin"
echo -e "\n➡️ Proceeding with update…"
gum style --border normal --margin "1" --padding "1 2" --border-foreground 212 "➡️ On the target host : make sure the NixOS installation you want
to update is up-and-running, accessible with SSH"
gum confirm "Do you understand and wish to proceed?" || { echo "❌ Aborting as requested."; exit 1; }
echo -e "\n➡️ Proceeding with maintenance/update for ${SELECTED_DEVICE}..."
gum style --border normal --margin "1" --padding "1 2" --border-foreground 212 \
"➡️ Ensure the remote device is powered on and accessible via SSH."
gum confirm "Ready to proceed?" || { echo "❌ Aborted."; exit 1; }
strictly_necessary_information
setup_ssh
# Maintain legacy update sequence
more_information_config
folder_tree_generation
nix_generation
@@ -1132,6 +1095,52 @@ elif [[ "$ACTION_ANSWER" == "[3] 🛠️ Update a NixOS remote machine" ]]; then
congrats
else
echo "Aborting - you did not type 1, 2 or 3"
exit 1
TARGET_USER="nixos"
echo -e "\n➡️ Proceeding with new deployment for ${SELECTED_DEVICE}..."
gum style --border normal --margin "1" --padding "1 2" --border-foreground 212 \
"➡️ On the target host: Boot into the NixOS ISO, launch a console, and set a temporary user password."
gum confirm "Ready to proceed?" || { echo "❌ Aborted."; exit 1; }
if [[ "${SELECTED_MODE}" == "Semi-interactive"* ]]; then
import_variables "${VARS_LIST[@]}" "true"
else
strictly_necessary_information
necessary_information
fi
# Standard Deployment Pipeline
hierarchy_preparation
setup_ssh
hardware_detection
# Server-specific logic
if [[ "${SELECTED_DEVICE}" == "numbus-server" ]]; then
services_selection
fi
disks_selection
server_config_generation
network_config_generation
if [[ "${SELECTED_DEVICE}" == "numbus-server" ]]; then
services_config_generation
fi
# Mail setup for server-grade devices
if [[ "${SELECTED_DEVICE}" == *"server"* ]]; then
mail_config_generation
fi
disk_config_generation
keys_generation
sum_up
if [[ "${SELECTED_DEVICE}" == "numbus-server" ]]; then
cloudflare_dns_setup
fi
export_configuration
deploy
postrun_action
fi