Merge branch 'community-scripts:main' into main

This commit is contained in:
dellthePROgrammer 2025-07-24 14:39:08 -04:00 committed by GitHub
commit ffd16f330e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 54 additions and 42 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/remz1337/ProxmoxVED/pr-keycloak/misc/build.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2025 tteck # Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster) | Co-Author: remz1337 # Author: tteck (tteckster) | Co-Author: remz1337
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -23,11 +23,13 @@ function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -f /etc/systemd/system/keycloak.service ]]; then if [[ ! -d /opt/keycloak ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
RELEASE=$(curl -fsSL https://api.github.com/repos/keycloak/keycloak/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ "${RELEASE}" != "$(cat ~/.keycloak 2>/dev/null)" ]] || [[ ! -f ~/.keycloak ]]; then
msg_info "Stopping ${APP}" msg_info "Stopping ${APP}"
systemctl stop keycloak systemctl stop keycloak
msg_ok "Stopped ${APP}" msg_ok "Stopped ${APP}"
@ -56,6 +58,10 @@ function update_script() {
msg_info "Restating Keycloak" msg_info "Restating Keycloak"
systemctl restart keycloak systemctl restart keycloak
msg_ok "Restated Keycloak" msg_ok "Restated Keycloak"
msg_ok "Update Successful"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi
exit exit
} }
@ -67,6 +73,6 @@ msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080/admin${CL}" echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080/admin${CL}"
echo -e "${TAB}${GN}Temporary admin user:${BL}tmpadm${CL}" #echo -e "${TAB}${GN}Temporary admin user:${BL}tmpadm${CL}"
echo -e "${TAB}${GN}Temporary admin password:${BL}admin123${CL}" #echo -e "${TAB}${GN}Temporary admin password:${BL}admin123${CL}"
echo -e "${INFO}${YW} If you modified ${BL}cache-ispn.xml${YW}: Re-apply your changes to the new file, otherwise leave it unchanged.${CL}" #echo -e "${INFO}${YW} If you modified ${BL}cache-ispn.xml${YW}: Re-apply your changes to the new file, otherwise leave it unchanged.${CL}"

View File

@ -16,14 +16,20 @@ update_os
JAVA_VERSION=21 setup_java JAVA_VERSION=21 setup_java
PG_VERSION=16 setup_postgresql PG_VERSION=16 setup_postgresql
msg_info "Configuring PostgreSQL user" msg_info "Configuring PostgreSQL"
DB_NAME="keycloak" DB_NAME="keycloak"
DB_USER="keycloak" DB_USER="keycloak"
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)" DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';" $STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8';" $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8';"
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;" $STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;"
msg_ok "Configured PostgreSQL user" {
echo "Keycloak Credentials"
echo "Database User: $DB_USER"
echo "Database Password: $DB_PASS"
echo "Database Name: $DB_NAME"
} >>~/keycloak.creds
msg_ok "Configured PostgreSQL"
fetch_and_deploy_gh_release "keycloak" "keycloak/keycloak" "prebuild" "latest" "/opt/keycloak" "keycloak-*.tar.gz" fetch_and_deploy_gh_release "keycloak" "keycloak/keycloak" "prebuild" "latest" "/opt/keycloak" "keycloak-*.tar.gz"