Files
ProxmoxVE/install/keycloak-install.sh
T

57 lines
1.6 KiB
Bash
Raw Normal View History

2023-03-22 20:48:20 -04:00
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: tteck (tteckster) | Co-Author: Slaviša Arežina (tremor021), remz1337
# 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
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
JAVA_VERSION=21 setup_java
PG_VERSION=16 setup_postgresql
PG_DB_NAME="keycloak" PG_DB_USER="keycloak" setup_postgresql_db
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"
cat <<EOF >/etc/systemd/system/keycloak.service
[Unit]
Description=Keycloak Service
Requires=network.target
After=syslog.target network-online.target
2023-03-22 20:48:20 -04:00
[Service]
Type=idle
2023-03-22 20:48:20 -04:00
User=root
WorkingDirectory=/opt/keycloak
ExecStart=/opt/keycloak/bin/kc.sh start
Restart=always
RestartSec=3
Environment="JAVA_HOME=/usr/lib/jvm/temurin-21-jdk-$(arch_resolve)"
Environment="KC_DB=postgres"
Environment="KC_DB_USERNAME=keycloak"
Environment="KC_DB_PASSWORD=$PG_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]
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
cleanup_lxc