Bug 278325 - www/oauth2-proxy enhancement: rc-script instancing of multiple oauth2-proxies on the same system
Summary: www/oauth2-proxy enhancement: rc-script instancing of multiple oauth2-proxies...
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: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-12 09:16 UTC by Alexander Leidinger
Modified: 2024-05-08 09:44 UTC (History)
1 user (show)

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


Attachments
new rc script (2.23 KB, application/x-shellscript)
2024-04-12 09:16 UTC, Alexander Leidinger
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Leidinger freebsd_committer freebsd_triage 2024-04-12 09:16:02 UTC
Created attachment 249926 [details]
new rc script

Hi,

the attached rc script is a modification of the existing one:
 - use instancing to be able to create new instances of the script via links (done like in the tomcat ports, or the openhab port)
 - rename (hyphen to underscore, see below)

What this allows to do:
 - ln -s oauth2_proxy /usr/local/etc/rc.d/oauth2_proxy_sitename
 - cp -p /usr/local/etc/oauth2-proxy.cfg /usr/localetc/oauth2-proxy-sitename.cfg
 - edit oauth2-proxy-sitename.cfg (not only other port)
 - sysrc oauth2_proxy_sitename_enable=YES
 - service oauth2_proxy_sitename start

Changes:
 - change the name of start script (the config name is derived from the script name by replacing underscores with hyphens)
 - the logfiles (each one different based upon the rc.d name) will have an underscore in the name of the logfile
 - daemon will write child-pid files, which are used in the rc script to use them to only kill the child which belongs to it on stop
 - pidfiles are derived from rc.d name
 - rc.conf variable names are derived from the rc.d name

This way you can either use the original config if you need only one oauth2 proxy, or you can host multiple oauth2-proxy instances to different backend sites on one system and manage them independently.

This also requires to change the Makefile of the port to adapt to the new name of the rc script (and an updating entry about it).

If you agree to this enhancement, I can writeup an UPDATING entry and commit the change.

Bye,
Alexander.
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-05-08 09:43:04 UTC
A commit in branch main references this bug:

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

commit 7f80d7465ec9d85666472f99df16ba71b1e8c9d5
Author:     Alexander Leidinger <netchild@FreeBSD.org>
AuthorDate: 2024-05-08 09:34:27 +0000
Commit:     Alexander Leidinger <netchild@FreeBSD.org>
CommitDate: 2024-05-08 09:42:19 +0000

    www/oauth2-proxy: convert rc script to be instance-aware

    Like the tomcat ports or openhab, make the rc script instance aware.
    To use it:
     - cp /usr/local/etc/oauth2-proxy.cfg.sample /usr/local/etc/oauth2-proxy-myapp.cfg
     - vi /usr/local/etc/oauth2-proxy-myapp.cfg
     - ln -s oauth2_proxy /usr/local/etc/rc.d/oauth2_proxy_myapp
     - sysctl oauth2_proxy_myapp_enable=YES
     - service oauth2_proxy_myapp start

    Approved by:    maintainer timeout (3 weeks)
    PR:             278325

 UPDATING                                           | 15 +++++++
 www/oauth2-proxy/Makefile                          |  4 +-
 .../files/{oauth2-proxy.in => oauth2_proxy.in}     | 50 ++++++++++++++--------
 3 files changed, 49 insertions(+), 20 deletions(-)