mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 10:22:50 +00:00 
			
		
		
		
	Refactor: linkwarden (#4236)
* refactor linkwarden * Update linkwarden-install.sh * Update linkwarden-install.sh * Update linkwarden.sh
This commit is contained in:
		@@ -28,6 +28,10 @@ function update_script() {
 | 
			
		||||
  fi
 | 
			
		||||
  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
 | 
			
		||||
    NODE_VERSION="22"
 | 
			
		||||
    NODE_MODULE="yarn@latest"
 | 
			
		||||
    install_node_and_modules
 | 
			
		||||
    
 | 
			
		||||
    msg_info "Stopping ${APP}"
 | 
			
		||||
    systemctl stop linkwarden
 | 
			
		||||
    msg_ok "Stopped ${APP}"
 | 
			
		||||
@@ -46,7 +50,7 @@ function update_script() {
 | 
			
		||||
    mv /opt/linkwarden/.env /opt/.env
 | 
			
		||||
    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) }')
 | 
			
		||||
    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
 | 
			
		||||
    mv linkwarden-${RELEASE:1} /opt/linkwarden
 | 
			
		||||
    cd /opt/linkwarden
 | 
			
		||||
@@ -54,8 +58,9 @@ function update_script() {
 | 
			
		||||
    $STD npx playwright install-deps
 | 
			
		||||
    $STD yarn playwright install
 | 
			
		||||
    cp /opt/.env /opt/linkwarden/.env
 | 
			
		||||
    $STD yarn build
 | 
			
		||||
    $STD yarn prisma migrate deploy
 | 
			
		||||
    $STD yarn prisma:generate
 | 
			
		||||
    $STD yarn web:build
 | 
			
		||||
    $STD yarn prisma:deploy
 | 
			
		||||
    echo "${RELEASE}" >/opt/${APP}_version.txt
 | 
			
		||||
    msg_ok "Updated ${APP} to ${RELEASE}"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,23 +18,15 @@ msg_info "Installing Dependencies"
 | 
			
		||||
$STD apt-get install -y \
 | 
			
		||||
  make \
 | 
			
		||||
  git \
 | 
			
		||||
  postgresql \
 | 
			
		||||
  build-essential \
 | 
			
		||||
  cargo \
 | 
			
		||||
  gnupg
 | 
			
		||||
  cargo
 | 
			
		||||
msg_ok "Installed Dependencies"
 | 
			
		||||
 | 
			
		||||
msg_info "Setting up Node.js Repository"
 | 
			
		||||
mkdir -p /etc/apt/keyrings
 | 
			
		||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
 | 
			
		||||
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
 | 
			
		||||
msg_ok "Set up Node.js Repository"
 | 
			
		||||
 | 
			
		||||
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"
 | 
			
		||||
NODE_VERSION="22"
 | 
			
		||||
NODE_MODULE="yarn@latest"
 | 
			
		||||
install_node_and_modules
 | 
			
		||||
PG_VERSION="15"
 | 
			
		||||
install_postgresql
 | 
			
		||||
 | 
			
		||||
msg_info "Installing Rust"
 | 
			
		||||
curl -fsSL https://sh.rustup.rs -o rustup-init.sh
 | 
			
		||||
@@ -92,7 +84,7 @@ fi
 | 
			
		||||
msg_info "Installing Linkwarden (Patience)"
 | 
			
		||||
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) }')
 | 
			
		||||
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
 | 
			
		||||
mv linkwarden-${RELEASE:1} /opt/linkwarden
 | 
			
		||||
cd /opt/linkwarden
 | 
			
		||||
@@ -106,8 +98,9 @@ NEXTAUTH_SECRET=${SECRET_KEY}
 | 
			
		||||
NEXTAUTH_URL=http://${IP}:3000
 | 
			
		||||
DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}
 | 
			
		||||
" >$env_path
 | 
			
		||||
$STD yarn build
 | 
			
		||||
$STD yarn prisma migrate deploy
 | 
			
		||||
$STD yarn prisma:generate
 | 
			
		||||
$STD yarn web:build
 | 
			
		||||
$STD yarn prisma:deploy
 | 
			
		||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
 | 
			
		||||
msg_ok "Installed Linkwarden"
 | 
			
		||||
 | 
			
		||||
@@ -121,7 +114,7 @@ After=network.target
 | 
			
		||||
Type=exec
 | 
			
		||||
Environment=PATH=$PATH
 | 
			
		||||
WorkingDirectory=/opt/linkwarden
 | 
			
		||||
ExecStart=/usr/bin/yarn start
 | 
			
		||||
ExecStart=/usr/bin/yarn concurrently:start
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
WantedBy=multi-user.target
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user