From 8df35049f7b18a0201f3576e6ba862f0e018fdb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Fri, 16 Oct 2026 16:30:21 -0300 Subject: [PATCH] fix: production containers get a writable /tmp again The stack runs on Swarm, which ignores the short `tmpfs:` key, so the read-only api, worker and backup containers had no writable /tmp: the backup failed with "No usable temporary directory", and the worker could not render print files. The api and backup get a tmpfs in the long volume syntax a stack honours (the backup's in memory, since a restore writes the private key there), and the worker a disk volume, as print files can be hundreds of MB. Co-Authored-By: Claude Opus 5.5 --- docker-compose.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2316779..9b3a746 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -206,7 +206,10 @@ services: environment: *app-environment networks: [backend, egress] read_only: true - tmpfs: [/tmp] + # Swarm ignores the short `tmpfs:` key: a read-only container then has no + # writable /tmp at all. The long volume syntax is what a stack honours. + volumes: + - {type: tmpfs, target: /tmp, tmpfs: {size: 268435456}} healthcheck: test: [CMD-SHELL, 'python -c "import os,urllib.request; r=urllib.request.Request(\"http://localhost:8000/health\",headers={\"Host\":os.environ[\"PUBLIC_HOST\"]}); urllib.request.urlopen(r,timeout=3)"'] interval: 15s @@ -223,7 +226,8 @@ services: environment: *app-environment networks: [backend, egress] read_only: true - tmpfs: [/tmp] + # Print files are rendered here and can be hundreds of MB: on disk, not in memory. + volumes: [worker-tmp:/tmp] healthcheck: test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://localhost:8002/health',timeout=3)"] interval: 15s @@ -257,7 +261,9 @@ services: BACKUP_HOUR: ${BACKUP_HOUR:-3} networks: [backend, egress] read_only: true - tmpfs: [/tmp] + # In memory: a restore's private key is written here while it runs. + volumes: + - {type: tmpfs, target: /tmp, tmpfs: {size: 1073741824}} deploy: replicas: 1 restart_policy: {condition: on-failure, delay: 30s} @@ -323,6 +329,7 @@ configs: volumes: postgres-data: + worker-tmp: networks: backend: