What you will set up
Documenso sends PDFs out for signature, much like DocuSign. You upload an agreement, place fields where each person signs, and Documenso emails every recipient a link. They sign in the browser, without an account. Once everyone has signed, Documenso adds a page with the signing history, seals the PDF with a digital signature from your own certificate, and emails the finished copy to everyone.
Documenso is made by Documenso, Inc., which sells a hosted version and an Enterprise Edition. The code is open source under the AGPL 3.0 licence; a few parts, listed in the code as Enterprise Edition, such as billing and the email-domains feature, need a paid licence in production. Nothing in this guide uses them. Out of the box, Documenso sends its version and an installation ID to its maker every hour, according to its documentation, and in the Podman tests the image asked npm's registry for a newer npm at every start. Step 5 switches both off.
Here Documenso runs as two Compose services under a user of its own called documenso, with PostgreSQL for its data and the documents themselves, behind Caddy from the rootless Docker guide.
The Docker setup follows our tested rootless Docker guide on Debian 13. The app version and the app-specific behaviour below come from the tested Podman guide on a Melonslab server; the Docker steps for this app were not re-tested end to end. In the Podman test, Documenso used about 300 MB of memory at rest and about 380 MB after a document had been signed and sealed. The first account confirmed its address by email, a PDF was sent and signed, pdfsig reported a valid signature from the self-signed certificate, documents were also signed by link without email, the signing history showed each signer's real address, and a restore and an update were checked.
Before you start
You need:
- a server set up as in the rootless Docker guide, with Caddy running;
- an A record and an AAAA record for
sign.example.compointing at your server; - an email account at your email provider for Documenso to send from, with its SMTP server name and password. Documenso cannot be set up without email: your account has to confirm its address before it can log in.
The examples use sign.example.com for Documenso, example.com as your company's email domain, sign@example.com as the sender, smtp.example.com as your provider's SMTP server, and Example AB as your company's name. Replace them throughout.
1. Create the user
As root:
useradd -m -s /bin/bash -U documenso
loginctl enable-linger documenso
mkdir -p /home/documenso/documenso/db
chown -R documenso:documenso /home/documenso/documenso
Do not add the user to the docker group. The daemon is rootless and belongs to this user.
2. Create the secrets
As root, write the generated values to 0600 files under the app directory:
umask 077
db_password=$(openssl rand -hex 24)
printf 'POSTGRES_PASSWORD=%s\n' "$db_password" > /home/documenso/documenso/db.env
{
printf 'NEXT_PRIVATE_DATABASE_URL=postgresql://documenso:%s@db:5432/documenso\n' "$db_password"
printf 'NEXTAUTH_SECRET=%s\n' "$(openssl rand -hex 32)"
printf 'NEXT_PRIVATE_ENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)"
printf 'NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY=%s\n' "$(openssl rand -hex 32)"
} > /home/documenso/documenso/secrets.env
chown documenso:documenso /home/documenso/documenso/db.env /home/documenso/documenso/secrets.env
chmod 600 /home/documenso/documenso/db.env /home/documenso/documenso/secrets.env
The database password appears once for PostgreSQL and once in the address Documenso connects with. NEXTAUTH_SECRET signs logins; the two encryption keys encrypt secrets Documenso keeps in the database, such as two-factor codes. Compose passes the files in as environment variables through env_file, so no secret appears in compose.yaml. Step 10 saves copies of the keys.
3. Make the signing certificate
When the last person has signed, Documenso signs the PDF itself with a certificate, so that anyone can check that it has not been changed since. Make your own, valid for ten years, with your company's name in it:
umask 077
mkdir -p /home/documenso/cert
cd /home/documenso/cert
openssl rand -hex 24 | tr -d '\n' > passphrase
openssl req -x509 -newkey rsa:3072 -noenc -keyout key.pem -out cert.pem -days 3650 -subj "/C=SE/O=Example AB/CN=Example AB document signing"
openssl pkcs12 -export -inkey key.pem -in cert.pem -name "Example AB" -passout file:passphrase -out cert.p12
{
printf 'NEXT_PRIVATE_SIGNING_LOCAL_FILE_CONTENTS=%s\n' "$(base64 -w0 cert.p12)"
printf 'NEXT_PRIVATE_SIGNING_PASSPHRASE=%s\n' "$(cat passphrase)"
} >> /home/documenso/documenso/secrets.env
cd /
rm -r /home/documenso/cert
The certificate and its private key go into a .p12 file protected by a random passphrase, which Documenso requires. The base64 contents and the passphrase are stored in the 0600 secret file and passed to Documenso as environment variables, so no certificate file is mounted into the container; the temporary files are deleted. Ten years, instead of the one year in Documenso's documentation, means you will not have to replace it soon: a document signed after the certificate has expired gets a warning in PDF readers.
The certificate is self-signed, so a PDF reader can show that the document is unchanged and who sealed it, but not that a trusted authority vouches for your name, and Adobe Acrobat shows no green tick. For a green tick in Acrobat, buy a document signing certificate from a provider on Adobe's trust list and put its base64 contents and passphrase in the secret file instead.
4. Store the email password
Documenso emails each signing request, the finished documents, invitations and password resets. As root, add the password of the account it sends from to the secret file:
umask 077
printf 'NEXT_PRIVATE_SMTP_PASSWORD=%s\n' 'the-smtp-password' >> /home/documenso/documenso/secrets.env
Step 5 points Documenso at your provider's SMTP server on port 587, which uses STARTTLS. Step 9 lists what depends on email.
5. Define the Compose services
Create /home/documenso/documenso/compose.yaml:
cat > /home/documenso/documenso/compose.yaml <<'YAML'
services:
db:
image: docker.io/library/postgres:17-alpine
env_file: db.env
environment:
POSTGRES_USER: documenso
POSTGRES_DB: documenso
volumes:
- ./db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U documenso -d documenso"]
interval: 10s
restart: always
app:
image: docker.io/documenso/documenso:v2.20.0
ports:
# Only Caddy, on this server, can reach Documenso: the port is not open to the internet.
- "127.0.0.1:8127:3000"
env_file: secrets.env
environment:
NEXT_PUBLIC_WEBAPP_URL: "https://sign.example.com"
NEXT_PRIVATE_INTERNAL_WEBAPP_URL: "http://app:3000"
NEXT_PRIVATE_ALLOWED_SIGNUP_DOMAINS: example.com
DOCUMENSO_DISABLE_TELEMETRY: "true"
CHECKPOINT_DISABLE: "1"
NPM_CONFIG_UPDATE_NOTIFIER: "false"
NEXT_PRIVATE_SMTP_HOST: smtp.example.com
NEXT_PRIVATE_SMTP_PORT: "587"
NEXT_PRIVATE_SMTP_USERNAME: sign@example.com
NEXT_PRIVATE_SMTP_FROM_ADDRESS: sign@example.com
NEXT_PRIVATE_SMTP_FROM_NAME: "Example AB"
depends_on:
db:
condition: service_healthy
restart: always
YAML
What the settings do:
NEXT_PUBLIC_WEBAPP_URLis the address Documenso puts in every link and email. It must be the publichttps://address.NEXT_PRIVATE_INTERNAL_WEBAPP_URLis where Documenso sends its own background jobs, such as sealing a finished document. The public address would reach no Caddy from inside the Compose network, so the jobs go straight to the app's service name,app.NEXT_PRIVATE_ALLOWED_SIGNUP_DOMAINSlets only addresses at your own domain sign up, and only after confirming the address by email. Step 7 closes sign-ups completely once your account exists.DOCUMENSO_DISABLE_TELEMETRYstops the hourly report to Documenso, Inc. of its version and an installation ID.CHECKPOINT_DISABLEstops a report from Prisma, the database tool it uses, andNPM_CONFIG_UPDATE_NOTIFIER=falsestops npm's update check at each start.- The signing certificate is given to Documenso as the contents of an environment variable, so no file has to be mounted into the container.
- Documents are stored in PostgreSQL, Documenso's default, so the database backup in step 10 includes every PDF.
- Port 587 starts unencrypted and switches to TLS with STARTTLS; for port 465, which uses TLS from the start, add
NEXT_PRIVATE_SMTP_SECURE: "true"and change the port. - The image is pinned to the version we tested, as Documenso recommends; step 11 updates it. PostgreSQL stays on version 17 and gets minor updates from the weekly timer.
Start it:
uid=$(id -u documenso)
runuser -u documenso -- env HOME=/home/documenso XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/documenso/documenso && docker compose pull && docker compose up -d"
The first start downloads about 1.8 GB of images and sets up the database, which takes a few minutes. It is ready when this shows "status":"ok", with ok for both the database and the certificate:
uid=$(id -u documenso)
runuser -u documenso -- env HOME=/home/documenso XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "curl -s http://127.0.0.1:8127/api/health"
Add the weekly docker-update.service and docker-update.timer from the rootless Docker guide, with WorkingDirectory=/home/documenso/documenso, and enable the timer as documenso. It pulls new images and recreates the services; Documenso's own version is pinned and changed manually.
6. Put Caddy in front
As root, add this block at the end of /home/caddy/Caddyfile:
sign.example.com {
reverse_proxy 127.0.0.1:8127
}
chown caddy:caddy /home/caddy/Caddyfile
uid=$(id -u caddy)
runuser -u caddy -- env HOME=/home/caddy XDG_RUNTIME_DIR=/run/user/$uid \
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus PATH=/usr/bin:/bin \
bash -lc "export DOCKER_HOST=unix:///run/user/$uid/docker.sock; cd /home/caddy/caddy && docker compose restart caddy"
Caddy sets the X-Forwarded-For header to the visitor's real address and replaces any value the visitor sent. Documenso takes the address from there for the signing history, so it records each signer's real address.
7. Create your account and close sign-ups
Open https://sign.example.com/signup, and sign up with your name, your address at example.com, a long password and a signature, then Create account. Documenso emails you a link to confirm your address; open it. An address at another domain gets "Signup is currently disabled or not available for your email domain."
Documenso has no setup screen for the first administrator. Make your account one in the database, with your address:
uid=$(id -u documenso)
runuser -u documenso -- env HOME=/home/documenso XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/documenso/documenso && docker compose exec -T db psql -U documenso -c \"UPDATE \\\"User\\\" SET roles = '{ADMIN,USER}' WHERE email = 'you@example.com';\""
It prints UPDATE 1. Log in at https://sign.example.com, and Admin Panel appears in the menu under your name.
Then close sign-ups. Replace NEXT_PRIVATE_ALLOWED_SIGNUP_DOMAINS in the app service's environment: in /home/documenso/documenso/compose.yaml with:
NEXT_PUBLIC_DISABLE_SIGNUP: "true"
uid=$(id -u documenso)
runuser -u documenso -- env HOME=/home/documenso XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/documenso/documenso && docker compose up -d"
Now https://sign.example.com/signup goes to the login page, and new sign-ups are refused. You add people yourself:
- Admin Panel > Users > Create User, with their email address and name. Documenso emails them a link to set a password.
- Invite them to your organisation, so that they can send documents from it. At
https://sign.example.com/settings, choose Members under Organization Settings, then Invite member. They accept from the email, or from View invites when they log in. Until then, they can only sign documents sent to them.
Your account starts with an organisation called "Personal Organisation" and a team called "Personal Team", which you can rename under General in their settings. People who only sign documents need no account.
8. Send a document for signature
- On Documents, choose Upload Document and pick a PDF.
- Under Recipients, enter each person's Email and Name, and Add Signer for more. The menu next to each sets their role, such as Needs to sign, Needs to approve or Receives copy.
- Add Fields: choose Signature, and click where the recipient should sign. Name, Date, Text and the other fields work the same way.
- Send Document, and Send.
Each recipient gets an email with a link, opens the document, fills in their fields, and chooses Complete and Sign. When everyone has signed, Documenso seals the PDF and emails it, as an attachment, to you and every recipient. The last page is the signing certificate, with each signer's email address, the times the document was sent, viewed and signed, in UTC, and the signer's IP address and browser.
To check the seal, open the PDF in a reader that shows signatures. On Linux, pdfsig agreement.pdf from poppler-utils prints the name from your certificate and "Signature is Valid". Any change to the PDF afterwards makes the signature invalid.
Documenso is translated into German, Spanish, French, Italian, Dutch, Polish, Portuguese, Albanian, Japanese, Korean and Chinese, besides English.
9. Email
Documenso needs email for:
- confirming the address of a new account, which cannot log in before that;
- the link to set a password for an account created in the admin panel, and Forgot your password?;
- invitations to an organisation;
- signing requests, and the finished document sent to everyone.
We tested sending through STARTTLS on port 587 with a password, to a test mail server on the server itself, not through a real provider.
Without email, you can still have documents signed: in Send Document, choose None instead of Email, and Generate Links. Copy Signing Links on the document then gives you each recipient's link to send them yourself, and nobody gets an email.
10. Back up
As root, with Documenso running:
umask 077
mkdir -p /home/documenso/backup
chown documenso:documenso /home/documenso/backup
uid=$(id -u documenso)
runuser -u documenso -- env HOME=/home/documenso XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/documenso/documenso && docker compose exec -T db pg_dump -U documenso documenso > /home/documenso/backup/documenso.sql"
tar -czf /home/documenso/backup/documenso-secrets.tar.gz -C /home/documenso/documenso secrets.env
The database holds the accounts, the documents, both the uploaded and the signed PDFs, and the signing history. The secret archive holds the keys from step 2, the signing certificate with its passphrase and the SMTP password. Copy /home/documenso/backup to another machine, for example with restic, and store it safely: with the certificate, anyone can seal PDFs in your company's name.
To restore, as root:
uid=$(id -u documenso)
runuser -u documenso -- env HOME=/home/documenso XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/documenso/documenso && docker compose stop app && docker compose exec -T db dropdb -U documenso --force documenso && docker compose exec -T db createdb -U documenso documenso"
runuser -u documenso -- env HOME=/home/documenso XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/documenso/documenso && docker compose exec -T db psql -q -U documenso documenso < /home/documenso/backup/documenso.sql"
runuser -u documenso -- env HOME=/home/documenso XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/documenso/documenso && docker compose up -d app"
On a new server, restore secrets.env from the backup instead of generating new keys and a new certificate in steps 2, 3 and 4, before you start the Compose services. The database password in db.env can be new if you also change it in the restored NEXT_PRIVATE_DATABASE_URL. In the Podman test, a restored certificate sealed a pending document.
11. Update
Documenso recommends a fixed version in production, so it is not part of the weekly image updates. Read the release notes on GitHub, at github.com/documenso/documenso/releases, back up as in step 10, and change the image tag in the app service of compose.yaml to the new version, such as v2.21.0. Then, as documenso:
uid=$(id -u documenso)
runuser -u documenso -- env HOME=/home/documenso XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/documenso/documenso && docker compose pull && docker compose up -d"
Documenso updates its database when it starts. In the Podman test we updated from 2.19.0 to 2.20.0 this way, and had to log in again afterwards.
Troubleshooting
The health check shows the certificate as not ok, or signing fails with "Failed to get private key bags" or "mac verify failure". The certificate or its passphrase in secrets.env is wrong. Make both again as in step 3, and recreate the app service. The log line "Certificate not found or not readable" at start is about a certificate file, which this setup does not use; the health check is what counts.
Signing requests are not emailed, and signed documents stay in "Processing document". NEXT_PRIVATE_INTERNAL_WEBAPP_URL is missing or wrong, so Documenso sends its background jobs to the public address, which from inside the Compose network reaches nothing. Add it as in step 5, and recreate the app service. Documents signed in the meantime show up under Admin Panel > Unsealed Documents, where Reseal finishes them.
No email arrives. docker compose logs app as documenso shows a line such as [JOBS]: Job send.document.completed.emails failed Error: connect ECONNREFUSED, with the reason. Check the server name, port and user name in compose.yaml, and the password in secrets.env.
"Unable to sign in. This account has not been verified." The account has not confirmed its address. Send confirmation email on that page sends the link again.