diff --git a/ct/zitadel.sh b/ct/zitadel.sh new file mode 100644 index 000000000..f7bf09041 --- /dev/null +++ b/ct/zitadel.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: dave-yap (dave-yap) | Co-author: remz1337 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://zitadel.com/ + +APP="Zitadel" +var_tags="${var_tags:-identity-provider}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-6}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -f /etc/systemd/system/zitadel.service ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "zitadel" "zitadel/zitadel"; then + msg_info "Stopping Service" + systemctl stop zitadel + msg_ok "Stopped Service" + + msg_info "Updating Zitadel" + rm -f /opt/zitadel/* + fetch_and_deploy_gh_release "zitadel" "zitadel/zitadel" "prebuild" "latest" "/opt/zitadel" "zitadel-linux-amd64.tar.gz" + + rm -f /opt/login/* + fetch_and_deploy_gh_release "login" "zitadel/zitadel" "prebuild" "latest" "${LOGIN_DIR}" "zitadel-login.tar.gz" + + cd /opt/zitadel + ./zitadel setup --masterkeyFile /etc/zitadel/.masterkey --config /etc/zitadel/config.yaml --init-projections=true + msg_ok "Updated Zitadel" + + msg_info "Starting Service" + systemctl start zitadel + msg_ok "Started Service" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 1024 +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" + +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}:8080/ui/console${CL}" + +echo -e "${INFO}${GN} Default Admin Credentials:${CL}" +echo -e "${INFO}${BL} Username: zitadel-admin@zitadel.localhost${CL}" +echo -e "${INFO}${BL} Password: Password1!${CL}" +echo -e "${INFO} All credentials are saved in: /etc/zitadel/INSTALLATION_INFO.txt${CL}" \ No newline at end of file diff --git a/frontend/public/json/zitadel.json b/frontend/public/json/zitadel.json new file mode 100644 index 000000000..5f3b789ec --- /dev/null +++ b/frontend/public/json/zitadel.json @@ -0,0 +1,44 @@ +{ + "name": "Zitadel", + "slug": "zitadel", + "categories": [ + 6 + ], + "date_created": "2025-02-10", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8080, + "documentation": "https://zitadel.com/docs/guides/overview", + "website": "https://zitadel.com", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/zitadel.webp", + "config_path": "/etc/zitadel/config.yaml", + "description": "Zitadel is an open-source identity and access management (IAM) solution designed to provide secure authentication, authorization, and user management for modern applications and services. Built with a focus on flexibility, scalability, and security, Zitadel offers a comprehensive set of features for developers and organizations looking to implement robust identity management.", + "install_methods": [ + { + "type": "default", + "script": "ct/zitadel.sh", + "resources": { + "cpu": 1, + "ram": 1024, + "hdd": 6, + "os": "debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": "zitadel-admin@zitadel.localhost", + "password": "Password1!" + }, + "notes": [ + { + "text": "Application credentials: `cat /etc/zitadel/INSTALLATION_INFO.txt`", + "type": "info" + }, + { + "text": "Change the ExternalDomain value in `/etc/zitadel/config.yaml` to your domain/hostname/IP and run `bash zitadel-rerun.sh`", + "type": "info" + } + ] +} diff --git a/install/zitadel-install.sh b/install/zitadel-install.sh new file mode 100644 index 000000000..e7988c311 --- /dev/null +++ b/install/zitadel-install.sh @@ -0,0 +1,324 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: dave-yap (dave-yap) | Co-Author: remz1337 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://zitadel.com/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +# Configuration variables +ZITADEL_DIR="/opt/zitadel" +LOGIN_DIR="/opt/login" +CONFIG_DIR="/etc/zitadel" +ZITADEL_USER="zitadel" +ZITADEL_GROUP="zitadel" +DB_NAME="zitadel" +DB_USER="zitadel" +DB_PASSWORD="$(openssl rand -base64 32 | tr -d '=/+' | head -c 32)" +POSTGRES_ADMIN_PASSWORD="$(openssl rand -base64 32 | tr -d '=/+' | head -c 32)" +MASTERKEY="$(openssl rand -base64 32 | tr -d '=/+' | head -c 32)" +API_PORT="8080" +LOGIN_PORT="3000" + +# Detect server IP address +SERVER_IP=$(hostname -I | awk '{print $1}') + +msg_info "Installing Dependencies (Patience)" +$STD apt install -y ca-certificates +msg_ok "Installed Dependecies" + +# Create zitadel user +msg_info "Creating zitadel system user" +groupadd --system "${ZITADEL_GROUP}" +useradd --system --gid "${ZITADEL_GROUP}" --shell /bin/bash --home-dir "${ZITADEL_DIR}" "${ZITADEL_USER}" +msg_ok "Created zitadel system user" + +fetch_and_deploy_gh_release "zitadel" "zitadel/zitadel" "prebuild" "latest" "${ZITADEL_DIR}" "zitadel-linux-amd64.tar.gz" +chown -R "${ZITADEL_USER}:${ZITADEL_GROUP}" "${ZITADEL_DIR}" + +fetch_and_deploy_gh_release "login" "zitadel/zitadel" "prebuild" "latest" "${LOGIN_DIR}" "zitadel-login.tar.gz" +chown -R "${ZITADEL_USER}:${ZITADEL_GROUP}" "${LOGIN_DIR}" + +NODE_VERSION="24" setup_nodejs + +PG_VERSION="17" setup_postgresql + +setup_go + +msg_info "Configuring Postgresql" +$STD sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '${POSTGRES_ADMIN_PASSWORD}';" +msg_ok "Configured PostgreSQL" + +msg_info "Installing Zitadel" +cd "${ZITADEL_DIR}" +mkdir -p ${CONFIG_DIR} +echo "${MASTERKEY}" > ${CONFIG_DIR}/.masterkey + +# Update config.yaml for network access +cat > "${CONFIG_DIR}/config.yaml" < "${CONFIG_DIR}/login.env" < "${CONFIG_DIR}/api.env" < /etc/systemd/system/zitadel-api.service < /etc/systemd/system/zitadel-login.service < "${CONFIG_DIR}/INSTALLATION_INFO.txt" < zitadel_backup_\$(date +%Y%m%d).sql + +Database restore: + PGPASSWORD=${DB_PASSWORD} psql -h localhost -U ${DB_USER} ${DB_NAME} < zitadel_backup_YYYYMMDD.sql + +################################################################################ +EOF +chmod 600 "${CONFIG_DIR}/INSTALLATION_INFO.txt" +chown "${ZITADEL_USER}:${ZITADEL_GROUP}" "${CONFIG_DIR}/INSTALLATION_INFO.txt" +cp ${ZITADEL_DIR}/admin.pat ${CONFIG_DIR}/admin.pat.BAK +cp ${ZITADEL_DIR}/login-client.pat ${CONFIG_DIR}/login-client.pat.BAK +msg_ok "Saved Credentials" + +msg_info "Create zitadel-rerun.sh" +cat <~/zitadel-rerun.sh +systemctl stop zitadel +timeout --kill-after=5s 15s zitadel setup --masterkeyFile ${CONFIG_DIR}/.masterkey --config ${CONFIG_DIR}/config.yaml" +systemctl restart zitadel +EOF +msg_ok "Bash script for rerunning Zitadel after changing Zitadel config.yaml" + +motd_ssh +customize +cleanup_lxc