Add container/VM autodiscovery, optional username in config, and management scripts
All checks were successful
Build-Publish / build (linux/amd64) (push) Successful in 4s
Build-Publish / build (linux/arm64) (push) Successful in 13s
Build-Publish / create-manifest (push) Successful in 1s
Build-Publish / publish-template (push) Successful in 15s

This commit is contained in:
j
2026-03-08 09:57:53 +13:00
parent ce55d6acc7
commit 8747209181
7 changed files with 270 additions and 6 deletions

19
infmap/check-config.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
source "${AGENT_PATH}/common.sh"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR" || exit 1
_check_required_env_vars "CONTAINER_NAME" "WEB_PORT" "SSH_KEY_PATH"
# Check SSH key exists
[ -f "${SSH_KEY_PATH}" ] || _die "SSH key not found at ${SSH_KEY_PATH}"
# Check infrastructure.conf exists and is non-empty
[ -f "${CONFIG_PATH}/infrastructure.conf" ] || _die "infrastructure.conf not found at ${CONFIG_PATH}/infrastructure.conf"
[ -s "${CONFIG_PATH}/infrastructure.conf" ] || _die "infrastructure.conf is empty"
# Validate infrastructure.conf has at least one server entry
server_count=$(grep -cE '^\s+\S' "${CONFIG_PATH}/infrastructure.conf" 2>/dev/null || echo 0)
[ "$server_count" -gt 0 ] || _die "infrastructure.conf has no server entries"
echo "Config OK: ${server_count} server(s) configured, SSH key present, port ${WEB_PORT}"

11
infmap/reload-config.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
source "${AGENT_PATH}/common.sh"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR" || exit 1
_check_required_env_vars "CONTAINER_NAME"
# Restart to pick up any config changes (infrastructure.conf, service.env)
docker compose -p "${CONTAINER_NAME}" restart || _die "Failed to restart ${CONTAINER_NAME}"
echo "${CONTAINER_NAME} reloaded"