Files
HomeServerCTs/CT-Files/linkwarden/Scripts/FirstRun.sh
Bram Prieshof c65282871f CT's linkwarden, hass & nextcloud: Minor fixes
-linkwarden: Updated `yarn` commands for managing the application
-hass: Fixed homefolder for hass application user
-nextcloud: Bumped php version to project default (8.4)
2025-05-09 23:00:06 +02:00

32 lines
959 B
Bash

#!/bin/bash
ThisScriptConfigured=no
##Linkwarden
LinkwardenURL=http://localhost:3000
##DB
PostgresqlIP=127.0.0.1
PostgresqlPort=5432
PostgresqlUsername=linkwarden
PostgresqlDatabase=linkwarden
PostgresqlPassword=<Password>
#Check if script is configured
if [ $ThisScriptConfigured = no ]; then
echo "Script is not configured"
exit
fi
##Update config
sed -i "s#^DATABASE_URL=#DATABASE_URL=postgresql://$PostgresqlUsername:$PostgresqlPassword@$PostgresqlIP:$PostgresqlPort/$PostgresqlDatabase#" /opt/node/linkwarden/.env
sed -i "s/NEXTAUTH_SECRET=/NEXTAUTH_SECRET=$(dd bs=32 count=1 if=/dev/urandom | base64 | tr +/ _.)/" /opt/node/linkwarden/.env
sed -i "s#http://localhost:3000#$LinkwardenURL#" /opt/node/linkwarden/.env
#Save PM2 statup config
sudo -u node bash << EOF
(cd /opt/node/linkwarden; yarn prisma migrate deploy)
pm2 install pm2-logrotate
pm2 start yarn --name Linkwarden --cwd /opt/node/linkwarden -- concurrently:start
pm2 save
EOF