diff --git a/ct/fluid-calendar.sh b/ct/fluid-calendar.sh index e43e28a17..f9b53474c 100644 --- a/ct/fluid-calendar.sh +++ b/ct/fluid-calendar.sh @@ -20,51 +20,43 @@ color catch_errors function update_script() { - header_info - check_container_storage - check_container_resources + header_info + check_container_storage + check_container_resources - if [[ ! -d /opt/fluid-calendar ]]; then - 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 + if [[ ! -d /opt/fluid-calendar ]]; then + 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 ~/.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 diff --git a/install/fluid-calendar-install.sh b/install/fluid-calendar-install.sh index 5dca3c133..687759acb 100644 --- a/install/fluid-calendar-install.sh +++ b/install/fluid-calendar-install.sh @@ -14,17 +14,11 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y \ - zip \ - postgresql-common +$STD apt-get install -y zip msg_ok "Installed Dependencies" -msg_info "Installing Additional Dependencies" -curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg -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" +PG_VERSION="17" setup_postgresql +NODE_VERSION="20" setup_nodejs msg_info "Setting up Postgresql Database" DB_NAME="fluiddb" @@ -44,14 +38,9 @@ $STD sudo -u postgres psql -c "ALTER USER $DB_USER WITH SUPERUSER;" } >>~/$APPLICATION.creds msg_ok "Set up Postgresql Database" -msg_info "Setup ${APPLICATION}" -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 +fetch_and_deploy_gh_release "fluid-calendar" "dotnetfactory/fluid-calendar" +msg_info "Configuring ${APPLICATION}" cat </opt/fluid-calendar/.env 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 npx prisma migrate deploy $STD npm run build:os -msg_ok "Setup ${APPLICATION}" +msg_ok "Configuring ${APPLICATION}" msg_info "Creating Service" cat </etc/systemd/system/fluid-calendar.service @@ -95,7 +84,6 @@ motd_ssh customize msg_info "Cleaning up" -rm -f $tmp_file $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"