mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-05-16 08:40:25 +00:00
Fix wikijs (#3232)
This commit is contained in:
parent
f031dcb34e
commit
a1e3ae6b5b
65
ct/wikijs.sh
65
ct/wikijs.sh
@ -27,35 +27,50 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
msg_info "Stopping ${APP}"
|
RELEASE=$(curl -s https://api.github.com/repos/Requarks/wiki/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
systemctl stop wikijs
|
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||||
msg_ok "Stopped ${APP}"
|
msg_info "Verifying whether ${APP}' new release is v3.x+ and current install uses SQLite."
|
||||||
|
SQLITE_INSTALL=$([ -f /opt/wikijs/db.sqlite ] && echo "true" || echo "false")
|
||||||
|
if [[ "${SQLITE_INSTALL}" == "true" && "${RELEASE}" =~ ^3.* ]]; then
|
||||||
|
echo "SQLite is not supported in v3.x+, currently there is no update path availble."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
msg_ok "There is an update path available for ${APP} to v${RELEASE}"
|
||||||
|
|
||||||
msg_info "Backing up Data"
|
msg_info "Stopping ${APP}"
|
||||||
rm -rf ~/data-backup
|
systemctl stop wikijs
|
||||||
mkdir -p ~/data-backup
|
msg_ok "Stopped ${APP}"
|
||||||
[ -f /opt/wikijs/db.sqlite ] && cp /opt/wikijs/db.sqlite ~/data-backup
|
|
||||||
[ -f /opt/wikijs/config.yml ] && cp /opt/wikijs/config.yml ~/data-backup
|
|
||||||
[ -d /opt/wikijs/data ] && cp -R /opt/wikijs/data ~/data-backup
|
|
||||||
msg_ok "Backed up Data"
|
|
||||||
|
|
||||||
msg_info "Updating ${APP}"
|
msg_info "Backing up Data"
|
||||||
rm -rf /opt/wikijs/*
|
mkdir /opt/wikijs-backup
|
||||||
cd /opt/wikijs
|
$SQLITE_INSTALL && cp /opt/wikijs/db.sqlite /opt/wikijs-backup
|
||||||
wget -q https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz
|
cp -R /opt/wikijs/{config.yml,/data} /opt/wikijs-backup
|
||||||
tar xzf wiki-js.tar.gz
|
msg_ok "Backed up Data"
|
||||||
msg_ok "Updated ${APP}"
|
|
||||||
|
|
||||||
msg_info "Restoring Data"
|
msg_info "Updating ${APP}"
|
||||||
cp -R ~/data-backup/* /opt/wikijs
|
rm -rf /opt/wikijs/*
|
||||||
rm -rf ~/data-backup
|
cd /opt/wikijs
|
||||||
$STD npm rebuild sqlite3
|
wget -q "https://github.com/requarks/wiki/releases/download/v${RELEASE}/wiki-js.tar.gz"
|
||||||
msg_ok "Restored Data"
|
tar -xzf wiki-js.tar.gz
|
||||||
|
msg_ok "Updated ${APP}"
|
||||||
|
|
||||||
msg_info "Starting ${APP}"
|
msg_info "Restoring Data"
|
||||||
systemctl start wikijs
|
cp -R /opt/wikijs-backup/* /opt/wikijs
|
||||||
msg_ok "Started ${APP}"
|
$SQLITE_INSTALL && $STD npm rebuild sqlite3
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Restored Data"
|
||||||
|
|
||||||
|
msg_info "Starting ${APP}"
|
||||||
|
systemctl start wikijs
|
||||||
|
msg_ok "Started ${APP}"
|
||||||
|
|
||||||
|
msg_info "Cleaning Up"
|
||||||
|
rm -rf /opt/wikijs/wiki-js.tar.gz
|
||||||
|
rm -rf /opt/wikijs-backup
|
||||||
|
msg_ok "Cleanup Completed"
|
||||||
|
msg_ok "Updated Successfully"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,12 +19,7 @@ $STD apt-get install -y \
|
|||||||
sudo \
|
sudo \
|
||||||
mc \
|
mc \
|
||||||
git \
|
git \
|
||||||
ca-certificates \
|
gpg
|
||||||
gnupg \
|
|
||||||
build-essential \
|
|
||||||
python3 \
|
|
||||||
g++ \
|
|
||||||
make
|
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Setting up Node.js Repository"
|
msg_info "Setting up Node.js Repository"
|
||||||
@ -67,16 +62,12 @@ msg_ok "Set up PostgreSQL"
|
|||||||
msg_info "Setup Wiki.js"
|
msg_info "Setup Wiki.js"
|
||||||
temp_file=$(mktemp)
|
temp_file=$(mktemp)
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/Requarks/wiki/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
RELEASE=$(curl -s https://api.github.com/repos/Requarks/wiki/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
wget -q "https://github.com/Requarks/wiki/archive/refs/tags/v${RELEASE}.tar.gz" -O "$temp_file"
|
wget -q "https://github.com/requarks/wiki/releases/download/v${RELEASE}/wiki-js.tar.gz" -O "$temp_file"
|
||||||
tar -xzf "$temp_file"
|
mkdir /opt/wikijs
|
||||||
mv wiki-${RELEASE} /opt/wikijs
|
tar -xzf "$temp_file" -C /opt/wikijs
|
||||||
mv /opt/wikijs/config.sample.yml /opt/wikijs/config.yml
|
mv /opt/wikijs/config.sample.yml /opt/wikijs/config.yml
|
||||||
sed -i -E 's|^( *user: ).*|\1'"$DB_USER"'|' /opt/wikijs/config.yml
|
sed -i -E 's|^( *user: ).*|\1'"$DB_USER"'|' /opt/wikijs/config.yml
|
||||||
sed -i -E 's|^( *pass: ).*|\1'"$DB_PASS"'|' /opt/wikijs/config.yml
|
sed -i -E 's|^( *pass: ).*|\1'"$DB_PASS"'|' /opt/wikijs/config.yml
|
||||||
cd /opt/wikijs
|
|
||||||
export NODE_OPTIONS="--max-old-space-size=2048"
|
|
||||||
$STD yarn install --ignore-engines
|
|
||||||
$STD yarn build
|
|
||||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||||
msg_ok "Installed Wiki.js"
|
msg_ok "Installed Wiki.js"
|
||||||
|
|
||||||
@ -88,7 +79,7 @@ After=network.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/bin/yarn start
|
ExecStart=/usr/bin/node server
|
||||||
Restart=always
|
Restart=always
|
||||||
User=root
|
User=root
|
||||||
Environment=NODE_ENV=production
|
Environment=NODE_ENV=production
|
||||||
|
Loading…
x
Reference in New Issue
Block a user