merge from dev

Signed-off-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>
This commit is contained in:
CanbiZ 2024-12-26 10:24:59 +01:00 committed by GitHub
parent 250ffddee7
commit 687884a6e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,104 +5,81 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m
# License: MIT # License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
function header_info { # App Default Values
clear APP="Authentik"
cat <<"EOF" var_tags="identity-provider"
___ __ __ __ _ __
/ | __ __/ /_/ /_ ___ ____ / /_(_) /__
/ /| |/ / / / __/ __ \/ _ \/ __ \/ __/ / //_/
/ ___ / /_/ / /_/ / / / __/ / / / /_/ / ,<
/_/ |_\__,_/\__/_/ /_/\___/_/ /_/\__/_/_/|_|
EOF
}
header_info
echo -e "Loading..."
APP="authentik"
var_disk="15" var_disk="15"
var_cpu="6" var_cpu="6"
var_ram="8192" var_ram="8192"
var_os="debian" var_os="debian"
var_version="12" var_version="12"
var_unprivileged="1"
# App Output & Base Settings
header_info "$APP"
base_settings
# Core
variables variables
color color
catch_errors catch_errors
function default_settings() {
CT_TYPE="1"
PW=""
CT_ID=$NEXTID
HN=$NSAPP
DISK_SIZE="$var_disk"
CORE_COUNT="$var_cpu"
RAM_SIZE="$var_ram"
BRG="vmbr0"
NET="dhcp"
GATE=""
APT_CACHER=""
APT_CACHER_IP=""
DISABLEIP6="no"
MTU=""
SD=""
NS=""
MAC=""
VLAN=""
SSH="no"
VERB="no"
echo_default
}
function update_script() { function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -f /etc/systemd/system/authentik-server.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -f /etc/systemd/system/authentik-server.service ]]; then
RELEASE=$(curl -s https://api.github.com/repos/goauthentik/authentik/releases/latest | grep "tarball_url" | awk '{print substr($2, 2, length($2)-3)}') msg_error "No ${APP} Installation Found!"
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then exit
msg_info "Stopping ${APP}" fi
systemctl stop authentik-server RELEASE=$(curl -s https://api.github.com/repos/goauthentik/authentik/releases/latest | grep "tarball_url" | awk '{print substr($2, 2, length($2)-3)}')
systemctl stop authentik-worker if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_ok "Stopped ${APP}" msg_info "Stopping ${APP}"
systemctl stop authentik-server
systemctl stop authentik-worker
msg_ok "Stopped ${APP}"
msg_info "Building ${APP} website" msg_info "Building ${APP} website"
mkdir -p /opt/authentik mkdir -p /opt/authentik
wget -qO authentik.tar.gz "${RELEASE}" wget -qO authentik.tar.gz "${RELEASE}"
tar -xzf authentik.tar.gz -C /opt/authentik --strip-components 1 --overwrite tar -xzf authentik.tar.gz -C /opt/authentik --strip-components 1 --overwrite
rm -rf authentik.tar.gz rm -rf authentik.tar.gz
cd /opt/authentik/website cd /opt/authentik/website
npm install &>/dev/null npm install &>/dev/null
npm run build-bundled &>/dev/null npm run build-bundled &>/dev/null
cd /opt/authentik/web cd /opt/authentik/web
npm install &>/dev/null npm install &>/dev/null
npm run build &>/dev/null npm run build &>/dev/null
msg_ok "Built ${APP} website" msg_ok "Built ${APP} website"
msg_info "Installing Python Dependencies" msg_info "Installing Python Dependencies"
cd /opt/authentik cd /opt/authentik
poetry install --only=main --no-ansi --no-interaction --no-root &>/dev/null poetry install --only=main --no-ansi --no-interaction --no-root &>/dev/null
poetry export --without-hashes --without-urls -f requirements.txt --output requirements.txt &>/dev/null poetry export --without-hashes --without-urls -f requirements.txt --output requirements.txt &>/dev/null
pip install --no-cache-dir -r requirements.txt &>/dev/null pip install --no-cache-dir -r requirements.txt &>/dev/null
pip install . &>/dev/null pip install . &>/dev/null
msg_ok "Installed Python Dependencies" msg_ok "Installed Python Dependencies"
msg_info "Updating ${APP} to v${RELEASE} (Patience)" msg_info "Updating ${APP} to v${RELEASE} (Patience)"
cp -r /opt/authentik/authentik/blueprints /opt/authentik/blueprints cp -r /opt/authentik/authentik/blueprints /opt/authentik/blueprints
bash /opt/authentik/lifecycle/ak migrate &>/dev/null bash /opt/authentik/lifecycle/ak migrate &>/dev/null
echo "${RELEASE}" >/opt/${APP}_version.txt echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to v${RELEASE}" msg_ok "Updated ${APP} to v${RELEASE}"
msg_info "Starting ${APP}" msg_info "Starting ${APP}"
systemctl start authentik-server systemctl start authentik-server
systemctl start authentik-worker systemctl start authentik-worker
msg_ok "Started ${APP}" msg_ok "Started ${APP}"
else else
msg_ok "No update required. ${APP} is already at v${RELEASE}" msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi fi
exit exit
} }
start start
build_container build_container
description description
msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}/if/flow/initial-setup/${CL}"