1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-03-08 13:19:05 +00:00

New Script: Docmost (#2472)

* New Script: Docmost LXC

* fix path

* add redis
This commit is contained in:
CanbiZ 2025-02-18 17:51:44 +01:00 committed by GitHub
parent 2693fabac2
commit 5a72b1e523
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 201 additions and 0 deletions

70
ct/docmost.sh Normal file
View File

@ -0,0 +1,70 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://docmost.com/
APP="Docmost"
var_tags="documents"
var_cpu="3"
var_ram="3072"
var_disk="7"
var_os="debian"
var_version="12"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/docmost ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/docmost/docmost/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping ${APP}"
systemctl stop docmost
msg_ok "${APP} Stopped"
msg_info "Updating ${APP} to v${RELEASE}"
cp /opt/docmost/.env /opt/
rm -rf /opt/docmost
temp_file=$(mktemp)
wget -q "https://github.com/docmost/docmost/archive/refs/tags/v${RELEASE}.tar.gz" -O "$temp_file"
tar -xzf "$temp_file"
mv docmost-${RELEASE} /opt/docmost
cd /opt/docmost
mv /opt/.env /opt/docmost/.env
pnpm install --force &>/dev/null
pnpm build &>/dev/null
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP}"
msg_info "Starting ${APP}"
systemctl start docmost
msg_ok "Started ${APP}"
msg_info "Cleaning Up"
rm -f ${temp_file}
msg_ok "Cleaned"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

View File

@ -0,0 +1,97 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (Canbiz)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/documenso/documenso
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
gpg \
curl \
sudo \
redis \
make \
mc \
postgresql
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"
$STD apt-get update
$STD apt-get install -y nodejs
$STD npm install -g pnpm
msg_ok "Installed Node.js"
msg_info "Setting up PostgreSQL"
DB_NAME="docmost_db"
DB_USER="docmost_user"
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | 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 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';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
{
echo "Docmost-Credentials"
echo "Database Name: $DB_NAME"
echo "Database User: $DB_USER"
echo "Database Password: $DB_PASS"
} >> ~/docmost.creds
msg_ok "Set up PostgreSQL"
msg_info "Installing Docmost (Patience)"
temp_file=$(mktemp)
RELEASE=$(curl -s https://api.github.com/repos/docmost/docmost/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q "https://github.com/docmost/docmost/archive/refs/tags/v${RELEASE}.tar.gz" -O "$temp_file"
tar -xzf "$temp_file"
mv docmost-${RELEASE} /opt/docmost
cd /opt/docmost
mv .env.example .env
sed -i "s|APP_SECRET=.*|APP_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)|" /opt/docmost/.env
sed -i "s|DATABASE_URL=.*|DATABASE_URL=postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME|" /opt/docmost/.env
export NODE_OPTIONS="--max-old-space-size=2048"
$STD pnpm install --force
$STD pnpm build
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Installed Docmost"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/docmost.service
[Unit]
Description=Docmost Service
After=network.target postgresql.service
[Service]
WorkingDirectory=/opt/docmost
ExecStart=/usr/bin/pnpm start
Restart=always
EnvironmentFile=/opt/docmost/.env
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now docmost
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
rm -f "$temp_file"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"

34
json/docmost.json Normal file
View File

@ -0,0 +1,34 @@
{
"name": "Docmost",
"slug": "docmost",
"categories": [
12
],
"date_created": "2025-02-18",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 3000,
"documentation": "https://docmost.com/docs/installation",
"website": "https://docmost.com/",
"logo": "https://raw.githubusercontent.com/docmost/docmost/refs/heads/main/apps/client/public/favicon-32x32.png",
"description": "Open-source collaborative wiki and documentation software Create, collaborate, and share knowledge seamlessly with Docmost. Ideal for managing your wiki, knowledge-base, documentation and a lot more.",
"install_methods": [
{
"type": "default",
"script": "ct/docmost.sh",
"resources": {
"cpu": 3,
"ram": 3072,
"hdd": 7,
"os": "debian",
"version": "12"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": []
}