fix: production containers get a writable /tmp again
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 4m27s
Build and deploy / Secret scan and release gate (push) Successful in 10s
Build and deploy / Publish images (push) Successful in 1m27s

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 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-16 16:30:21 -03:00
parent 4f49ace867
commit 8df35049f7

View File

@@ -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: