/tmp/mayan_locks.tmp is always owned by root
When doing an advanced installation (tested with 2.6.4 and 2.7) on Ubuntu 16.04, and following the guidelines from https://mayan.readthedocs.io/en/2.7/topics/deploying.html, the application fails to startup properly.
The {beat,worker}-stderr.log complain about not having permissions to /tmp/mayan_locks.tmp
. Upon inspection, this file is owned by root:root with mode 0644, but the worker and beat run as www-data. This keeps worker and beat from writing to that file.
Changing the config file so uwsgi runs as www-data instead of root still has the lockfile owned by root. Changing the user to www-data also keeps the app from starting properly, even after /tmp/mayan_locks.tmp is owned by www-data.
One workaround is to create /tmp/mayan_locks.tmp and chown it to www-data:www-data before starting Mayan.
worker-stderr.log:
Traceback (most recent call last):
File "/usr/share/mayan-edms/bin/mayan-edms.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/share/mayan-edms/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/share/mayan-edms/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/usr/share/mayan-edms/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/share/mayan-edms/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/share/mayan-edms/local/lib/python2.7/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/share/mayan-edms/local/lib/python2.7/site-packages/mayan/apps/checkouts/apps.py", line 29, in <module>
from .tasks import task_check_expired_check_outs # NOQA
File "/usr/share/mayan-edms/local/lib/python2.7/site-packages/mayan/apps/checkouts/tasks.py", line 8, in <module>
from lock_manager.runtime import locking_backend
File "/usr/share/mayan-edms/local/lib/python2.7/site-packages/mayan/apps/lock_manager/runtime.py", line 5, in <module>
locking_backend = import_string(setting_backend.value)
File "/usr/share/mayan-edms/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/share/mayan-edms/local/lib/python2.7/site-packages/mayan/apps/lock_manager/backends/file_lock.py", line 26, in <module>
open(lock_file, 'a').close()
IOError: [Errno 13] Permission denied: u'/tmp/mayan_locks.tmp'