Skip to content

Commit 7c48823

Browse files
authored
komodo: migrate env vars to v2 and update source (#13262)
Update Komodo addon script: switch source GitHub URL to moghtech, create a timestamped backup of the compose env before updating, and add migrations for Komodo v2. Migrate image tag from 'latest' to ':2', rename DB credential variables (KOMODO_DB_* -> KOMODO_DATABASE_*), remove the deprecated KOMODO_PASSKEY, and ensure COMPOSE_KOMODO_BACKUPS_PATH is set. Adjust install routine to stop generating/setting PASSKEY and to use the new DATABASE variable names.
1 parent 8e4d174 commit 7c48823

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

ct/alpine-komodo.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ function update_script() {
3535
read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM
3636
if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then
3737
msg_warn "Migration skipped. The old update will continue to work for now."
38+
msg_warn "⚠️ Komodo v2 uses :2 image tags. The :latest tag is deprecated and will not receive v2 updates."
39+
msg_warn "Please migrate to the addon script to receive Komodo v2."
3840
msg_info "Updating ${APP} (legacy)"
3941
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
4042
if [[ -z "$COMPOSE_FILE" ]]; then

ct/komodo.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ function update_script() {
3939
read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM
4040
if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then
4141
msg_warn "Migration skipped. The old update will continue to work for now."
42+
msg_warn "⚠️ Komodo v2 uses :2 image tags. The :latest tag is deprecated and will not receive v2 updates."
43+
msg_warn "Please migrate to the addon script to receive Komodo v2."
4244
msg_info "Updating ${APP} (legacy)"
4345
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
4446
if [[ -z "$COMPOSE_FILE" ]]; then

tools/addon/komodo.sh

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2021-2026 community-scripts ORG
44
# Author: MickLesk (CanbiZ)
55
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6-
# Source: https://komo.do/ | Github: https://github.com/mbecker20/komodo
6+
# Source: https://komo.do/ | Github: https://github.com/moghtech/komodo
77
if ! command -v curl &>/dev/null; then
88
printf "\r\e[2K%b" '\033[93m Setup Source \033[m' >&2
99
apt-get update >/dev/null 2>&1 || apk update >/dev/null 2>&1
@@ -82,6 +82,7 @@ function update() {
8282
msg_error "Failed to create backup of ${COMPOSE_BASENAME}!"
8383
exit 235
8484
}
85+
cp "$COMPOSE_ENV" "${COMPOSE_ENV}.bak_$(date +%Y%m%d_%H%M%S)" 2>/dev/null || true
8586

8687
GITHUB_URL="https://raw.githubusercontent.com/moghtech/komodo/main/compose/${COMPOSE_BASENAME}"
8788
if ! curl -fsSL "$GITHUB_URL" -o "$COMPOSE_FILE"; then
@@ -90,8 +91,29 @@ function update() {
9091
exit 115
9192
fi
9293

93-
if ! grep -qxF 'COMPOSE_KOMODO_BACKUPS_PATH=/etc/komodo/backups' "$COMPOSE_ENV"; then
94-
sed -i '/^COMPOSE_KOMODO_IMAGE_TAG=latest$/a COMPOSE_KOMODO_BACKUPS_PATH=/etc/komodo/backups' "$COMPOSE_ENV"
94+
# === v2 migration: image tag (latest is deprecated) ===
95+
if grep -q '^COMPOSE_KOMODO_IMAGE_TAG=latest' "$COMPOSE_ENV"; then
96+
msg_info "Migrating to Komodo v2 image tag"
97+
sed -i 's/^COMPOSE_KOMODO_IMAGE_TAG=latest/COMPOSE_KOMODO_IMAGE_TAG=2/' "$COMPOSE_ENV"
98+
msg_ok "Migrated image tag to :2"
99+
fi
100+
101+
# === v2 migration: DB credential variable names ===
102+
if grep -q '^KOMODO_DB_USERNAME=' "$COMPOSE_ENV"; then
103+
msg_info "Migrating database credential variables"
104+
sed -i 's/^KOMODO_DB_USERNAME=/KOMODO_DATABASE_USERNAME=/' "$COMPOSE_ENV"
105+
sed -i 's/^KOMODO_DB_PASSWORD=/KOMODO_DATABASE_PASSWORD=/' "$COMPOSE_ENV"
106+
msg_ok "Migrated DB credential variables"
107+
fi
108+
109+
# === v2 migration: remove deprecated passkey (replaced by PKI) ===
110+
if grep -q '^KOMODO_PASSKEY=' "$COMPOSE_ENV"; then
111+
sed -i '/^KOMODO_PASSKEY=/d' "$COMPOSE_ENV"
112+
fi
113+
114+
# === ensure backups path is set ===
115+
if ! grep -q 'COMPOSE_KOMODO_BACKUPS_PATH=' "$COMPOSE_ENV"; then
116+
echo 'COMPOSE_KOMODO_BACKUPS_PATH=/etc/komodo/backups' >>"$COMPOSE_ENV"
95117
fi
96118

97119
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file "$COMPOSE_ENV" pull
@@ -192,14 +214,12 @@ function install() {
192214

193215
DB_PASSWORD=$(openssl rand -base64 16 | tr -d '/+=')
194216
ADMIN_PASSWORD=$(openssl rand -base64 8 | tr -d '/+=')
195-
PASSKEY=$(openssl rand -base64 24 | tr -d '/+=')
196217
WEBHOOK_SECRET=$(openssl rand -base64 24 | tr -d '/+=')
197218
JWT_SECRET=$(openssl rand -base64 24 | tr -d '/+=')
198219

199-
sed -i "s/^KOMODO_DB_USERNAME=.*/KOMODO_DB_USERNAME=komodo_admin/" "$COMPOSE_ENV"
200-
sed -i "s/^KOMODO_DB_PASSWORD=.*/KOMODO_DB_PASSWORD=${DB_PASSWORD}/" "$COMPOSE_ENV"
220+
sed -i "s/^KOMODO_DATABASE_USERNAME=.*/KOMODO_DATABASE_USERNAME=komodo_admin/" "$COMPOSE_ENV"
221+
sed -i "s/^KOMODO_DATABASE_PASSWORD=.*/KOMODO_DATABASE_PASSWORD=${DB_PASSWORD}/" "$COMPOSE_ENV"
201222
sed -i "s/^KOMODO_INIT_ADMIN_PASSWORD=changeme/KOMODO_INIT_ADMIN_PASSWORD=${ADMIN_PASSWORD}/" "$COMPOSE_ENV"
202-
sed -i "s/^KOMODO_PASSKEY=.*/KOMODO_PASSKEY=${PASSKEY}/" "$COMPOSE_ENV"
203223
sed -i "s/^KOMODO_WEBHOOK_SECRET=.*/KOMODO_WEBHOOK_SECRET=${WEBHOOK_SECRET}/" "$COMPOSE_ENV"
204224
sed -i "s/^KOMODO_JWT_SECRET=.*/KOMODO_JWT_SECRET=${JWT_SECRET}/" "$COMPOSE_ENV"
205225
msg_ok "Configured environment"

0 commit comments

Comments
 (0)