Sorry for the double post, I got confused previously by another unrelated matter and the socket was not used anymore because of an error in my configuration.
Here’s where I’m at:
[crit] 274#274: *7 connect() to unix:/var/discourse/shared/standalone/nginx.http.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.160.1, server: <domain>, request: "GET / HTTP/2.0", upstream: "http://unix:/var/discourse/shared/standalone/nginx.http.sock:/", host: "<domain>"
I did chmod 777 shared/standalone/nginx.http.sock
to temporarily workaround this permission issue, and now I got
[error] 203#203: *1 connect() to unix:/var/discourse/shared/standalone/nginx.http.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.160.1, server: <domain>, request: "GET / HTTP/2.0", upstream: "http://unix:/var/discourse/shared/standalone/nginx.http.sock:/", host: "<domain>"
Obviously I am doing some things wrong but I don’t know what. Please note that I’m not using NPM but nginx-proxy
which is a bit different, in particular it automatically detects docker containers that define VIRTUAL_HOST
to generate a config for them. Hence I only added the location / { ... }
part related to discourse and did not touch the sites-available files with the listen
directives.
I noticed the discourse container is in a restart loop with status Restarting (100) 7 seconds ago
. This is because it complains about not being able to delete the socket. Indeed, it was not an actual socket but a directory instead, I guess because of bad manipulations of mounting volumes to expose it to the nginx-proxy container.
I removed the directory, restarted discourse and it is now a socket. However I can’t expose it as a volume to nginx-proxy
Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting “/var/discourse/shared/standalone/nginx.http.sock” to rootfs at “/var/discourse/shared/standalone/nginx.http.sock”: mount /var/discourse/shared/standalone/nginx.http.sock:/var/discourse/shared/standalone/nginx.http.sock (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Turns out, I just needed to mount the socket in /tmp/nginx.http.sock
instead of keeping the same path. Finally managed it it seems!