From 31d56c7a25ad9780fc6409345bb307d1234ee80b Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2026 09:07:06 +0100 Subject: [PATCH] Casdoor (#18170) * Add casdoor (ct) * Update install/casdoor-install.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ (MickLesk) <47820557+MickLesk@users.noreply.github.com> Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/casdoor.sh | 56 +++++++++++++++++++++++ install/casdoor-install.sh | 93 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 ct/casdoor.sh create mode 100644 install/casdoor-install.sh diff --git a/ct/casdoor.sh b/ct/casdoor.sh new file mode 100644 index 000000000..c12710a53 --- /dev/null +++ b/ct/casdoor.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/casdoor/casdoor + +APP="Casdoor" +var_tags="${var_tags:-auth;sso;iam}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-1024}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-yes}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/casdoor ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "casdoor" "casdoor/casdoor"; then + msg_info "Stopping Casdoor" + systemctl stop casdoor + msg_ok "Stopped Casdoor" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "casdoor" "casdoor/casdoor" "prebuild" "latest" "/opt/casdoor" "casdoor_Linux_$(arch_resolve "x86_64" "arm64").tar.gz" + + msg_info "Starting Casdoor" + systemctl start casdoor + msg_ok "Started Casdoor" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +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 "${GATEWAY}${BGN}http://${IP}:8000${CL}" diff --git a/install/casdoor-install.sh b/install/casdoor-install.sh new file mode 100644 index 000000000..48495459b --- /dev/null +++ b/install/casdoor-install.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/casdoor/casdoor + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +PG_VERSION="17" setup_postgresql +PG_DB_NAME="casdoor" PG_DB_USER="casdoor" setup_postgresql_db + +fetch_and_deploy_gh_release "casdoor" "casdoor/casdoor" "prebuild" "latest" "/opt/casdoor" "casdoor_Linux_$(arch_resolve "x86_64" "arm64").tar.gz" + +msg_info "Configuring Casdoor" +mkdir -p /opt/casdoor_data/conf +cat </opt/casdoor_data/conf/app.conf +appname = casdoor +httpport = 8000 +runmode = prod +copyrequestbody = true +driverName = postgres +dataSourceName = user=casdoor password=${PG_DB_PASS} host=localhost port=5432 sslmode=disable dbname=casdoor +dbName = casdoor +tableNamePrefix = +showSql = false +redisEndpoint = +defaultStorageProvider = +isCloudIntranet = false +authState = "casdoor" +socks5Proxy = +verificationCodeTimeout = 10 +initScore = 0 +logPostOnly = true +isUsernameLowered = false +origin = http://${LOCAL_IP}:8000 +originFrontend = +staticBaseUrl = "https://cdn.casbin.org" +isDemoMode = false +batchSize = 100 +showGithubCorner = false +forceLanguage = "" +defaultLanguage = "en" +defaultApplication = "app-built-in" +maxItemsForFlatMenu = 7 +enableErrorMask = false +enableGzip = true +inactiveTimeoutMinutes = +ldapServerPort = 389 +ldapsCertId = "" +ldapsServerPort = 636 +radiusServerPort = 1812 +radiusDefaultOrganization = "built-in" +radiusSecret = "$(random_password)" +quota = {"organization": -1, "user": -1, "application": -1, "provider": -1} +logConfig = {"adapter":"console", "color":false} +initDataNewOnly = false +initDataFile = "./init_data.json" +frontendBaseDir = "/opt/casdoor/web/build" +EOF +chmod 600 /opt/casdoor_data/conf/app.conf +msg_ok "Configured Casdoor" + +msg_info "Creating Service" +cat </etc/systemd/system/casdoor.service +[Unit] +Description=Casdoor +After=network.target postgresql.service +Requires=postgresql.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/casdoor_data +ExecStart=/opt/casdoor/casdoor +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now casdoor +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc