From 1344e6f5402f77699fb8af31398a4c23734fd25c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Saraj=C3=A4rvi?= Date: Sat, 4 Nov 2023 13:06:21 +0200 Subject: [PATCH 1/2] AE-2042 Listen to 8443 in dummy mpollux For some reason, the earlier 443 port would get disallowed in my Windows-based dev setup. The port is anyways remapped by Docker, though so we may just as well use a less privileged port here. --- docker/docker-compose.yml | 2 +- docker/mpollux/conf.d/default.conf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 224ae8c2e..c3a849973 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -25,7 +25,7 @@ services: mpollux: image: nginx ports: - - 127.0.0.1:53952:443 + - 127.0.0.1:53952:8443 volumes: - type: bind source: ./mpollux/api diff --git a/docker/mpollux/conf.d/default.conf b/docker/mpollux/conf.d/default.conf index f60f842cb..b003b80a5 100644 --- a/docker/mpollux/conf.d/default.conf +++ b/docker/mpollux/conf.d/default.conf @@ -1,6 +1,6 @@ server { - listen 443 ssl; - listen [::]:443; + listen 8443 ssl; + listen [::]:8443; server_name localhost; ssl_certificate /keys/localhost.crt; From e4660c4c6fc7efc11e21a3dcf863aaf4f9c22c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Saraj=C3=A4rvi?= Date: Wed, 6 Dec 2023 13:36:14 +0100 Subject: [PATCH 2/2] AE-2042 Special handling to exec LibreOffice on Windows One difference on Windows is that the executable program is not made available with the usual libreoffice name. This change makes the backend just call it directly from its most common location. Naive attempts at using the UserInstallation override resulted in errors about a corrupted bootstrap.ini file. We do not absolutely need to run multiple PDF generations in parallel, so the issue is sidestepped by letting go of the mechanism needed for multiple parallel executions. --- .../main/clj/solita/common/libreoffice.clj | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/etp-backend/src/main/clj/solita/common/libreoffice.clj b/etp-backend/src/main/clj/solita/common/libreoffice.clj index cbe1a7fe5..5e2847481 100644 --- a/etp-backend/src/main/clj/solita/common/libreoffice.clj +++ b/etp-backend/src/main/clj/solita/common/libreoffice.clj @@ -43,10 +43,19 @@ "--headless" args))) -(defn run-with-args [& args] - (let [tmpdir (make-tmpdir)] - (try - (populate-tmpdir tmpdir) - (exec-libreoffice tmpdir args) - (finally (rm-path tmpdir))))) +(defn exec-libreoffice-on-windows [args] + ;; On windows, it seems to be difficult to get the UserInstallation parameter + ;; to work at all. Because this is strictcly a development situation, we + ;; ignore the usual need of having a per-process configuration. Instead, we + ;; expect the developer to not run multiple PDF generaion operations + ;; concurrently + (apply shell/sh "C:\\Program Files\\LibreOffice\\program\\soffice.bin" "--headless" args)) +(defn run-with-args [& args] + (if (-> "os.name" System/getProperty (.startsWith "Windows ")) + (exec-libreoffice-on-windows args) + (let [tmpdir (make-tmpdir)] + (try + (populate-tmpdir tmpdir) + (exec-libreoffice tmpdir args) + (finally (println (str 'rm-path tmpdir)))))))