Stuck @ CHOWN for /var/www/discourse

Hi, bit of a bump, but I have had the same problem since I first tried Discourse.

From my understanding, chown will set the ownership of all files, irregardless of the current owner. Of course after the first setup the files should already be owned by the discourse user, so there is no need to change them all, just the new ones.

On my install I’ve changed the web.template.yml to use find to change only files that aren’t already owned by discourse. That part of a rebuild used to take 8+ minutes (VM on ZFS with no SSD) and now its almost instant.

There are a couple of instances of chown in the template, but I think the “main” one is this one:

https://github.com/discourse/discourse_docker/blob/master/templates/web.template.yml#L165

Which I’ve replaced with:

find $home ! -user discourse -exec chown discourse {} \+

Which finds all files not owned by discourse and executes chown on them.

3 Likes