Bug 278426 - deskutils/py-paperless-ngx: RC scripts don't respect /etc/rc.conf configuration
Summary: deskutils/py-paperless-ngx: RC scripts don't respect /etc/rc.conf configuration
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Michael Gmelin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-18 07:57 UTC by freebsd.bugzilla
Modified: 2024-04-27 10:10 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (grembo)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description freebsd.bugzilla 2024-04-18 07:57:23 UTC
TL;DR: The RC scripts (paperless-[beat|consumer|flower|migrate|webui|worker]) all have the 'load_rc_config' call after the rc.conf variables are accessed. As a result, they always use the default values.

Long version:
I wanted to use gunicorn directly to access the service on my local network, instead of using nginx.

So I made the static dir change that the man page suggests for that and started the 'paperless-webui' service. It wasn't accessible from other machines.

Inspecting '/var/log/daemon.log' showed that the webui was:
> Listening at: http://127.0.0.1:8000

I checked the 'paperless-webui' RC script and found it used a 'paperless_webui_listen_address' variable with a default value of '127.0.0.1', so I set that to 'paperless_webui_listen_address="0.0.0.0"' on my /etc/rc.conf file and restarted the webui service.

It still didn't work, and I could see that it was still listening on '127.0.0.1'.

By checking the RC scripting docs, I saw:
https://docs.freebsd.org/en/articles/rc-scripting/#rcng-confdummy
> ➋ Now load_rc_config is invoked earlier in the script, before any rc.conf(5) variables are accessed.

I checked the RC script and verified that this was not the case, for any of them. Moving 'load_rc_config' to before the variables are accessed fixed it for me, now my setting to listen on '0.0.0.0' is being respected.
Comment 1 Michael Gmelin freebsd_committer freebsd_triage 2024-04-18 18:04:36 UTC
Thanks for reporting, will be fixed in the next port revision.
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-04-24 22:00:15 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d716cbc8e98a9410782bbad8139f7b6457920e5b

commit d716cbc8e98a9410782bbad8139f7b6457920e5b
Author:     Michael Gmelin <grembo@FreeBSD.org>
AuthorDate: 2024-04-24 12:39:17 +0000
Commit:     Michael Gmelin <grembo@FreeBSD.org>
CommitDate: 2024-04-24 21:56:50 +0000

    deskutils/py-paperless-ngx: Fixes and improvements

    - Fix NLTK configuration in paperless.conf.sample
    - Mention snowball_data in NLTK instructions
    - Fix sad defect that prevented rc scripts from picking
      up configuration data from rc.conf
    - Improve startup script documentation
    - Document required ACL when using a remote redis instance
    - Document how to enable JBIG2 and its potential pitfalls

    PR:             278424, 278425, 278426
    Reported by:    anonymous bugzilla user, netchild
    MFH:            2024Q2

 deskutils/py-paperless-ngx/Makefile                |  1 +
 deskutils/py-paperless-ngx/files/paperless-beat.in | 12 ++++++-----
 .../py-paperless-ngx/files/paperless-consumer.in   |  8 +++++---
 .../py-paperless-ngx/files/paperless-flower.in     | 12 ++++++-----
 .../py-paperless-ngx/files/paperless-migrate.in    | 12 ++++++-----
 .../py-paperless-ngx/files/paperless-ngx.7.in      | 24 +++++++++++++++++++---
 .../py-paperless-ngx/files/paperless-webui.in      | 20 +++++++++++-------
 .../py-paperless-ngx/files/paperless-worker.in     | 12 ++++++-----
 .../files/patch-paperless.conf.example             | 10 ++++-----
 deskutils/py-paperless-ngx/files/pkg-message.in    | 21 +++++++++++++++++++
 10 files changed, 93 insertions(+), 39 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-04-24 23:11:31 UTC
A commit in branch 2024Q2 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=27a97f780c56cf51b482aa828ad0e20e24f23fcc

commit 27a97f780c56cf51b482aa828ad0e20e24f23fcc
Author:     Michael Gmelin <grembo@FreeBSD.org>
AuthorDate: 2024-04-24 12:39:17 +0000
Commit:     Michael Gmelin <grembo@FreeBSD.org>
CommitDate: 2024-04-24 23:09:18 +0000

    deskutils/py-paperless-ngx: Fixes and improvements

    - Fix NLTK configuration in paperless.conf.sample
    - Mention snowball_data in NLTK instructions
    - Fix sad defect that prevented rc scripts from picking
      up configuration data from rc.conf
    - Improve startup script documentation
    - Document required ACL when using a remote redis instance
    - Document how to enable JBIG2 and its potential pitfalls

    PR:             278424, 278425, 278426
    Reported by:    anonymous bugzilla user, netchild
    MFH:            2024Q2

    (cherry picked from commit d716cbc8e98a9410782bbad8139f7b6457920e5b)

 deskutils/py-paperless-ngx/Makefile                |  1 +
 deskutils/py-paperless-ngx/files/paperless-beat.in | 12 ++++++-----
 .../py-paperless-ngx/files/paperless-consumer.in   |  8 +++++---
 .../py-paperless-ngx/files/paperless-flower.in     | 12 ++++++-----
 .../py-paperless-ngx/files/paperless-migrate.in    | 12 ++++++-----
 .../py-paperless-ngx/files/paperless-ngx.7.in      | 24 +++++++++++++++++++---
 .../py-paperless-ngx/files/paperless-webui.in      | 20 +++++++++++-------
 .../py-paperless-ngx/files/paperless-worker.in     | 12 ++++++-----
 .../files/patch-paperless.conf.example             | 10 ++++-----
 deskutils/py-paperless-ngx/files/pkg-message.in    | 21 +++++++++++++++++++
 10 files changed, 93 insertions(+), 39 deletions(-)