Update keycloak script to support configuration of latest release (v26) (#6322)

* Update keycloak script to support configuration of latest release (v26)

* Add quotes around default credential values

* fix update script

Signed-off-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>

* spelling "restarting"

Signed-off-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>

* remove temp file and spelling

Signed-off-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>

---------

Signed-off-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>
This commit is contained in:
Rémi Bédard-Couture
2025-07-29 06:26:55 -04:00
committed by GitHub
parent 1f101c0bd3
commit 10db421c45
3 changed files with 58 additions and 36 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster)
# Author: tteck (tteckster) | Co-Author: remz1337
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.keycloak.org/
@@ -23,34 +23,39 @@ function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /etc/systemd/system/keycloak.service ]]; then
if [[ ! -d /opt/keycloak ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating ${APP} LXC"
msg_info "Stopping Keycloak"
systemctl stop keycloak
msg_ok "Stopped Keycloak"
msg_info "Updating packages"
$STD apt-get update
$STD apt-get -y upgrade
msg_ok "Updated packages"
RELEASE=$(curl -fsSL https://api.github.com/repos/keycloak/keycloak/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
msg_info "Updating Keycloak to v$RELEASE"
msg_info "Backup old Keycloak"
cd /opt
curl -fsSL "https://github.com/keycloak/keycloak/releases/download/$RELEASE/keycloak-$RELEASE.tar.gz" -o $(basename "https://github.com/keycloak/keycloak/releases/download/$RELEASE/keycloak-$RELEASE.tar.gz")
mv keycloak keycloak.old
tar -xzf keycloak-$RELEASE.tar.gz
cp -r keycloak.old/conf keycloak-$RELEASE
cp -r keycloak.old/providers keycloak-$RELEASE
cp -r keycloak.old/themes keycloak-$RELEASE
mv keycloak-$RELEASE keycloak
tar -czf keycloak_conf_backup.tar.gz keycloak.old/conf
msg_ok "Backup done"
msg_info "Delete temporary installation files"
rm keycloak-$RELEASE.tar.gz
fetch_and_deploy_gh_release "keycloak" "keycloak/keycloak" "prebuild" "latest" "/opt/keycloak" "keycloak-*.tar.gz"
msg_info "Updating ${APP}"
cd /opt
mv keycloak_conf_backup.tar.gz keycloak/conf
cp -r keycloak.old/providers keycloak
cp -r keycloak.old/themes keycloak
rm -rf keycloak.old
msg_ok "Updated ${APP} LXC"
msg_info "Restating Keycloak"
msg_info "Restarting Keycloak"
systemctl restart keycloak
msg_ok "Updated Successfully"
msg_ok "Restarted Keycloak"
exit
}