use /run/ahriman for sockett

This commit is contained in:
Evgenii Alekseev 2024-06-22 14:27:44 +03:00
parent b43df8e094
commit 6cc9ca9674
3 changed files with 5 additions and 5 deletions

View File

@ -475,7 +475,7 @@ The following environment variables are supported:
* ``AHRIMAN_REPOSITORY`` - repository name, default is ``aur-clone``. * ``AHRIMAN_REPOSITORY`` - repository name, default is ``aur-clone``.
* ``AHRIMAN_REPOSITORY_SERVER`` - optional override for the repository URL. Useful if you would like to download packages from remote instead of local filesystem. * ``AHRIMAN_REPOSITORY_SERVER`` - optional override for the repository URL. Useful if you would like to download packages from remote instead of local filesystem.
* ``AHRIMAN_REPOSITORY_ROOT`` - repository root. Because of filesystem rights it is required to override default repository root. By default, it uses ``ahriman`` directory inside ahriman's home, which can be passed as mount volume. * ``AHRIMAN_REPOSITORY_ROOT`` - repository root. Because of filesystem rights it is required to override default repository root. By default, it uses ``ahriman`` directory inside ahriman's home, which can be passed as mount volume.
* ``AHRIMAN_UNIX_SOCKET`` - full path to unix socket which is used by web server, default is empty. Note that more likely you would like to put it inside ``AHRIMAN_REPOSITORY_ROOT`` directory (e.g. ``/var/lib/ahriman/ahriman/ahriman-web.sock``) or to ``/tmp``. * ``AHRIMAN_UNIX_SOCKET`` - full path to unix socket which is used by web server, default is empty. Note that more likely you would like to put it inside ``AHRIMAN_REPOSITORY_ROOT`` directory (e.g. ``/var/lib/ahriman/ahriman/ahriman-web.sock``) or to ``/run/ahriman``.
* ``AHRIMAN_USER`` - ahriman user, usually must not be overwritten, default is ``ahriman``. * ``AHRIMAN_USER`` - ahriman user, usually must not be overwritten, default is ``ahriman``.
* ``AHRIMAN_VALIDATE_CONFIGURATION`` - if set (default) validate service configuration. * ``AHRIMAN_VALIDATE_CONFIGURATION`` - if set (default) validate service configuration.
@ -1318,7 +1318,7 @@ How to enable basic authorization
.. code-block:: ini .. code-block:: ini
[web] [web]
unix_socket = /var/lib/ahriman/ahriman-web.sock unix_socket = /run/ahriman/ahriman-web.sock
This socket path must be available for web service instance and must be available for all application instances (e.g. in case if you are using docker container - see above - you need to make sure that the socket is passed to the root filesystem). This socket path must be available for web service instance and must be available for all application instances (e.g. in case if you are using docker container - see above - you need to make sure that the socket is passed to the root filesystem).

View File

@ -125,7 +125,7 @@ class Lock(LazyLogging):
return return
waiter = Waiter(self.wait_timeout) waiter = Waiter(self.wait_timeout)
waiter.wait(self.perform_lock, self._pid_file.fileno()) waiter.wait(lambda fd: not self.perform_lock(fd), self._pid_file.fileno())
def _write(self) -> None: def _write(self) -> None:
""" """
@ -139,7 +139,7 @@ class Lock(LazyLogging):
if not self.perform_lock(self._pid_file.fileno()): if not self.perform_lock(self._pid_file.fileno()):
raise DuplicateRunError raise DuplicateRunError
self._pid_file.seek(0) # reset bytes self._pid_file.seek(0) # reset position and remove file content if any
self._pid_file.truncate() self._pid_file.truncate()
self._pid_file.write(str(os.getpid())) # write current pid self._pid_file.write(str(os.getpid())) # write current pid

View File

@ -81,7 +81,7 @@ def test_watch(lock: Lock, mocker: MockerFixture) -> None:
wait_mock = mocker.patch("ahriman.models.waiter.Waiter.wait") wait_mock = mocker.patch("ahriman.models.waiter.Waiter.wait")
lock._watch() lock._watch()
wait_mock.assert_called_once_with(lock.perform_lock, 1) wait_mock.assert_called_once_with(pytest.helpers.anyvar(int), 1)
def test_watch_skip(lock: Lock, mocker: MockerFixture) -> None: def test_watch_skip(lock: Lock, mocker: MockerFixture) -> None: