[Note: My case isn’t really an installation issue but the error produced is the same as in this topic and my fix (below) may be helpful to others. Moderators (@pfaffman?), feel free to categorize this more appropriately.]
The ArgumentError
message appears after I run a ./launcher rebuild app
on my self-hosted, docker instance (installed and working for many years). It happens because unicorn is unable to write a pid file to the /var/www/discourse/tmp/pids
directory (inside the container). The log shows a loop of ArgumentError
messages as it attempts to write that file every few seconds.
I log into the container from the host machine via
docker exec -it app bash
From inside the container I run
find /var/www/discourse -printf '%u:%g\n' | sort -t: -u
This shows me a list of the owner:groups in that directory
root:root
discourse:discourse
I then make the /var/www/discourse/tmp/pids
directory world readable via
chmod +r /var/www/discourse/tmp/pids
At this point a unicorn.pid
file gets written to that directory. The file has an owner:group of discourse:www-data
.
My fix was to recursively change the ownership of /var/www/discourse
to discourse:www-data
.
chown -R discourse:www-data /var/www/discourse
This takes a long time since there are over 100,000 files. It’s probably not necessary to do the entire directory but that’s what I did.
Lastly, I made the /etc/postgres/13/main/pb_hba.conf
file world-readable
chmod +r /etc/postgres/13/main/pg_hba.conf
Restart the container and everything works.
It seems like the file ownership setup isn’t quite right but I am not well-versed enough with the art of setting permissions to figure out a simpler fix. The fact that the unicorn.pid file has a group of www-data
seems key.
It does appear that I would need to run through this procedure each time I do a rebuild
(i.e. anytime I change the app.yml
file). Note also that it does not appear to be an issue with a particular plugin.
Hopefully, that’s enough information for one of the devs to take a look and say, “Of course! I just have to change x to fix it.”