Skip to content

Commit d59a673

Browse files
authored
docuseal: use DocuSeal's patched PDFium build to fix service start (#16673)
DocuSeal switched to its own PDFium fork (upstream commit "adjust pdfium", 2026-08-15) and now attaches functions that only exist in that build, e.g. FPDFPage_GetAnnotCountRaw from the added fpdf_annots_raw.h. The generic bblanchon/pdfium-binaries library the script installed does not export them, so lib/pdfium.rb raises FFI::NotFoundError while Rails eager-loads and both docuseal.service and docuseal-sidekiq.service fail to start: Unable to load application: FFI::NotFoundError: Function 'FPDFPage_GetAnnotCountRaw' not found in [libpdfium.so] Install the library from docusealco/pdfium-binaries instead, matching the upstream Dockerfile. It is only published as a musl build (DocuSeal's image is Alpine based), so the musl runtime is installed and its library directory is added to the loader search path - the shared object needs "libc.so" (musl) at dlopen time. Verified on glibc: the library loads, resolves the raw annotation functions and renders pages correctly. The update path now refreshes PDFium too, so existing containers are repaired by running "update" even when DocuSeal itself is already up to date.
1 parent ef018d9 commit d59a673

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

ct/docuseal.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ function update_script() {
3030
exit
3131
fi
3232

33+
ensure_dependencies musl
34+
[[ -f /opt/pdfium/lib/libpdfium.so ]] || rm -f "$HOME/.pdfium"
35+
fetch_and_deploy_gh_release "pdfium" "docusealco/pdfium-binaries" "prebuild" "latest" "/opt/pdfium" "pdfium-musl-$(arch_resolve "x86_64" "aarch64").zip"
36+
if ! cmp -s /opt/pdfium/lib/libpdfium.so /usr/lib/libpdfium.so; then
37+
msg_info "Updating PDFium"
38+
install -m 644 /opt/pdfium/lib/libpdfium.so /usr/lib/libpdfium.so
39+
echo "/usr/lib/$(arch_resolve "x86_64" "aarch64")-linux-musl" >/etc/ld.so.conf.d/musl.conf
40+
ldconfig
41+
systemctl restart docuseal docuseal-sidekiq
42+
msg_ok "Updated PDFium"
43+
fi
44+
3345
if check_for_gh_release "docuseal" "docusealco/docuseal"; then
3446
msg_info "Stopping Services"
3547
systemctl stop docuseal docuseal-sidekiq

install/docuseal-install.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ $STD apt install -y \
2929
libvips-dev \
3030
libheif1 \
3131
redis-server \
32-
fontconfig
32+
fontconfig \
33+
musl
3334
msg_ok "Installed Dependencies"
3435

3536
NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs
3637
PG_VERSION="17" setup_postgresql
3738
PG_DB_NAME="docuseal" PG_DB_USER="docuseal" setup_postgresql_db
3839

39-
msg_info "Downloading Fonts and PDFium"
40+
msg_info "Downloading Fonts"
4041
mkdir -p /opt/fonts /usr/share/fonts/noto
41-
ARCH=$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')
4242
curl -fsSL -o /opt/fonts/GoNotoKurrent-Regular.ttf \
4343
https://github.com/satbyy/go-noto-universal/releases/download/v7.0/GoNotoKurrent-Regular.ttf
4444
curl -fsSL -o /opt/fonts/GoNotoKurrent-Bold.ttf \
@@ -48,12 +48,15 @@ curl -fsSL -o /opt/fonts/DancingScript-Regular.otf \
4848
ln -sf /opt/fonts/GoNotoKurrent-Regular.ttf /usr/share/fonts/noto/
4949
ln -sf /opt/fonts/GoNotoKurrent-Bold.ttf /usr/share/fonts/noto/
5050
$STD fc-cache -f
51-
curl -fsSL -o /tmp/pdfium.tgz \
52-
"https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-linux-${ARCH}.tgz"
53-
mkdir -p /tmp/pdfium && tar -xzf /tmp/pdfium.tgz -C /tmp/pdfium
54-
cp /tmp/pdfium/lib/libpdfium.so /usr/lib/libpdfium.so
55-
rm -rf /tmp/pdfium /tmp/pdfium.tgz
56-
msg_ok "Downloaded Fonts and PDFium"
51+
msg_ok "Downloaded Fonts"
52+
53+
fetch_and_deploy_gh_release "pdfium" "docusealco/pdfium-binaries" "prebuild" "latest" "/opt/pdfium" "pdfium-musl-$(arch_resolve "x86_64" "aarch64").zip"
54+
55+
msg_info "Installing PDFium"
56+
install -m 644 /opt/pdfium/lib/libpdfium.so /usr/lib/libpdfium.so
57+
echo "/usr/lib/$(arch_resolve "x86_64" "aarch64")-linux-musl" >/etc/ld.so.conf.d/musl.conf
58+
ldconfig
59+
msg_ok "Installed PDFium"
5760

5861
fetch_and_deploy_gh_release "docuseal" "docusealco/docuseal" "tarball"
5962

0 commit comments

Comments
 (0)