1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-05-06 05:03:08 +00:00

Refactor: linkwarden (#4236)

* refactor linkwarden

* Update linkwarden-install.sh

* Update linkwarden-install.sh

* Update linkwarden.sh
This commit is contained in:
CanbiZ 2025-05-05 15:30:16 +02:00 committed by GitHub
parent 8e56da691a
commit b9594538ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 21 deletions

View File

@ -28,6 +28,10 @@ function update_script() {
fi fi
RELEASE=$(curl -fsSL https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -fsSL https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
NODE_VERSION="22"
NODE_MODULE="yarn@latest"
install_node_and_modules
msg_info "Stopping ${APP}" msg_info "Stopping ${APP}"
systemctl stop linkwarden systemctl stop linkwarden
msg_ok "Stopped ${APP}" msg_ok "Stopped ${APP}"
@ -46,7 +50,7 @@ function update_script() {
mv /opt/linkwarden/.env /opt/.env mv /opt/linkwarden/.env /opt/.env
rm -rf /opt/linkwarden rm -rf /opt/linkwarden
RELEASE=$(curl -fsSL https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -fsSL https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
curl -fsSL "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip" -o $(basename "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip") curl -fsSL "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip" -o ${RELEASE}.zip
unzip -q ${RELEASE}.zip unzip -q ${RELEASE}.zip
mv linkwarden-${RELEASE:1} /opt/linkwarden mv linkwarden-${RELEASE:1} /opt/linkwarden
cd /opt/linkwarden cd /opt/linkwarden
@ -54,8 +58,9 @@ function update_script() {
$STD npx playwright install-deps $STD npx playwright install-deps
$STD yarn playwright install $STD yarn playwright install
cp /opt/.env /opt/linkwarden/.env cp /opt/.env /opt/linkwarden/.env
$STD yarn build $STD yarn prisma:generate
$STD yarn prisma migrate deploy $STD yarn web:build
$STD yarn prisma:deploy
echo "${RELEASE}" >/opt/${APP}_version.txt echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}" msg_ok "Updated ${APP} to ${RELEASE}"

View File

@ -18,23 +18,15 @@ msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
make \ make \
git \ git \
postgresql \
build-essential \ build-essential \
cargo \ cargo
gnupg
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Setting up Node.js Repository" NODE_VERSION="22"
mkdir -p /etc/apt/keyrings NODE_MODULE="yarn@latest"
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg install_node_and_modules
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list PG_VERSION="15"
msg_ok "Set up Node.js Repository" install_postgresql
msg_info "Installing Node.js/Yarn"
$STD apt-get update
$STD apt-get install -y nodejs
$STD npm install -g yarn
msg_ok "Installed Node.js/Yarn"
msg_info "Installing Rust" msg_info "Installing Rust"
curl -fsSL https://sh.rustup.rs -o rustup-init.sh curl -fsSL https://sh.rustup.rs -o rustup-init.sh
@ -92,7 +84,7 @@ fi
msg_info "Installing Linkwarden (Patience)" msg_info "Installing Linkwarden (Patience)"
cd /opt cd /opt
RELEASE=$(curl -fsSL https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -fsSL https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
curl -fsSL "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip" -o $(basename "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip") curl -fsSL "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip" -o ${RELEASE}.zip
unzip -q ${RELEASE}.zip unzip -q ${RELEASE}.zip
mv linkwarden-${RELEASE:1} /opt/linkwarden mv linkwarden-${RELEASE:1} /opt/linkwarden
cd /opt/linkwarden cd /opt/linkwarden
@ -106,8 +98,9 @@ NEXTAUTH_SECRET=${SECRET_KEY}
NEXTAUTH_URL=http://${IP}:3000 NEXTAUTH_URL=http://${IP}:3000
DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME} DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}
" >$env_path " >$env_path
$STD yarn build $STD yarn prisma:generate
$STD yarn prisma migrate deploy $STD yarn web:build
$STD yarn prisma:deploy
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed Linkwarden" msg_ok "Installed Linkwarden"
@ -121,7 +114,7 @@ After=network.target
Type=exec Type=exec
Environment=PATH=$PATH Environment=PATH=$PATH
WorkingDirectory=/opt/linkwarden WorkingDirectory=/opt/linkwarden
ExecStart=/usr/bin/yarn start ExecStart=/usr/bin/yarn concurrently:start
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target