parent
87b7166924
commit
c612a4daa8
13
ct/wikijs.sh
13
ct/wikijs.sh
@ -27,8 +27,9 @@ function update_script() {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/Requarks/wiki/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||
if [[ "${RELEASE}" != "$(cat ~/.wikijs)" ]] || [[ ! -f ~/.wikijs ]]; then
|
||||
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
|
||||
@ -47,13 +48,9 @@ function update_script() {
|
||||
cp -R /opt/wikijs/{config.yml,/data} /opt/wikijs-backup
|
||||
msg_ok "Backed up Data"
|
||||
|
||||
msg_info "Updating ${APP}"
|
||||
rm -rf /opt/wikijs/*
|
||||
cd /opt/wikijs
|
||||
curl -fsSL "https://github.com/requarks/wiki/releases/download/v${RELEASE}/wiki-js.tar.gz" -o $(basename "https://github.com/requarks/wiki/releases/download/v${RELEASE}/wiki-js.tar.gz")
|
||||
tar -xzf wiki-js.tar.gz
|
||||
msg_ok "Updated ${APP}"
|
||||
|
||||
fetch_and_deploy_gh_release "wikijs" "requarks/wiki" "prebuild" "latest" "/opt/wikijs" "wiki-js.tar.gz"
|
||||
|
||||
msg_info "Restoring Data"
|
||||
cp -R /opt/wikijs-backup/* /opt/wikijs
|
||||
$SQLITE_INSTALL && $STD npm rebuild sqlite3
|
||||
@ -64,9 +61,9 @@ function update_script() {
|
||||
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}"
|
||||
|
@ -1,35 +1,35 @@
|
||||
{
|
||||
"name": "Wiki.js",
|
||||
"slug": "wikijs",
|
||||
"categories": [
|
||||
12
|
||||
],
|
||||
"date_created": "2024-05-02",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 3000,
|
||||
"documentation": null,
|
||||
"website": "https://js.wiki/",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/wiki-js.webp",
|
||||
"config_path": "/opt/wikijs/config.yml",
|
||||
"description": "Wiki.js is a free, open-source, and modern wiki application built using Node.js. It is designed to be fast, easy to use, and flexible, with a range of features for collaboration, knowledge management, and content creation. Wiki.js supports Markdown syntax for editing pages, and includes features such as version control, page history, and access control, making it easy to manage content and collaborate with others. The software is fully customizable, with a range of themes and extensions available, and can be deployed on a local server or in the cloud, making it an ideal choice for small teams and organizations looking to create and manage a wiki. Wiki.js provides a modern, user-friendly interface, and supports a range of data sources, including local file systems, databases, and cloud storage services.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/wikijs.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 2048,
|
||||
"hdd": 7,
|
||||
"os": "debian",
|
||||
"version": "12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": []
|
||||
"name": "Wiki.js",
|
||||
"slug": "wikijs",
|
||||
"categories": [
|
||||
12
|
||||
],
|
||||
"date_created": "2024-05-02",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 3000,
|
||||
"documentation": "https://docs.requarks.io/",
|
||||
"website": "https://js.wiki/",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/wiki-js.webp",
|
||||
"config_path": "/opt/wikijs/config.yml",
|
||||
"description": "Wiki.js is a free, open-source, and modern wiki application built using Node.js. It is designed to be fast, easy to use, and flexible, with a range of features for collaboration, knowledge management, and content creation. Wiki.js supports Markdown syntax for editing pages, and includes features such as version control, page history, and access control, making it easy to manage content and collaborate with others. The software is fully customizable, with a range of themes and extensions available, and can be deployed on a local server or in the cloud, making it an ideal choice for small teams and organizations looking to create and manage a wiki. Wiki.js provides a modern, user-friendly interface, and supports a range of data sources, including local file systems, databases, and cloud storage services.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/wikijs.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 2048,
|
||||
"hdd": 7,
|
||||
"os": "debian",
|
||||
"version": "12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": []
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ msg_ok "Installed Dependencies"
|
||||
|
||||
NODE_VERSION="20" NODE_MODULE="yarn@latest,node-gyp" setup_nodejs
|
||||
PG_VERSION="17" setup_postgresql
|
||||
fetch_and_deploy_gh_release "wikijs" "requarks/wiki" "prebuild" "latest" "/opt/wikijs" "wiki-js.tar.gz"
|
||||
|
||||
msg_info "Set up PostgreSQL"
|
||||
DB_NAME="wiki"
|
||||
@ -39,17 +40,11 @@ $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
|
||||
} >>~/wikijs.creds
|
||||
msg_ok "Set up PostgreSQL"
|
||||
|
||||
msg_info "Setup Wiki.js"
|
||||
temp_file=$(mktemp)
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/Requarks/wiki/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
curl -fsSL "https://github.com/requarks/wiki/releases/download/v${RELEASE}/wiki-js.tar.gz" -o ""$temp_file""
|
||||
mkdir /opt/wikijs
|
||||
tar -xzf "$temp_file" -C /opt/wikijs
|
||||
msg_info "Configuring Wiki.js"
|
||||
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|^( *pass: ).*|\1'"$DB_PASS"'|' /opt/wikijs/config.yml
|
||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||
msg_ok "Installed Wiki.js"
|
||||
msg_ok "Configured Wiki.js"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/wikijs.service
|
||||
@ -75,7 +70,6 @@ motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -f "$temp_file"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
Loading…
x
Reference in New Issue
Block a user