Refactor: Zitadel (#6826)
This commit is contained in:
parent
1c5ff8b26a
commit
bc52b1a7d7
@ -27,27 +27,24 @@ function update_script() {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/zitadel/zitadel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt | grep -oP '\d+\.\d+\.\d+')" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||
if [[ ! -f ~/.zitadel ]] || [[ "${RELEASE}" != "$(cat ~/.zitadel)" ]]; then
|
||||
msg_info "Stopping $APP"
|
||||
systemctl stop zitadel
|
||||
msg_ok "Stopped $APP"
|
||||
|
||||
rm -f /usr/local/bin/zitadel
|
||||
fetch_and_deploy_gh_release "zitadel" "zitadel/zitadel" "prebuild" "latest" "/usr/local/bin" "zitadel-linux-amd64.tar.gz"
|
||||
|
||||
msg_info "Updating $APP to ${RELEASE}"
|
||||
cd /tmp
|
||||
curl -fsSL "https://github.com/zitadel/zitadel/releases/download/v$RELEASE/zitadel-linux-amd64.tar.gz" | tar -xz
|
||||
mv zitadel-linux-amd64/zitadel /usr/local/bin
|
||||
$STD zitadel setup --masterkeyFile /opt/zitadel/.masterkey --config /opt/zitadel/config.yaml --init-projections=true
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated $APP to ${RELEASE}"
|
||||
|
||||
msg_info "Starting $APP"
|
||||
systemctl start zitadel
|
||||
msg_ok "Started $APP"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -rf /tmp/zitadel-linux-amd64
|
||||
msg_ok "Cleanup Completed"
|
||||
msg_ok "Update Successful"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
|
@ -17,7 +17,7 @@ msg_info "Installing Dependencies (Patience)"
|
||||
$STD apt-get install -y ca-certificates
|
||||
msg_ok "Installed Dependecies"
|
||||
|
||||
PG_VERSION="17" PG_MODULES="common" setup_postgresql
|
||||
PG_VERSION="17" setup_postgresql
|
||||
|
||||
msg_info "Installing Postgresql"
|
||||
DB_NAME="zitadel"
|
||||
@ -39,11 +39,7 @@ $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME OWNER $DB_ADMIN_USER;"
|
||||
} >>~/zitadel.creds
|
||||
msg_ok "Installed PostgreSQL"
|
||||
|
||||
msg_info "Installing Zitadel"
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/zitadel/zitadel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
curl -fsSL "https://github.com/zitadel/zitadel/releases/download/v$RELEASE/zitadel-linux-amd64.tar.gz" | tar -xz
|
||||
mv zitadel-linux-amd64/zitadel /usr/local/bin
|
||||
msg_ok "Installed Zitadel"
|
||||
fetch_and_deploy_gh_release "zitadel" "zitadel/zitadel" "prebuild" "latest" "/usr/local/bin" "zitadel-linux-amd64.tar.gz"
|
||||
|
||||
msg_info "Setting up Zitadel Environments"
|
||||
mkdir -p /opt/zitadel
|
||||
@ -114,7 +110,7 @@ NoNewPrivileges=true
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q zitadel.service
|
||||
systemctl enable -q --now zitadel
|
||||
msg_ok "Created Services"
|
||||
|
||||
msg_info "Zitadel initial setup"
|
||||
@ -122,7 +118,6 @@ zitadel start-from-init --masterkeyFile /opt/zitadel/.masterkey --config /opt/zi
|
||||
sleep 60
|
||||
kill $(lsof -i | awk '/zitadel/ {print $2}' | head -n1)
|
||||
useradd zitadel
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Zitadel initialized"
|
||||
|
||||
msg_info "Set ExternalDomain to current IP and restart Zitadel"
|
||||
@ -145,7 +140,6 @@ motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf ~/zitadel-linux-amd64
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
Loading…
x
Reference in New Issue
Block a user