mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-03-31 06:34:17 -04:00
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.
This commit is contained in:
committed by
GitHub
parent
8e4d174a65
commit
7c4882384f
@@ -35,6 +35,8 @@ function update_script() {
|
|||||||
read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM
|
read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM
|
||||||
if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then
|
if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then
|
||||||
msg_warn "Migration skipped. The old update will continue to work for now."
|
msg_warn "Migration skipped. The old update will continue to work for now."
|
||||||
|
msg_warn "⚠️ Komodo v2 uses :2 image tags. The :latest tag is deprecated and will not receive v2 updates."
|
||||||
|
msg_warn "Please migrate to the addon script to receive Komodo v2."
|
||||||
msg_info "Updating ${APP} (legacy)"
|
msg_info "Updating ${APP} (legacy)"
|
||||||
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
|
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
|
||||||
if [[ -z "$COMPOSE_FILE" ]]; then
|
if [[ -z "$COMPOSE_FILE" ]]; then
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ function update_script() {
|
|||||||
read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM
|
read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM
|
||||||
if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then
|
if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then
|
||||||
msg_warn "Migration skipped. The old update will continue to work for now."
|
msg_warn "Migration skipped. The old update will continue to work for now."
|
||||||
|
msg_warn "⚠️ Komodo v2 uses :2 image tags. The :latest tag is deprecated and will not receive v2 updates."
|
||||||
|
msg_warn "Please migrate to the addon script to receive Komodo v2."
|
||||||
msg_info "Updating ${APP} (legacy)"
|
msg_info "Updating ${APP} (legacy)"
|
||||||
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
|
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
|
||||||
if [[ -z "$COMPOSE_FILE" ]]; then
|
if [[ -z "$COMPOSE_FILE" ]]; then
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# Copyright (c) 2021-2026 community-scripts ORG
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
# Author: MickLesk (CanbiZ)
|
# Author: MickLesk (CanbiZ)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
# Source: https://komo.do/ | Github: https://github.com/mbecker20/komodo
|
# Source: https://komo.do/ | Github: https://github.com/moghtech/komodo
|
||||||
if ! command -v curl &>/dev/null; then
|
if ! command -v curl &>/dev/null; then
|
||||||
printf "\r\e[2K%b" '\033[93m Setup Source \033[m' >&2
|
printf "\r\e[2K%b" '\033[93m Setup Source \033[m' >&2
|
||||||
apt-get update >/dev/null 2>&1 || apk update >/dev/null 2>&1
|
apt-get update >/dev/null 2>&1 || apk update >/dev/null 2>&1
|
||||||
@@ -82,6 +82,7 @@ function update() {
|
|||||||
msg_error "Failed to create backup of ${COMPOSE_BASENAME}!"
|
msg_error "Failed to create backup of ${COMPOSE_BASENAME}!"
|
||||||
exit 235
|
exit 235
|
||||||
}
|
}
|
||||||
|
cp "$COMPOSE_ENV" "${COMPOSE_ENV}.bak_$(date +%Y%m%d_%H%M%S)" 2>/dev/null || true
|
||||||
|
|
||||||
GITHUB_URL="https://raw.githubusercontent.com/moghtech/komodo/main/compose/${COMPOSE_BASENAME}"
|
GITHUB_URL="https://raw.githubusercontent.com/moghtech/komodo/main/compose/${COMPOSE_BASENAME}"
|
||||||
if ! curl -fsSL "$GITHUB_URL" -o "$COMPOSE_FILE"; then
|
if ! curl -fsSL "$GITHUB_URL" -o "$COMPOSE_FILE"; then
|
||||||
@@ -90,8 +91,29 @@ function update() {
|
|||||||
exit 115
|
exit 115
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -qxF 'COMPOSE_KOMODO_BACKUPS_PATH=/etc/komodo/backups' "$COMPOSE_ENV"; then
|
# === v2 migration: image tag (latest is deprecated) ===
|
||||||
sed -i '/^COMPOSE_KOMODO_IMAGE_TAG=latest$/a COMPOSE_KOMODO_BACKUPS_PATH=/etc/komodo/backups' "$COMPOSE_ENV"
|
if grep -q '^COMPOSE_KOMODO_IMAGE_TAG=latest' "$COMPOSE_ENV"; then
|
||||||
|
msg_info "Migrating to Komodo v2 image tag"
|
||||||
|
sed -i 's/^COMPOSE_KOMODO_IMAGE_TAG=latest/COMPOSE_KOMODO_IMAGE_TAG=2/' "$COMPOSE_ENV"
|
||||||
|
msg_ok "Migrated image tag to :2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# === v2 migration: DB credential variable names ===
|
||||||
|
if grep -q '^KOMODO_DB_USERNAME=' "$COMPOSE_ENV"; then
|
||||||
|
msg_info "Migrating database credential variables"
|
||||||
|
sed -i 's/^KOMODO_DB_USERNAME=/KOMODO_DATABASE_USERNAME=/' "$COMPOSE_ENV"
|
||||||
|
sed -i 's/^KOMODO_DB_PASSWORD=/KOMODO_DATABASE_PASSWORD=/' "$COMPOSE_ENV"
|
||||||
|
msg_ok "Migrated DB credential variables"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# === v2 migration: remove deprecated passkey (replaced by PKI) ===
|
||||||
|
if grep -q '^KOMODO_PASSKEY=' "$COMPOSE_ENV"; then
|
||||||
|
sed -i '/^KOMODO_PASSKEY=/d' "$COMPOSE_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# === ensure backups path is set ===
|
||||||
|
if ! grep -q 'COMPOSE_KOMODO_BACKUPS_PATH=' "$COMPOSE_ENV"; then
|
||||||
|
echo 'COMPOSE_KOMODO_BACKUPS_PATH=/etc/komodo/backups' >>"$COMPOSE_ENV"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file "$COMPOSE_ENV" pull
|
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file "$COMPOSE_ENV" pull
|
||||||
@@ -192,14 +214,12 @@ function install() {
|
|||||||
|
|
||||||
DB_PASSWORD=$(openssl rand -base64 16 | tr -d '/+=')
|
DB_PASSWORD=$(openssl rand -base64 16 | tr -d '/+=')
|
||||||
ADMIN_PASSWORD=$(openssl rand -base64 8 | tr -d '/+=')
|
ADMIN_PASSWORD=$(openssl rand -base64 8 | tr -d '/+=')
|
||||||
PASSKEY=$(openssl rand -base64 24 | tr -d '/+=')
|
|
||||||
WEBHOOK_SECRET=$(openssl rand -base64 24 | tr -d '/+=')
|
WEBHOOK_SECRET=$(openssl rand -base64 24 | tr -d '/+=')
|
||||||
JWT_SECRET=$(openssl rand -base64 24 | tr -d '/+=')
|
JWT_SECRET=$(openssl rand -base64 24 | tr -d '/+=')
|
||||||
|
|
||||||
sed -i "s/^KOMODO_DB_USERNAME=.*/KOMODO_DB_USERNAME=komodo_admin/" "$COMPOSE_ENV"
|
sed -i "s/^KOMODO_DATABASE_USERNAME=.*/KOMODO_DATABASE_USERNAME=komodo_admin/" "$COMPOSE_ENV"
|
||||||
sed -i "s/^KOMODO_DB_PASSWORD=.*/KOMODO_DB_PASSWORD=${DB_PASSWORD}/" "$COMPOSE_ENV"
|
sed -i "s/^KOMODO_DATABASE_PASSWORD=.*/KOMODO_DATABASE_PASSWORD=${DB_PASSWORD}/" "$COMPOSE_ENV"
|
||||||
sed -i "s/^KOMODO_INIT_ADMIN_PASSWORD=changeme/KOMODO_INIT_ADMIN_PASSWORD=${ADMIN_PASSWORD}/" "$COMPOSE_ENV"
|
sed -i "s/^KOMODO_INIT_ADMIN_PASSWORD=changeme/KOMODO_INIT_ADMIN_PASSWORD=${ADMIN_PASSWORD}/" "$COMPOSE_ENV"
|
||||||
sed -i "s/^KOMODO_PASSKEY=.*/KOMODO_PASSKEY=${PASSKEY}/" "$COMPOSE_ENV"
|
|
||||||
sed -i "s/^KOMODO_WEBHOOK_SECRET=.*/KOMODO_WEBHOOK_SECRET=${WEBHOOK_SECRET}/" "$COMPOSE_ENV"
|
sed -i "s/^KOMODO_WEBHOOK_SECRET=.*/KOMODO_WEBHOOK_SECRET=${WEBHOOK_SECRET}/" "$COMPOSE_ENV"
|
||||||
sed -i "s/^KOMODO_JWT_SECRET=.*/KOMODO_JWT_SECRET=${JWT_SECRET}/" "$COMPOSE_ENV"
|
sed -i "s/^KOMODO_JWT_SECRET=.*/KOMODO_JWT_SECRET=${JWT_SECRET}/" "$COMPOSE_ENV"
|
||||||
msg_ok "Configured environment"
|
msg_ok "Configured environment"
|
||||||
|
|||||||
Reference in New Issue
Block a user