2025-02-18 17:51:44 +01:00
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
2026-01-06 13:28:12 +01:00
|
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
2025-02-18 17:51:44 +01:00
|
|
|
|
# Author: MickLesk (Canbiz)
|
|
|
|
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
2026-02-24 15:11:53 +01:00
|
|
|
|
# Source: https://docmost.com/ | Github: https://github.com/docmost/docmost
|
2025-02-18 17:51:44 +01:00
|
|
|
|
|
2025-03-24 14:20:56 +01:00
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
2025-02-18 17:51:44 +01:00
|
|
|
|
color
|
|
|
|
|
|
verb_ip6
|
|
|
|
|
|
catch_errors
|
|
|
|
|
|
setting_up_container
|
|
|
|
|
|
network_check
|
|
|
|
|
|
update_os
|
|
|
|
|
|
|
|
|
|
|
|
msg_info "Installing Dependencies"
|
2025-10-07 13:11:49 +02:00
|
|
|
|
$STD apt install -y \
|
2025-02-18 17:51:44 +01:00
|
|
|
|
redis \
|
2025-05-27 13:48:34 +02:00
|
|
|
|
make
|
2025-02-18 17:51:44 +01:00
|
|
|
|
msg_ok "Installed Dependencies"
|
|
|
|
|
|
|
2026-07-28 21:36:40 +10:00
|
|
|
|
NODE_VERSION="26" NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/docmost/docmost/main/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs
|
2025-06-18 12:03:00 +02:00
|
|
|
|
PG_VERSION="16" setup_postgresql
|
2025-12-02 09:44:59 +01:00
|
|
|
|
PG_DB_NAME="docmost_db" PG_DB_USER="docmost_user" setup_postgresql_db
|
2026-01-07 08:49:12 +01:00
|
|
|
|
fetch_and_deploy_gh_release "docmost" "docmost/docmost" "tarball"
|
2025-02-18 17:51:44 +01:00
|
|
|
|
|
2025-07-07 20:37:57 +02:00
|
|
|
|
msg_info "Configuring Docmost (Patience)"
|
2025-02-18 17:51:44 +01:00
|
|
|
|
cd /opt/docmost
|
2026-03-04 10:23:29 +01:00
|
|
|
|
|
|
|
|
|
|
# Fix: Docmost EE (audit logs etc.) lives in a git submodule that is NOT
|
|
|
|
|
|
# included in GitHub tarballs. The community NoopAuditService exists but
|
|
|
|
|
|
# is only exported by CoreModule – child modules such as UserModule cannot
|
|
|
|
|
|
# resolve it. Making CoreModule @Global() exposes the token app-wide.
|
2026-05-22 11:05:53 +02:00
|
|
|
|
if [[ ! -f /opt/docmost/apps/server/src/ee/ee.module.ts ]] &&
|
|
|
|
|
|
! grep -q '@Global()' /opt/docmost/apps/server/src/core/core.module.ts 2>/dev/null; then
|
2026-03-04 10:23:29 +01:00
|
|
|
|
sed -i '/^ Module,$/a\ Global,' /opt/docmost/apps/server/src/core/core.module.ts
|
|
|
|
|
|
sed -i '/^@Module({$/i @Global()' /opt/docmost/apps/server/src/core/core.module.ts
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
2025-02-18 17:51:44 +01:00
|
|
|
|
mv .env.example .env
|
2025-02-24 13:10:32 +01:00
|
|
|
|
mkdir data
|
2026-10-03 08:19:10 +02:00
|
|
|
|
sed -i -e "s|APP_SECRET=.*|APP_SECRET=$(random_password 32)|" \
|
2025-12-02 09:44:59 +01:00
|
|
|
|
-e "s|DATABASE_URL=.*|DATABASE_URL=\"postgres://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME?schema=public\"|" \
|
2025-03-24 14:20:56 +01:00
|
|
|
|
-e "s|FILE_UPLOAD_SIZE_LIMIT=.*|FILE_UPLOAD_SIZE_LIMIT=50mb|" \
|
2025-10-07 13:11:49 +02:00
|
|
|
|
-e "s|DRAWIO_URL=.*|DRAWIO_URL=https://embed.diagrams.net|" \
|
|
|
|
|
|
-e "s|DISABLE_TELEMETRY=.*|DISABLE_TELEMETRY=true|" \
|
2025-12-02 09:44:59 +01:00
|
|
|
|
-e "s|APP_URL=.*|APP_URL=http://$LOCAL_IP:3000|" \
|
2026-05-22 11:05:53 +02:00
|
|
|
|
-e "s|^STORAGE_DRIVER=azure|#STORAGE_DRIVER=azure|" \
|
2025-03-24 14:20:56 +01:00
|
|
|
|
/opt/docmost/.env
|
2025-02-18 17:51:44 +01:00
|
|
|
|
export NODE_OPTIONS="--max-old-space-size=2048"
|
2026-09-16 11:59:00 +02:00
|
|
|
|
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
2025-02-20 16:32:21 +01:00
|
|
|
|
$STD pnpm install
|
2025-02-18 17:51:44 +01:00
|
|
|
|
$STD pnpm build
|
2025-07-07 20:37:57 +02:00
|
|
|
|
msg_ok "Configured Docmost"
|
2025-02-18 17:51:44 +01:00
|
|
|
|
|
|
|
|
|
|
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
|
2025-11-22 17:27:13 +01:00
|
|
|
|
cleanup_lxc
|