Skip to content

Commit 50aa001

Browse files
documenso (#4080)
* 'Add new script' * little fixes * Update documenso.sh * add config path * Update documenso.json * Update documenso.json * Update documenso-install.sh * Update documenso.sh --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <[email protected]>
1 parent c0398ef commit 50aa001

File tree

3 files changed

+230
-0
lines changed

3 files changed

+230
-0
lines changed

ct/documenso.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/documenso/documenso
7+
8+
APP="Documenso"
9+
var_tags="${var_tags:-document}"
10+
var_disk="${var_disk:-12}"
11+
var_cpu="${var_cpu:-6}"
12+
var_ram="${var_ram:-6144}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-12}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
if [[ ! -d /opt/documenso ]]; then
27+
msg_error "No ${APP} Installation Found!"
28+
exit
29+
fi
30+
RELEASE=$(curl -fsSL https://api.github.com/repos/documenso/documenso/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
31+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
32+
msg_info "Stopping ${APP}"
33+
systemctl stop documenso
34+
msg_ok "${APP} Stopped"
35+
36+
msg_info "Updating ${APP} to ${RELEASE}"
37+
cp /opt/documenso/.env /opt/
38+
rm -rf /opt/documenso
39+
cd /opt
40+
curl -fsSL "https://github.com/documenso/documenso/archive/refs/tags/v${RELEASE}.zip" -o v${RELEASE}.zip
41+
unzip -q v${RELEASE}.zip
42+
mv documenso-${RELEASE} /opt/documenso
43+
cd /opt/documenso
44+
mv /opt/.env /opt/documenso/.env
45+
$STD npm install
46+
$STD npm run build:web
47+
$STD npm run prisma:migrate-deploy
48+
echo "${RELEASE}" >/opt/${APP}_version.txt
49+
msg_ok "Updated ${APP}"
50+
51+
msg_info "Starting ${APP}"
52+
systemctl start documenso
53+
msg_ok "Started ${APP}"
54+
55+
msg_info "Cleaning Up"
56+
rm -rf /opt/v${RELEASE}.zip
57+
msg_ok "Cleaned"
58+
msg_ok "Updated Successfully"
59+
else
60+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
61+
fi
62+
exit
63+
}
64+
65+
start
66+
build_container
67+
description
68+
69+
msg_ok "Completed Successfully!\n"
70+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
71+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
72+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "Documenso",
3+
"slug": "documenso",
4+
"categories": [
5+
12
6+
],
7+
"date_created": "2025-04-28",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 3000,
12+
"documentation": "https://documenso.com/",
13+
"website": "https://documenso.com/",
14+
"logo": "https://raw.githubusercontent.com/selfhst/icons/refs/heads/main/svg/documenso.svg",
15+
"config_path": "/opt/documenso/.env",
16+
"description": "Signing documents digitally should be fast and easy and should be the best practice for every document signed worldwide. This is technically quite easy today, but it also introduces a new party to every signature: The signing tool providers. While this is not a problem in itself, it should make us think about how we want these providers of trust to work. Documenso aims to be the world's most trusted document-signing tool. This trust is built by empowering you to self-host Documenso and review how it works under the hood.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/documenso.sh",
21+
"resources": {
22+
"cpu": 4,
23+
"ram": 6144,
24+
"hdd": 10,
25+
"os": "Debian",
26+
"version": "12"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": "[email protected]",
32+
"password": "helper-scripts"
33+
},
34+
"notes": []
35+
}

install/documenso-install.sh

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (Canbiz)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/documenso/documenso
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Setup Functions"
17+
setup_local_ip_helper
18+
import_local_ip
19+
msg_ok "Setup Functions"
20+
21+
msg_info "Installing Dependencies"
22+
$STD apt-get install -y \
23+
gpg \
24+
libc6 \
25+
make \
26+
cmake \
27+
jq \
28+
postgresql \
29+
python3 \
30+
python3-bcrypt
31+
msg_ok "Installed Dependencies"
32+
33+
msg_info "Setting up Node.js Repository"
34+
mkdir -p /etc/apt/keyrings
35+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
36+
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
37+
msg_ok "Set up Node.js Repository"
38+
39+
msg_info "Installing Node.js"
40+
$STD apt-get update
41+
$STD apt-get install -y nodejs
42+
$STD npm install -g [email protected]
43+
msg_ok "Installed Node.js"
44+
45+
msg_info "Setting up PostgreSQL"
46+
DB_NAME="documenso_db"
47+
DB_USER="documenso_user"
48+
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
49+
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
50+
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
51+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
52+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
53+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
54+
{
55+
echo "Documenso-Credentials"
56+
echo "Database Name: $DB_NAME"
57+
echo "Database User: $DB_USER"
58+
echo "Database Password: $DB_PASS"
59+
} >>~/documenso.creds
60+
msg_ok "Set up PostgreSQL"
61+
62+
msg_info "Installing Documenso (Patience)"
63+
cd /opt
64+
RELEASE=$(curl -fsSL https://api.github.com/repos/documenso/documenso/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
65+
curl -fsSL "https://github.com/documenso/documenso/archive/refs/tags/v${RELEASE}.zip" -o v${RELEASE}.zip
66+
unzip -q v${RELEASE}.zip
67+
mv documenso-${RELEASE} /opt/documenso
68+
cd /opt/documenso
69+
mv .env.example /opt/documenso/.env
70+
sed -i \
71+
-e "s|^NEXTAUTH_SECRET=.*|NEXTAUTH_SECRET='$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)'|" \
72+
-e "s|^NEXT_PRIVATE_ENCRYPTION_KEY=.*|NEXT_PRIVATE_ENCRYPTION_KEY='$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)'|" \
73+
-e "s|^NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY=.*|NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY='$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)'|" \
74+
-e "s|^DOCUMENSO_ENCRYPTION_KEY=.*|DOCUMENSO_ENCRYPTION_KEY='$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)'|" \
75+
-e "s|^DOCUMENSO_ENCRYPTION_SECONDARY_KEY=.*|DOCUMENSO_ENCRYPTION_SECONDARY_KEY='$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)'|" \
76+
-e "s|^NEXTAUTH_URL=.*|NEXTAUTH_URL=\"http://${LOCAL_IP}:3000\"|" \
77+
-e "s|^NEXT_PUBLIC_WEBAPP_URL=.*|NEXT_PUBLIC_WEBAPP_URL='http://${LOCAL_IP}:9000'|" \
78+
-e "s|^NEXT_PUBLIC_MARKETING_URL=.*|NEXT_PUBLIC_MARKETING_URL=\"http://${LOCAL_IP}:3001\"|" \
79+
-e "s|^NEXT_PRIVATE_INTERNAL_WEBAPP_URL=.*|NEXT_PRIVATE_INTERNAL_WEBAPP_URL=\"http://${LOCAL_IP}:3000\"|" \
80+
-e "s|^NEXT_PRIVATE_DATABASE_URL=.*|NEXT_PRIVATE_DATABASE_URL=\"postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME\"|" \
81+
-e "s|^NEXT_PRIVATE_DIRECT_DATABASE_URL=.*|NEXT_PRIVATE_DIRECT_DATABASE_URL=\"postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME\"|" \
82+
/opt/documenso/.env
83+
export TURBO_CACHE=1
84+
export NEXT_TELEMETRY_DISABLED=1
85+
export CYPRESS_INSTALL_BINARY=0
86+
export NODE_OPTIONS="--max-old-space-size=4096"
87+
$STD npm ci
88+
$STD npm run build:web
89+
$STD npm run prisma:migrate-deploy
90+
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
91+
msg_ok "Installed Documenso"
92+
93+
msg_info "Create User"
94+
PASSWORD_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b'helper-scripts', bcrypt.gensalt(rounds=12)).decode())")
95+
sudo -u postgres psql -d documenso_db -c "INSERT INTO \"User\" (name, email, \"emailVerified\", password, \"identityProvider\", roles, \"createdAt\", \"lastSignedIn\", \"updatedAt\", \"customerId\") VALUES ('helper-scripts', '[email protected]', '2025-01-20 17:14:45.058', '$PASSWORD_HASH', 'DOCUMENSO', ARRAY['USER', 'ADMIN']::\"Role\"[], '2025-01-20 16:04:05.543', '2025-01-20 16:14:55.249', '2025-01-20 16:14:55.25', NULL) RETURNING id;"
96+
$STD npm run prisma:migrate-deploy
97+
msg_ok "User created"
98+
99+
msg_info "Creating Service"
100+
cat <<EOF >/etc/systemd/system/documenso.service
101+
[Unit]
102+
Description=Documenso Service
103+
After=network.target postgresql.service
104+
105+
[Service]
106+
WorkingDirectory=/opt/documenso/apps/web
107+
ExecStart=/usr/bin/npm start
108+
Restart=always
109+
EnvironmentFile=/opt/documenso/.env
110+
111+
[Install]
112+
WantedBy=multi-user.target
113+
EOF
114+
systemctl enable -q --now documenso
115+
msg_ok "Created Service"
116+
117+
motd_ssh
118+
customize
119+
120+
msg_info "Cleaning up"
121+
$STD apt-get -y autoremove
122+
$STD apt-get -y autoclean
123+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)