Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions images/Dockerfile.joex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ RUN apt install -y \
ghostscript \
unpaper \
weasyprint \
unoconv \
libreoffice \
python3-uno \
python3-pip \
python3-distutils-extra \
fonts-droid-fallback \
fonts-dejavu \
Expand All @@ -25,7 +27,8 @@ RUN apt install -y \
pngquant \
ocrmypdf \
qpdf \
docker-ce-cli
docker-ce-cli \
&& pip3 install --break-system-packages --no-cache-dir unoserver

FROM base AS download

Expand Down
24 changes: 21 additions & 3 deletions images/joex-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
#!/bin/sh

echo "Starting unoconv listener"
unoconv -l &
set -e

/opt/docspell-joex/bin/docspell-joex "$@"
echo "Starting unoserver"
# Queues office converts so concurrent joex workers do not deadlock LibreOffice.
# See https://github.com/eikek/docspell/issues/3345
unoserver --conversion-timeout 120 &

echo "Waiting for unoserver to become ready"
i=0
while [ "$i" -lt 60 ]; do
if unoping >/dev/null 2>&1; then
echo "unoserver is ready"
break
fi
i=$((i + 1))
sleep 1
done

if ! unoping >/dev/null 2>&1; then
echo "WARNING: unoserver did not become ready within 60s; office conversion may fail" >&2
fi
Comment on lines +5 to +23

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this whole mess wouldn't better live in joex itself instead of in a random entrypoint script.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I also didn't like the previous unoconv -l & line in here)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree. Sorry my cursor instance was a bit too quick in filing this PR, but I totally agree here. I will investigate.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think that a sidecar container in kubernetes would work quite well for this, but not sure how to handle non-kubernetes deployments then.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In docker compose it's also easy. I guess for local deployment peeps just have a single docker unoserver instance running that they can call or install it bare metal I guess and run it in the background.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good to seperate it


/opt/docspell-joex/bin/docspell-joex "$@"