Files
ProxmoxVE/install/docmost-install.sh
T

77 lines
2.5 KiB
Bash
Raw Normal View History

2025-02-18 17:51:44 +01:00
#!/usr/bin/env bash
# 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
# Source: https://docmost.com/ | Github: https://github.com/docmost/docmost
2025-02-18 17:51:44 +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 \
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
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
# 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.
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
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
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\"|" \
-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|" \
-e "s|^STORAGE_DRIVER=azure|#STORAGE_DRIVER=azure|" \
/opt/docmost/.env
2025-02-18 17:51:44 +01:00
export NODE_OPTIONS="--max-old-space-size=2048"
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
cleanup_lxc