Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions ct/komodo-periphery.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main"
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")

# Copyright (c) 2026 community-scripts ORG
# Author: Sofiane A. (soflane)
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
# Source: https://komo.do/ | https://github.com/moghtech/komodo

APP="Komodo-Periphery"
var_tags="${var_tags:-docker;komodo}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-8}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}"
#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified

export var_komodo_core_address="${var_komodo_core_address:-}"
export var_komodo_server_name="${var_komodo_server_name:-}"
export var_komodo_onboarding_key="${var_komodo_onboarding_key:-}"
export var_komodo_core_public_key="${var_komodo_core_public_key:-}"

header_info "$APP"
variables
color
catch_errors

function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -x /opt/komodo-periphery/periphery || ! -f /etc/komodo/periphery.config.json ]]; then
msg_error "No Komodo Periphery installation found!"
exit 233
fi

addon_script=$(curl -fsSL "${COMMUNITY_SCRIPTS_URL}/tools/addon/komodo-periphery.sh")
type=update bash -c "$addon_script"
exit
}

if on_pve_host; then
if is_unattended && [[ -z "$var_komodo_core_address" || -z "$var_komodo_onboarding_key" ]]; then
msg_error "Supply var_komodo_core_address and var_komodo_onboarding_key before creating the Komodo Periphery LXC."
exit 1
fi
var_komodo_core_address=$(prompt_input_required "Komodo Core URL:" "" 120 "var_komodo_core_address")
if [[ ! "$var_komodo_core_address" =~ ^https?://[^[:space:]/]+(/[^[:space:]]*)?$ ]]; then
msg_error "Komodo Periphery requires an HTTP or HTTPS Core URL without whitespace."
exit 1
fi
if [[ -z "$var_komodo_onboarding_key" ]] && ! is_unattended; then
read -r -s -p "${TAB3}Komodo Server Onboarding Key: " var_komodo_onboarding_key </dev/tty || true
echo
fi
if [[ -z "$var_komodo_onboarding_key" ]]; then
msg_error "A Komodo Server Onboarding Key is required before creating the LXC."
exit 1
fi
fi

start
build_container
description

msg_ok "Komodo Periphery LXC created successfully!"
echo -e "${INFO}Confirm the new server connection in Komodo Core."
echo -e "${INFO}Update the agent inside the LXC with update_komodo_periphery."
22 changes: 22 additions & 0 deletions install/komodo-periphery-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Copyright (c) 2026 community-scripts ORG
# Author: Sofiane A. (soflane)
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
# Source: https://komo.do/ | https://github.com/moghtech/komodo

source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os

addon_script=$(curl -fsSL "${COMMUNITY_SCRIPTS_URL}/tools/addon/komodo-periphery.sh")
bash -c "$addon_script"
unset var_komodo_onboarding_key

motd_ssh
customize
cleanup_lxc
73 changes: 73 additions & 0 deletions json/komodo-periphery.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "Komodo Periphery",
"slug": "komodo-periphery",
"categories": [
3
],
"date_created": "2026-10-14",
"type": "ct",
"updateable": true,
"privileged": false,
"platforms": [
"pve"
],
"interface_port": null,
"documentation": "https://komo.do/docs/setup/connect-servers",
"website": "https://komo.do/",
"repository": "https://github.com/moghtech/komodo",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/komodo.webp",
"description": "A Docker LXC with the native Komodo Periphery agent, connecting to an existing Core for centralized container and Compose stack management.",
"install_methods": [
{
"type": "default",
"script": "ct/komodo-periphery.sh",
"config_path": "/etc/komodo/periphery.config.json",
"resources": {
"cpu": 2,
"ram": 2048,
"hdd": 8,
"os": "Debian",
"version": "13"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"app_vars": [
{
"name": "var_komodo_core_address",
"label": "Komodo Core URL",
"type": "text",
"required": true,
"help": "Reachable HTTP or HTTPS Core URL, such as https://komodo.example.com."
},
{
"name": "var_komodo_server_name",
"label": "Komodo Server Name",
"type": "text",
"help": "Server name in Core; defaults to the guest hostname."
},
{
"name": "var_komodo_onboarding_key",
"label": "Server Onboarding Key",
"type": "password",
"secret": true,
"required": true,
"help": "Create a Server Onboarding Key in Komodo Core before installation."
},
{
"name": "var_komodo_core_public_key",
"label": "Core Public Key",
"type": "text",
"help": "Optional Core public key; defaults to trusting and pinning the first Core in /etc/komodo/keys/core.pub."
}
],
"notes": [
{
"text": "Create an onboarding key in Komodo Core before installation, then confirm the server is connected.",
"type": "info"
}
]
}
155 changes: 155 additions & 0 deletions tools/addon/komodo-periphery.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#!/usr/bin/env bash

# Copyright (c) 2026 community-scripts ORG
# Author: Sofiane A. (soflane)
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
# Source: https://komo.do/ | https://github.com/moghtech/komodo

set -e
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/core.func")
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/lib/tools.func")
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/error_handler.func")

APP="Komodo Periphery"
APP_TYPE="addon"
NSAPP="komodo-periphery"
BACKUP_DIR="/opt/${NSAPP}.backup"
INSTALL_PATH="/opt/komodo-periphery"
CONFIG_PATH="/etc/komodo/periphery.config.json"
COMMUNITY_SCRIPTS_URL="${COMMUNITY_SCRIPTS_URL:-https://raw.githubusercontent.com/community-scripts/DevScripts/main}"

load_functions
catch_errors
header_info "$APP"

root_check
if on_pve_host; then
msg_error "Run the Komodo Periphery addon inside an LXC or VM, not on the Proxmox VE host."
exit 232
fi
require_debian_like
arch_check

if [[ -x "${INSTALL_PATH}/periphery" && -f "$CONFIG_PATH" && -f /etc/systemd/system/periphery.service ]]; then
type=update
elif [[ "${type:-}" == "update" || -e "$INSTALL_PATH" || -e "$CONFIG_PATH" ||
-e /etc/komodo/periphery.config.toml || -e /etc/komodo/keys/periphery.key ||
-e /etc/systemd/system/periphery.service ]]; then
msg_error "Komodo Periphery installation is missing, incomplete or managed by another installer."
exit 233
else
type=install
fi

if [[ "$type" == "install" ]]; then
if is_unattended && [[ -z "${var_komodo_core_address:-}" || -z "${var_komodo_onboarding_key:-}" ]]; then
msg_error "Supply var_komodo_core_address and var_komodo_onboarding_key for unattended Komodo Periphery installation."
exit 1
fi
var_komodo_core_address=$(prompt_input_required "Komodo Core URL:" "" 120 "var_komodo_core_address")
if [[ ! "$var_komodo_core_address" =~ ^https?://[^[:space:]/]+(/[^[:space:]]*)?$ ]]; then
msg_error "Komodo Periphery requires an HTTP or HTTPS Core URL without whitespace."
exit 1
fi
var_komodo_server_name=$(prompt_input_required "Komodo server name:" "$(hostname)" 120 "var_komodo_server_name")
if [[ -z "${var_komodo_onboarding_key:-}" ]] && ! is_unattended; then
read -r -s -p "${TAB3}Komodo Server Onboarding Key: " var_komodo_onboarding_key </dev/tty || true
echo
fi
if [[ -z "${var_komodo_onboarding_key:-}" ]]; then
msg_error "Supply var_komodo_onboarding_key or enter a Komodo Server Onboarding Key interactively."
exit 1
fi
setup_docker
ensure_dependencies git jq
fi

$STD docker info
$STD docker compose version

if [[ "$type" == "update" ]]; then
if check_for_gh_release "periphery" "moghtech/komodo"; then
create_backup "${INSTALL_PATH}/periphery" "$HOME/.periphery"

msg_info "Stopping Komodo Periphery"
systemctl stop periphery
msg_ok "Stopped Komodo Periphery"

fetch_and_deploy_gh_release "periphery" "moghtech/komodo" "singlefile" "latest" "$INSTALL_PATH" \
"periphery-$(arch_resolve "x86_64" "aarch64")"

msg_info "Starting Komodo Periphery"
systemctl start periphery
sleep 2
$STD systemctl is-active --quiet periphery
msg_ok "Started Komodo Periphery"
rm -rf "$BACKUP_DIR"
else
update_status=$?
if [[ "$update_status" -ne 1 ]]; then
msg_error "Could not check Komodo Periphery releases."
exit "$update_status"
fi
$STD systemctl is-active --quiet periphery
fi
else
fetch_and_deploy_gh_release "periphery" "moghtech/komodo" "singlefile" "latest" "$INSTALL_PATH" \
"periphery-$(arch_resolve "x86_64" "aarch64")"

msg_info "Configuring Komodo Periphery"
command install -d -m 700 /etc/komodo /etc/komodo/keys
command install -m 600 /dev/null "$CONFIG_PATH"
jq -n \
--arg address "$var_komodo_core_address" \
--arg name "$var_komodo_server_name" \
--arg key "$var_komodo_onboarding_key" \
--arg core_key "${var_komodo_core_public_key:-file:/etc/komodo/keys/core.pub}" \
'{root_directory: "/etc/komodo", core_address: $address, connect_as: $name,
onboarding_key: $key, core_public_keys: $core_key, server_enabled: false}' >"$CONFIG_PATH"
unset var_komodo_onboarding_key
msg_ok "Configured Komodo Periphery"

msg_info "Creating Komodo Periphery service"
cat <<'EOF' >/etc/systemd/system/periphery.service
[Unit]
Description=Komodo Periphery agent
Documentation=https://komo.do/docs/setup/connect-servers
Wants=network-online.target
After=network-online.target docker.service
Requires=docker.service

[Service]
Type=simple
User=root
Environment=HOME=/root
WorkingDirectory=/etc/komodo
ExecStart=/opt/komodo-periphery/periphery --config-path /etc/komodo/periphery.config.json
Restart=on-failure
RestartSec=5
UMask=0077

[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now periphery
sleep 2
$STD systemctl is-active --quiet periphery
msg_ok "Created Komodo Periphery service"
fi

msg_info "Creating Komodo Periphery update command"
printf -v scripts_url '%q' "$COMMUNITY_SCRIPTS_URL"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this hide when verbose mode is off?

printf -v core_url '%q' "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}"
cat <<EOF >/usr/local/bin/update_komodo_periphery
#!/usr/bin/env bash
set -Eeuo pipefail
export COMMUNITY_SCRIPTS_URL=${scripts_url}
export COMMUNITY_SCRIPTS_CORE_URL=${core_url}
addon_script=\$(curl -fsSL "\$COMMUNITY_SCRIPTS_URL/tools/addon/komodo-periphery.sh")
type=update bash -c "\$addon_script"
EOF
chmod 755 /usr/local/bin/update_komodo_periphery
rm -f "${INSTALL_PATH}/version-policy"
msg_ok "Created Komodo Periphery update command"
msg_ok "Komodo Periphery setup completed"
echo -e "${INFO}Confirm the server connection in Komodo Core; check journalctl -u periphery if needed."
Loading