mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-05 21:03:24 +01:00
Refactor (#10928)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 <<EOF >/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 <<EOF >/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]
|
||||
|
||||
Reference in New Issue
Block a user