2023-03-22 20:48:20 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2025-02-27 16:40:07 +01:00
|
|
|
# Copyright (c) 2021-2025 community-scripts ORG
|
2025-07-29 06:26:55 -04:00
|
|
|
# Author: tteck (tteckster) | Co-Author: Slaviša Arežina (tremor021), remz1337
|
2025-02-27 16:40:07 +01:00
|
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
|
|
|
# Source: https://github.com/keycloak/keycloak
|
2023-03-22 20:48:20 -04:00
|
|
|
|
2025-02-27 16:40:07 +01:00
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
2023-03-22 20:48:20 -04:00
|
|
|
color
|
|
|
|
|
verb_ip6
|
|
|
|
|
catch_errors
|
|
|
|
|
setting_up_container
|
|
|
|
|
network_check
|
|
|
|
|
update_os
|
|
|
|
|
|
2025-07-29 06:26:55 -04:00
|
|
|
JAVA_VERSION=21 setup_java
|
|
|
|
|
PG_VERSION=16 setup_postgresql
|
|
|
|
|
|
|
|
|
|
msg_info "Configuring PostgreSQL"
|
|
|
|
|
DB_NAME="keycloak"
|
|
|
|
|
DB_USER="keycloak"
|
|
|
|
|
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 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;"
|
|
|
|
|
msg_ok "Configured PostgreSQL"
|
|
|
|
|
|
2025-08-18 20:16:14 +02:00
|
|
|
fetch_and_deploy_gh_release "keycloak_app" "keycloak/keycloak" "prebuild" "latest" "/opt/keycloak" "keycloak-*.tar.gz"
|
2023-03-22 20:48:20 -04:00
|
|
|
|
|
|
|
|
msg_info "Creating Service"
|
2025-02-27 16:40:07 +01:00
|
|
|
cat <<EOF >/etc/systemd/system/keycloak.service
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=Keycloak Service
|
2025-07-29 06:26:55 -04:00
|
|
|
Requires=network.target
|
|
|
|
|
After=syslog.target network-online.target
|
2025-02-27 16:40:07 +01:00
|
|
|
|
2023-03-22 20:48:20 -04:00
|
|
|
[Service]
|
2025-07-29 06:26:55 -04:00
|
|
|
Type=idle
|
2023-03-22 20:48:20 -04:00
|
|
|
User=root
|
|
|
|
|
WorkingDirectory=/opt/keycloak
|
2025-07-29 06:26:55 -04:00
|
|
|
ExecStart=/opt/keycloak/bin/kc.sh start
|
|
|
|
|
ExecStop=/opt/keycloak/bin/kc.sh stop
|
|
|
|
|
Restart=always
|
|
|
|
|
RestartSec=3
|
|
|
|
|
Environment="JAVA_HOME=/usr/lib/jvm/temurin-21-jdk-amd64"
|
|
|
|
|
Environment="KC_DB=postgres"
|
|
|
|
|
Environment="KC_DB_USERNAME=$DB_USER"
|
|
|
|
|
Environment="KC_DB_PASSWORD=$DB_PASS"
|
|
|
|
|
Environment="KC_HTTP_ENABLED=true"
|
|
|
|
|
Environment="KC_BOOTSTRAP_ADMIN_USERNAME=tmpadm"
|
|
|
|
|
Environment="KC_BOOTSTRAP_ADMIN_PASSWORD=admin123"
|
|
|
|
|
# Comment following line and uncomment the next 2 if working behind a reverse proxy
|
|
|
|
|
Environment="KC_HOSTNAME_STRICT=false"
|
|
|
|
|
#Environment="KC_HOSTNAME=keycloak.example.com"
|
|
|
|
|
#Environment="KC_PROXY_HEADERS=xforwarded"
|
2023-03-22 20:48:20 -04:00
|
|
|
[Install]
|
2025-02-27 16:40:07 +01:00
|
|
|
WantedBy=multi-user.target
|
|
|
|
|
EOF
|
|
|
|
|
systemctl enable -q --now keycloak
|
2023-03-22 20:48:20 -04:00
|
|
|
msg_ok "Created Service"
|
|
|
|
|
|
|
|
|
|
motd_ssh
|
2023-05-15 07:39:30 -04:00
|
|
|
customize
|
Bump K to H-Scripts to Debian 13 (Trixie) (#8597)
* Update scripts to use Debian 13 and improve update logic
Bump default container OS version from Debian 12 to 13 across multiple LXC setup scripts. Refactor update_script functions for consistency, improve messaging, and standardize apt usage. Update Kimai install and update scripts to use setup_php, setup_composer, and fetch_and_deploy_gh_release helpers, and switch from MySQL to MariaDB. Update Kometa to use Python 3.13. Minor improvements to backup, cleanup, and service management steps in several scripts.
* Refactor install scripts: unify cleanup and apt usage
Replaces repeated apt-get commands with apt for installing dependencies, and consolidates cleanup steps into a single cleanup_lxc function across all install scripts. Also updates repository setup to use setup_deb822_repo where applicable, and makes minor improvements to dependency installation and service setup.
* Update default Debian version to 13 and refactor updates
Set the default Debian version to 13 across all container scripts. Standardize apt command usage by replacing 'apt-get' with 'apt' where appropriate. Remove redundant cleanup steps from update scripts and streamline update logic for consistency. Also, call 'cleanup_lxc' after 'update_script' in the build function.
* Update default OS version to Debian 13 in JSON configs
Updated the 'version' field from '12' to '13' for Debian-based install methods across multiple application JSON files. Also set default OS and version for inspircd. This ensures new containers use the latest supported Debian release.
* fix kimai Update Check
* grammar
* Correct typo in success message
* Fix typo in success message for update
* refactor
* fixed jenkins / improve komodo
---------
Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
2025-11-12 10:56:18 +01:00
|
|
|
cleanup_lxc
|