unoserver docker (#6328)

# Description of Changes

<!--
Please provide a summary of the changes, including:

- What was changed
- Why the change was made
- Any challenges encountered

Closes #(issue_number)
-->

---

## Checklist

### General

- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [ ] I have performed a self-review of my own code
- [ ] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### Translations (if applicable)

- [ ] I ran
[`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have run `task check` to verify linters, typechecks, and tests
pass
- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing)
for more details.
This commit is contained in:
Anthony Stirling
2026-05-12 13:22:15 +01:00
committed by GitHub
parent f60a075443
commit d62f2ad3ed
13 changed files with 614 additions and 30 deletions
+29 -3
View File
@@ -255,23 +255,49 @@ get_unoserver_count() {
read_setting_value "libreOfficeSessionLimit"
}
# Mirror libreOfficetimeoutMinutes so Java and unoserver agree.
get_unoserver_conversion_timeout_seconds() {
local minutes=""
if [ -n "${PROCESS_EXECUTOR_TIMEOUT_MINUTES_LIBRE_OFFICETIMEOUT_MINUTES:-}" ]; then
minutes="$PROCESS_EXECUTOR_TIMEOUT_MINUTES_LIBRE_OFFICETIMEOUT_MINUTES"
elif [ -n "${UNO_SERVER_CONVERSION_TIMEOUT_MINUTES:-}" ]; then
minutes="$UNO_SERVER_CONVERSION_TIMEOUT_MINUTES"
else
minutes="$(read_setting_value "libreOfficetimeoutMinutes")"
fi
case "$minutes" in
''|*[!0-9]*) minutes=30 ;;
esac
if [ "$minutes" -le 0 ]; then
minutes=30
fi
echo $((minutes * 60))
}
start_unoserver_instance() {
local port=$1
local uno_port=$2
# Suppress repetitive POST /RPC2 access logs from health checks
local conversion_timeout
conversion_timeout="$(get_unoserver_conversion_timeout_seconds)"
# Per-instance profile dir avoids LibreOffice lock-file contention.
local profile_dir="${LIBREOFFICE_PROFILE}/instance_${port}"
run_as_runtime_user mkdir -p "$profile_dir"
# --user-installation is a plain path; unoserver 3.6 crashes if pre-wrapped as file://.
run_as_runtime_user "$UNOSERVER_BIN" \
--interface 127.0.0.1 \
--port "$port" \
--uno-port "$uno_port" \
--user-installation "$profile_dir" \
--conversion-timeout "$conversion_timeout" \
2> >(grep --line-buffered -v "POST /RPC2" >&2) \
&
LAST_UNOSERVER_PID=$!
}
start_unoserver_watchdog() {
local interval=${UNO_SERVER_HEALTH_INTERVAL:-120}
local interval=${UNO_SERVER_HEALTH_INTERVAL:-30}
case "$interval" in
''|*[!0-9]*) interval=120 ;;
''|*[!0-9]*) interval=30 ;;
esac
(
while true; do