Files
HomeServerCTs/CT-Files/linkwarden/Scripts/FirstRun.sh
Bram Prieshof 0876675006 CT Linkwarden Postgresq: Debian 13 fixes
linkwarden: removed unnecessary build step, fixed deploy command
postgresql: locked major version, bumpt it from 17 to 18, updated config for compatibility, added sleep to config to make sure Postgres is up
aptcacherng: skips overwriting existing service symlink
2025-10-28 00:17:08 +01:00

32 lines
951 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:deploy)
pm2 install pm2-logrotate
pm2 start yarn --name Linkwarden --cwd /opt/node/linkwarden -- concurrently:start
pm2 save
EOF