Added CT: Linkwarden

This commit is contained in:
2025-01-05 22:33:27 +01:00
parent c767b21856
commit 37cb093f30
6 changed files with 134 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
#!/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 -- start
pm2 save
EOF

View File

@@ -0,0 +1,32 @@
#!/bin/sh
#Install monolith
CurmonolithVersion=$(curl -s https://api.github.com/repos/Y2Z/monolith/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " " |tr -d : )
curl -L -o /opt/monolith-gnu-linux-x86_64 https://github.com/Y2Z/monolith/releases/download/"$CurmonolithVersion"/monolith-gnu-linux-x86_64
chmod +x /opt/monolith-gnu-linux-x86_64
echo "$CurmonolithVersion" > /opt/monolith-Version
ln -s /opt/monolith-gnu-linux-x86_64 /usr/local/bin/monolith
#Install linkwarden
rm -rf /root/.cache
startpath=$(pwd)
#Install Linkwarden
echo $(curl -s https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " " |tr -d : ) > /opt/linkwarden-Version
npm install -g yarn
git clone https://github.com/linkwarden/linkwarden.git /opt/node/linkwarden
cd /opt/node/linkwarden
npx playwright install --with-deps chromium
rm -rf /root/.cache
yarn install
yarn prisma generate
yarn build
yarn cache clean
apt clean
cd $startpath
cp /opt/node/linkwarden/.env.sample /opt/node/linkwarden/.env
chown node: -R /opt/node/linkwarden
su -c "cd /opt/node/linkwarden; npx playwright install chromium" node

View File

@@ -0,0 +1,3 @@
#!/bin/sh
# Update script for updating apps with ProxmoxHelper/ProxMoxToolKit
ash /opt/Update-monlith.sh

View File

@@ -0,0 +1,13 @@
#!/bin/bash
CurmonolithVersion=$(curl -s https://api.github.com/repos/Y2Z/monolith/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " " |tr -d : )
if test "$CurmonolithVersion" = "$(cat /opt/monolith-Version)" ; then
echo ' echo 'Updating Monolith'.sh up-to-date'
exit
else
echo 'Updating Monolith'
mv /opt/monolith-gnu-linux-x86_64 /opt/monolith-gnu-linux-x86_64.old
curl -L -o /opt/monolith-gnu-linux-x86_64 https://github.com/Y2Z/monolith/releases/download/"$CurmonolithVersion"/monolith-gnu-linux-x86_64
chmod +x /opt/monolith-gnu-linux-x86_64
echo "$CurmonolithVersion" > /opt/monolith-Version
fi