From dbf551d162e55ee05d52154e8edc98932557f30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Sun, 18 Jan 2026 22:05:08 +0100 Subject: [PATCH] Refactor (#10928) --- ct/fluid-calendar.sh | 5 ++--- install/fluid-calendar-install.sh | 29 +++++++---------------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/ct/fluid-calendar.sh b/ct/fluid-calendar.sh index 1a6b2f6b3..ce15ee16c 100644 --- a/ct/fluid-calendar.sh +++ b/ct/fluid-calendar.sh @@ -34,11 +34,10 @@ function update_script() { msg_info "Stopped Service" cp /opt/fluid-calendar/.env /opt/fluid.env - rm -rf /opt/fluid-calendar - fetch_and_deploy_gh_release "fluid-calendar" "dotnetfactory/fluid-calendar" "tarball" + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "fluid-calendar" "dotnetfactory/fluid-calendar" "tarball" + mv /opt/fluid.env /opt/fluid-calendar/.env msg_info "Updating 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 diff --git a/install/fluid-calendar-install.sh b/install/fluid-calendar-install.sh index cafc59f36..1333a222d 100644 --- a/install/fluid-calendar-install.sh +++ b/install/fluid-calendar-install.sh @@ -18,31 +18,15 @@ $STD apt-get install -y zip msg_ok "Installed Dependencies" PG_VERSION="17" setup_postgresql +PG_DB_NAME="fluiddb" PG_DB_USER="fluiduser" setup_postgresql_db NODE_VERSION="20" setup_nodejs - -msg_info "Setting up Postgresql Database" -DB_NAME="fluiddb" -DB_USER="fluiduser" -DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)" -NEXTAUTH_SECRET="$(openssl rand -base64 44 | tr -dc 'a-zA-Z0-9' | cut -c1-32)" -$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH ENCRYPTED PASSWORD '$DB_PASS';" -$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" -$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME to $DB_USER;" -$STD sudo -u postgres psql -c "ALTER USER $DB_USER WITH SUPERUSER;" -{ - echo "${APPLICATION} Credentials" - echo "Database User: $DB_USER" - echo "Database Password: $DB_PASS" - echo "Database Name: $DB_NAME" - echo "NextAuth Secret: $NEXTAUTH_SECRET" -} >>~/$APPLICATION.creds -msg_ok "Set up Postgresql Database" - fetch_and_deploy_gh_release "fluid-calendar" "dotnetfactory/fluid-calendar" "tarball" -msg_info "Configuring ${APPLICATION}" +msg_info "Configuring fluid-calendar" +NEXTAUTH_SECRET="$(openssl rand -base64 44 | tr -dc 'a-zA-Z0-9' | cut -c1-32)" +echo "NextAuth Secret: $NEXTAUTH_SECRET" >>~/$APPLICATION.creds cat </opt/fluid-calendar/.env -DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}" +DATABASE_URL="postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}" # Change the URL below to your external URL NEXTAUTH_URL="http://localhost:3000" @@ -61,7 +45,7 @@ $STD npm install --legacy-peer-deps $STD npm run prisma:generate $STD npx prisma migrate deploy $STD npm run build:os -msg_ok "Configuring ${APPLICATION}" +msg_ok "Configured fluid-calendar" msg_info "Creating Service" cat </etc/systemd/system/fluid-calendar.service @@ -72,6 +56,7 @@ After=network.target postgresql.service [Service] Restart=always WorkingDirectory=/opt/fluid-calendar +EnvironmentFile=/opt/fluid-calendar/.env ExecStart=/usr/bin/npm run start [Install]