forked from TheWrightServer/ProxmoxVE
Linkwarden - Harmonize Script, Add Monolith & Bugfixing (#306)
* Update linkwarden.sh Add new StorageCheck Harmonize Update Script Increase Ressources Correct check of version * Update linkwarden-install.sh Harmonize Script Switch from Git to Release Add Monolith Add Cargo * Tweak * Update linkwarden.json
This commit is contained in:
parent
b9e84543fc
commit
fb0706469b
@ -19,7 +19,7 @@ EOF
|
|||||||
header_info
|
header_info
|
||||||
echo -e "Loading..."
|
echo -e "Loading..."
|
||||||
APP="Linkwarden"
|
APP="Linkwarden"
|
||||||
var_disk="8"
|
var_disk="12"
|
||||||
var_cpu="2"
|
var_cpu="2"
|
||||||
var_ram="2048"
|
var_ram="2048"
|
||||||
var_os="ubuntu"
|
var_os="ubuntu"
|
||||||
@ -54,8 +54,9 @@ function default_settings() {
|
|||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
|
check_container_storage
|
||||||
|
check_container_resources
|
||||||
if [[ ! -d /opt/linkwarden ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
if [[ ! -d /opt/linkwarden ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
||||||
|
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -s 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
|
||||||
msg_info "Stopping ${APP}"
|
msg_info "Stopping ${APP}"
|
||||||
@ -63,20 +64,29 @@ if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}
|
|||||||
msg_ok "Stopped ${APP}"
|
msg_ok "Stopped ${APP}"
|
||||||
|
|
||||||
msg_info "Updating ${APP} to ${RELEASE}"
|
msg_info "Updating ${APP} to ${RELEASE}"
|
||||||
|
cd /opt
|
||||||
|
mv /opt/linkwarden /opt/linkwarden_bak
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
wget -q "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip"
|
||||||
|
unzip -q ${RELEASE}.zip
|
||||||
|
mv linkwarden-${RELEASE:1} /opt/linkwarden
|
||||||
cd /opt/linkwarden
|
cd /opt/linkwarden
|
||||||
git pull
|
yarn &>/dev/null
|
||||||
yarn
|
npx playwright install-deps &>/dev/null
|
||||||
npx playwright install-deps
|
yarn playwright install &>/dev/null
|
||||||
yarn playwright install
|
cp /opt/linkwarden_bak/.env /opt/linkwarden/.env
|
||||||
yarn prisma generate
|
yarn build &>/dev/null
|
||||||
yarn build
|
yarn prisma migrate deploy &>/dev/null
|
||||||
yarn prisma migrate 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}"
|
||||||
|
|
||||||
msg_info "Starting ${APP}"
|
msg_info "Starting ${APP}"
|
||||||
systemctl start linkwarden
|
systemctl start linkwarden
|
||||||
msg_ok "Started ${APP}"
|
msg_ok "Started ${APP}"
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -rf /opt/${RELEASE}.zip
|
||||||
|
rm -rf /opt/linkwarden_bak
|
||||||
|
msg_ok "Cleaned"
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}."
|
msg_ok "No update required. ${APP} is already at ${RELEASE}."
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# Copyright (c) 2021-2024 tteck
|
# Copyright (c) 2021-2024 tteck
|
||||||
# Author: tteck (tteckster)
|
# Author: tteck (tteckster)
|
||||||
|
# Co-Author: MickLesk (Canbiz)
|
||||||
# License: MIT
|
# License: MIT
|
||||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
@ -14,12 +15,13 @@ network_check
|
|||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y curl
|
$STD apt-get install -y \
|
||||||
$STD apt-get install -y sudo
|
curl \
|
||||||
$STD apt-get install -y mc
|
sudo \
|
||||||
$STD apt-get install -y git
|
mc \
|
||||||
$STD apt-get install -y gpg
|
make \
|
||||||
$STD apt-get install -y postgresql
|
postgresql \
|
||||||
|
cargo
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Setting up Node.js Repository"
|
msg_info "Setting up Node.js Repository"
|
||||||
@ -34,22 +36,28 @@ $STD apt-get install -y nodejs
|
|||||||
$STD npm install -g yarn
|
$STD npm install -g yarn
|
||||||
msg_ok "Installed Node.js/Yarn"
|
msg_ok "Installed Node.js/Yarn"
|
||||||
|
|
||||||
msg_info "Clone Linkwarden Repository"
|
msg_info "Installing Monolith"
|
||||||
$STD git clone https://github.com/linkwarden/linkwarden.git /opt/linkwarden
|
$STD cargo install monolith
|
||||||
cd /opt/linkwarden
|
echo 'export PATH=~/.cargo/bin:$PATH' >>~/.bashrc
|
||||||
msg_ok "Cloned Linkwarden Repository"
|
export PATH=~/.cargo/bin:$PATH
|
||||||
|
msg_ok "Installed Monolith"
|
||||||
|
|
||||||
msg_info "Setting up PostgreSQL DB"
|
msg_info "Setting up PostgreSQL DB"
|
||||||
DB_NAME=linkwardendb
|
DB_NAME=linkwardendb
|
||||||
DB_USER=linkwarden
|
DB_USER=linkwarden
|
||||||
DB_PASS="$(openssl rand -base64 18 | tr -d '/' | cut -c1-13)"
|
DB_PASS="$(openssl rand -base64 18 | tr -d '/' | cut -c1-13)"
|
||||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
|
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
|
||||||
|
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
|
||||||
echo "" >>~/linkwarden.creds
|
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
|
||||||
echo -e "Linkwarden Database User: \e[32m$DB_USER\e[0m" >>~/linkwarden.creds
|
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
|
||||||
echo -e "Linkwarden Database Password: \e[32m$DB_PASS\e[0m" >>~/linkwarden.creds
|
{
|
||||||
echo -e "Linkwarden Database Name: \e[32m$DB_NAME\e[0m" >>~/linkwarden.creds
|
echo "Linkwarden-Credentials"
|
||||||
|
echo "Linkwarden Database User: $DB_USER"
|
||||||
|
echo "Linkwarden Database Password: $DB_PASS"
|
||||||
|
echo "Linkwarden Database Name: $DB_NAME"
|
||||||
|
echo "Linkwarden Secret: $SECRET_KEY"
|
||||||
|
} >> ~/linkwarden.creds
|
||||||
msg_ok "Set up PostgreSQL DB"
|
msg_ok "Set up PostgreSQL DB"
|
||||||
|
|
||||||
read -r -p "Would you like to add Adminer? <y/N> " prompt
|
read -r -p "Would you like to add Adminer? <y/N> " prompt
|
||||||
@ -66,12 +74,24 @@ if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
|||||||
echo -e "Adminer Username: \e[32m$DB_USER\e[0m" >>~/linkwarden.creds
|
echo -e "Adminer Username: \e[32m$DB_USER\e[0m" >>~/linkwarden.creds
|
||||||
echo -e "Adminer Password: \e[32m$DB_PASS\e[0m" >>~/linkwarden.creds
|
echo -e "Adminer Password: \e[32m$DB_PASS\e[0m" >>~/linkwarden.creds
|
||||||
echo -e "Adminer Database: \e[32m$DB_NAME\e[0m" >>~/linkwarden.creds
|
echo -e "Adminer Database: \e[32m$DB_NAME\e[0m" >>~/linkwarden.creds
|
||||||
|
{
|
||||||
|
echo ""
|
||||||
|
echo "Adminer-Credentials"
|
||||||
|
echo "Adminer WebUI: $IP/adminer/"
|
||||||
|
echo "Adminer Database User: $DB_USER"
|
||||||
|
echo "Adminer Database Password: $DB_PASS"
|
||||||
|
echo "Adminer Database Name: $DB_NAME"
|
||||||
|
} >> ~/linkwarden.creds
|
||||||
msg_ok "Installed Adminer"
|
msg_ok "Installed Adminer"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Installing Linkwarden (Patience)"
|
msg_info "Installing Linkwarden (Patience)"
|
||||||
|
cd /opt
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -s https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
wget -q "https://github.com/linkwarden/linkwarden/archive/refs/tags/${RELEASE}.zip"
|
||||||
|
unzip -q ${RELEASE}.zip
|
||||||
|
mv linkwarden-${RELEASE:1} /opt/linkwarden
|
||||||
|
cd /opt/linkwarden
|
||||||
$STD yarn
|
$STD yarn
|
||||||
$STD npx playwright install-deps
|
$STD npx playwright install-deps
|
||||||
$STD yarn playwright install
|
$STD yarn playwright install
|
||||||
@ -85,6 +105,7 @@ DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}
|
|||||||
" >$env_path
|
" >$env_path
|
||||||
$STD yarn build
|
$STD yarn build
|
||||||
$STD yarn prisma migrate deploy
|
$STD yarn prisma migrate deploy
|
||||||
|
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||||
msg_ok "Installed Linkwarden"
|
msg_ok "Installed Linkwarden"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
@ -108,6 +129,7 @@ motd_ssh
|
|||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
|
rm -rf /opt/${RELEASE}.zip
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"updateable": false,
|
"updateable": false,
|
||||||
"privileged": false,
|
"privileged": false,
|
||||||
"interface_port": "3000",
|
"interface_port": "3000",
|
||||||
"documentation": null,
|
"documentation": "https://docs.linkwarden.app/",
|
||||||
"website": "https://linkwarden.app/",
|
"website": "https://linkwarden.app/",
|
||||||
"logo": "https://raw.githubusercontent.com/linkwarden/linkwarden/main/assets/logo.png",
|
"logo": "https://raw.githubusercontent.com/linkwarden/linkwarden/main/assets/logo.png",
|
||||||
"description": "Linkwarden is a fully self-hostable, open-source collaborative bookmark manager to collect, organize and archive webpages.",
|
"description": "Linkwarden is a fully self-hostable, open-source collaborative bookmark manager to collect, organize and archive webpages.",
|
||||||
@ -20,7 +20,7 @@
|
|||||||
"resources": {
|
"resources": {
|
||||||
"cpu": "2",
|
"cpu": "2",
|
||||||
"ram": "2048",
|
"ram": "2048",
|
||||||
"hdd": "8",
|
"hdd": "12",
|
||||||
"os": "ubuntu",
|
"os": "ubuntu",
|
||||||
"version": "22.04"
|
"version": "22.04"
|
||||||
}
|
}
|
||||||
@ -32,8 +32,8 @@
|
|||||||
},
|
},
|
||||||
"notes": [
|
"notes": [
|
||||||
{
|
{
|
||||||
"text": "Show Database/Adminer Credentials: `cat linkwarden.creds`",
|
"text": "Linkwarden > 2.8.2 needs Monolith, More info: `https://github.com/community-scripts/ProxmoxVE/discussions/305`",
|
||||||
"type": "warning"
|
"type": "info"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user