Repository navigation
feat(ct): create Komodo Periphery LXC with native agent #2429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
soflane
wants to merge
4
commits into
community-scripts:main
Choose a base branch
from
soflane:feat/komodo-periphery-addon
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
02b4932
feat: add native Komodo Periphery addon
soflane 879fcb7
fix: move Periphery instructions into frontend metadata
soflane 131c1c0
feat(ct): add Komodo Periphery LXC creation and simplify native addon
soflane 084fe1a
refactor: simplify Komodo Periphery installation and updates
soflane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| 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." | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?