Put the example pid file somewhere the image can write
Dockerfile.remove-example-data chmods _Inline so that the image can run as
any user, which an NFS export with root_squash needs. The example config
undid that: its pid_file was relative and landed in /derekovecs, which only
root can write, so
docker run --user $(id -u):$(id -g) -v ./example-models:/example-models \
-e MOJO_CONFIG=/example-models/example-docker.conf ...
died with "Can't create process id file ... Permission denied" after the
workers had already started. The production configs have always used /tmp.
example.conf keeps its relative path: it is used from a source checkout,
where the working directory is writable.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Change-Id: I1f51234fa6e5fe2b23d2f852a158fcf6d5c27475
diff --git a/example-models/example-docker.conf b/example-models/example-docker.conf
index f26ab0a..d39eb63 100644
--- a/example-models/example-docker.conf
+++ b/example-models/example-docker.conf
@@ -3,7 +3,10 @@
listen => ['http://*:3000'],
trusted_proxies => ['10.0/8', '127.0.0.1'],
proxy => 1,
- pid_file => 'derekovecs-example.'. `hostname -s | tr -d "\n"` .'.pid',
+ # In /tmp, not in the working directory: the image is built so that it can
+ # run as any user, which is what an NFS export with root_squash needs, and
+ # /derekovecs is only writable by root.
+ pid_file => '/tmp/derekovecs-example.'. `hostname -s | tr -d "\n"` .'.pid',
workers => 4
},