Skip to content

Commit b959453

Browse files
authored
Refactor: linkwarden (#4236)
* refactor linkwarden * Update linkwarden-install.sh * Update linkwarden-install.sh * Update linkwarden.sh
1 parent 8e56da6 commit b959453

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

ct/linkwarden.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ function update_script() {
2828
fi
2929
RELEASE=$(curl -fsSL https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
3030
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
31+
NODE_VERSION="22"
32+
NODE_MODULE="yarn@latest"
33+
install_node_and_modules
34+
3135
msg_info "Stopping ${APP}"
3236
systemctl stop linkwarden
3337
msg_ok "Stopped ${APP}"
@@ -46,16 +50,17 @@ function update_script() {
4650
mv /opt/linkwarden/.env /opt/.env
4751
rm -rf /opt/linkwarden
4852
RELEASE=$(curl -fsSL https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
49-
curl -fsSL "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip" -o $(basename "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip")
53+
curl -fsSL "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip" -o ${RELEASE}.zip
5054
unzip -q ${RELEASE}.zip
5155
mv linkwarden-${RELEASE:1} /opt/linkwarden
5256
cd /opt/linkwarden
5357
$STD yarn
5458
$STD npx playwright install-deps
5559
$STD yarn playwright install
5660
cp /opt/.env /opt/linkwarden/.env
57-
$STD yarn build
58-
$STD yarn prisma migrate deploy
61+
$STD yarn prisma:generate
62+
$STD yarn web:build
63+
$STD yarn prisma:deploy
5964
echo "${RELEASE}" >/opt/${APP}_version.txt
6065
msg_ok "Updated ${APP} to ${RELEASE}"
6166

install/linkwarden-install.sh

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,15 @@ msg_info "Installing Dependencies"
1818
$STD apt-get install -y \
1919
make \
2020
git \
21-
postgresql \
2221
build-essential \
23-
cargo \
24-
gnupg
22+
cargo
2523
msg_ok "Installed Dependencies"
2624

27-
msg_info "Setting up Node.js Repository"
28-
mkdir -p /etc/apt/keyrings
29-
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
30-
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
31-
msg_ok "Set up Node.js Repository"
32-
33-
msg_info "Installing Node.js/Yarn"
34-
$STD apt-get update
35-
$STD apt-get install -y nodejs
36-
$STD npm install -g yarn
37-
msg_ok "Installed Node.js/Yarn"
25+
NODE_VERSION="22"
26+
NODE_MODULE="yarn@latest"
27+
install_node_and_modules
28+
PG_VERSION="15"
29+
install_postgresql
3830

3931
msg_info "Installing Rust"
4032
curl -fsSL https://sh.rustup.rs -o rustup-init.sh
@@ -92,7 +84,7 @@ fi
9284
msg_info "Installing Linkwarden (Patience)"
9385
cd /opt
9486
RELEASE=$(curl -fsSL https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
95-
curl -fsSL "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip" -o $(basename "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip")
87+
curl -fsSL "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip" -o ${RELEASE}.zip
9688
unzip -q ${RELEASE}.zip
9789
mv linkwarden-${RELEASE:1} /opt/linkwarden
9890
cd /opt/linkwarden
@@ -106,8 +98,9 @@ NEXTAUTH_SECRET=${SECRET_KEY}
10698
NEXTAUTH_URL=http://${IP}:3000
10799
DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}
108100
" >$env_path
109-
$STD yarn build
110-
$STD yarn prisma migrate deploy
101+
$STD yarn prisma:generate
102+
$STD yarn web:build
103+
$STD yarn prisma:deploy
111104
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
112105
msg_ok "Installed Linkwarden"
113106

@@ -121,7 +114,7 @@ After=network.target
121114
Type=exec
122115
Environment=PATH=$PATH
123116
WorkingDirectory=/opt/linkwarden
124-
ExecStart=/usr/bin/yarn start
117+
ExecStart=/usr/bin/yarn concurrently:start
125118
126119
[Install]
127120
WantedBy=multi-user.target

0 commit comments

Comments
 (0)