mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-07-10 07:57:37 +00:00
Refactor: Fluid-Calendar (#5846)
* Refactor * Update fluid-calendar.sh --------- Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
This commit is contained in:
@ -20,51 +20,43 @@ color
|
|||||||
catch_errors
|
catch_errors
|
||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
|
|
||||||
if [[ ! -d /opt/fluid-calendar ]]; then
|
if [[ ! -d /opt/fluid-calendar ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/dotnetfactory/fluid-calendar/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
|
||||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
|
||||||
msg_info "Stopping $APP"
|
|
||||||
systemctl stop fluid-calendar.service
|
|
||||||
msg_ok "Stopped $APP"
|
|
||||||
|
|
||||||
msg_info "Updating $APP to v${RELEASE}"
|
|
||||||
cp /opt/fluid-calendar/.env /opt/fluid.env
|
|
||||||
rm -rf /opt/fluid-calendar
|
|
||||||
tmp_file=$(mktemp)
|
|
||||||
curl -fsSL "https://github.com/dotnetfactory/fluid-calendar/archive/refs/tags/v${RELEASE}.zip" -o "$tmp_file"
|
|
||||||
$STD unzip $tmp_file
|
|
||||||
mv ${APP}-${RELEASE}/ /opt/fluid-calendar
|
|
||||||
mv /opt/fluid.env /opt/fluid-calendar/.env
|
|
||||||
cd /opt/fluid-calendar
|
|
||||||
export NEXT_TELEMETRY_DISABLED=1
|
|
||||||
$STD npm install --legacy-peer-deps
|
|
||||||
$STD npm run prisma:generate
|
|
||||||
$STD npx prisma migrate deploy
|
|
||||||
$STD npm run build:os
|
|
||||||
msg_ok "Updated $APP to v${RELEASE}"
|
|
||||||
|
|
||||||
msg_info "Starting $APP"
|
|
||||||
systemctl start fluid-calendar.service
|
|
||||||
msg_ok "Started $APP"
|
|
||||||
|
|
||||||
msg_info "Cleaning Up"
|
|
||||||
rm -rf $tmp_file
|
|
||||||
msg_ok "Cleanup Completed"
|
|
||||||
|
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
msg_ok "Update Successful"
|
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
|
||||||
fi
|
|
||||||
exit
|
exit
|
||||||
|
fi
|
||||||
|
RELEASE=$(curl -fsSL https://api.github.com/repos/dotnetfactory/fluid-calendar/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
if [[ "${RELEASE}" != "$(cat ~/.fluid-calendar 2>/dev/null)" ]] || [[ ! -f ~/.fluid-calendar ]]; then
|
||||||
|
msg_info "Stopping $APP"
|
||||||
|
systemctl stop fluid-calendar
|
||||||
|
msg_ok "Stopped $APP"
|
||||||
|
|
||||||
|
cp /opt/fluid-calendar/.env /opt/fluid.env
|
||||||
|
rm -rf /opt/fluid-calendar
|
||||||
|
fetch_and_deploy_gh_release "fluid-calendar" "dotnetfactory/fluid-calendar"
|
||||||
|
|
||||||
|
msg_info "Updating $APP to v${RELEASE}"
|
||||||
|
mv /opt/fluid.env /opt/fluid-calendar/.env
|
||||||
|
cd /opt/fluid-calendar
|
||||||
|
export NEXT_TELEMETRY_DISABLED=1
|
||||||
|
$STD npm install --legacy-peer-deps
|
||||||
|
$STD npm run prisma:generate
|
||||||
|
$STD npx prisma migrate deploy
|
||||||
|
$STD npm run build:os
|
||||||
|
msg_ok "Updated $APP to v${RELEASE}"
|
||||||
|
|
||||||
|
msg_info "Starting $APP"
|
||||||
|
systemctl start fluid-calendar
|
||||||
|
msg_ok "Started $APP"
|
||||||
|
|
||||||
|
msg_ok "Update Successful"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
fi
|
||||||
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
start
|
start
|
||||||
|
@ -14,17 +14,11 @@ network_check
|
|||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y \
|
$STD apt-get install -y zip
|
||||||
zip \
|
|
||||||
postgresql-common
|
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Installing Additional Dependencies"
|
PG_VERSION="17" setup_postgresql
|
||||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
NODE_VERSION="20" setup_nodejs
|
||||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
|
|
||||||
echo "YES" | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh &>/dev/null
|
|
||||||
$STD apt-get install -y postgresql-17 nodejs
|
|
||||||
msg_ok "Installed Additional Dependencies"
|
|
||||||
|
|
||||||
msg_info "Setting up Postgresql Database"
|
msg_info "Setting up Postgresql Database"
|
||||||
DB_NAME="fluiddb"
|
DB_NAME="fluiddb"
|
||||||
@ -44,14 +38,9 @@ $STD sudo -u postgres psql -c "ALTER USER $DB_USER WITH SUPERUSER;"
|
|||||||
} >>~/$APPLICATION.creds
|
} >>~/$APPLICATION.creds
|
||||||
msg_ok "Set up Postgresql Database"
|
msg_ok "Set up Postgresql Database"
|
||||||
|
|
||||||
msg_info "Setup ${APPLICATION}"
|
fetch_and_deploy_gh_release "fluid-calendar" "dotnetfactory/fluid-calendar"
|
||||||
tmp_file=$(mktemp)
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/dotnetfactory/fluid-calendar/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
|
||||||
curl -fsSL "https://github.com/dotnetfactory/fluid-calendar/archive/refs/tags/v${RELEASE}.zip" -o "$tmp_file"
|
|
||||||
$STD unzip $tmp_file
|
|
||||||
mv ${APPLICATION}-${RELEASE}/ /opt/${APPLICATION}
|
|
||||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
|
||||||
|
|
||||||
|
msg_info "Configuring ${APPLICATION}"
|
||||||
cat <<EOF >/opt/fluid-calendar/.env
|
cat <<EOF >/opt/fluid-calendar/.env
|
||||||
DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}"
|
DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}"
|
||||||
|
|
||||||
@ -72,7 +61,7 @@ $STD npm install --legacy-peer-deps
|
|||||||
$STD npm run prisma:generate
|
$STD npm run prisma:generate
|
||||||
$STD npx prisma migrate deploy
|
$STD npx prisma migrate deploy
|
||||||
$STD npm run build:os
|
$STD npm run build:os
|
||||||
msg_ok "Setup ${APPLICATION}"
|
msg_ok "Configuring ${APPLICATION}"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/fluid-calendar.service
|
cat <<EOF >/etc/systemd/system/fluid-calendar.service
|
||||||
@ -95,7 +84,6 @@ motd_ssh
|
|||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
rm -f $tmp_file
|
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
Reference in New Issue
Block a user