Hello,
On 2022/09/07 00:38:56 +0300, la ninpre <aaoth@aaoth.xyz> wrote:
> On 9/7/22 00:11, Stuart Henderson wrote:
>
> > I didn't realise you meant path when you wrote "wiki name", so
> > in that case I think you want this in the rc script in the port, and
> > then users won't need to touch it ..
> >
> > daemon_flags="${LOCALSTATEDIR}/mycorrhiza"
> Well, I guess it is already set up like that (but I'm not sure if it's ok
>
> to leave "." instead of "${LOCALSTATEDIR}/mycorrhiza" in the rc script).
>
> I think I can upload patch to the pkg/README file to avoid unnecessary
> clutter.
just a few more comments, otherwise it's fine for me :)
- I'd set the license to "AGPLv3"
- NO_TEST can be dropped: it's needed only when there are no tests
and `make test' otherwise fails. in this case there aren't any
test (yet?) but it doesn't error so it's fine. if in the future
upstream adds some, they will be implicitly added.
- (opinable) I'd tweak a bit the README. IMHO there's no need to
re-state how acme-client works, I'd just put the bare minimum for
httpd(8)/relayd(8) and then just a pointer to acme-client(1).
- I'd use a consistent prompt for the shell example in the README,
like it's done in many other ports.
otherwise it looks fine and seems to work. i haven't tried to run a
wiki yet but i can see the web interface :)
Attaching a diff against your tarball and an updated tarball that's OK
op@ to import if someone wants to.
diff -ru mycorrhiza.orig/Makefile mycorrhiza/Makefile
--- mycorrhiza.orig/Makefile Wed Sep 7 12:50:26 2022
+++ mycorrhiza/Makefile Wed Sep 7 13:50:16 2022
@@ -1,4 +1,4 @@
-COMMENT = wiki engine for personal wikis driven by git and plain-text
+COMMENT = plain-text driven engine for personal wikis
MODGO_MODNAME = github.com/bouncepaw/mycorrhiza
MODGO_VERSION = v1.12.1
@@ -8,18 +8,16 @@
HOMEPAGE = https://mycorrhiza.wiki
-# AGPLv3 only
+# AGPLv3
PERMIT_PACKAGE = Yes
WANTLIB += c pthread
-#SUBST_VARS += LOCALSTATEDIR
+SUBST_VARS += LOCALSTATEDIR
MODULES = lang/go
RUN_DEPENDS = devel/git
-
-NO_TEST = Yes
.include "modules.inc"
Only in mycorrhiza: build
diff -ru mycorrhiza.orig/pkg/README mycorrhiza/pkg/README
--- mycorrhiza.orig/pkg/README Wed Sep 7 12:50:26 2022
+++ mycorrhiza/pkg/README Wed Sep 7 13:39:26 2022
@@ -5,78 +5,74 @@
Initial setup
=============
-Mycorrhiza expects to be fronted by a TLS terminating proxy. By default it is
-listening on localhost:1737.
+Mycorrhiza listens by default on localhost:1737. To make it reachable
+as a web service, it needs to be put behind a TLS terminating proxy.
+Here's a sample httpd(8) and relayd(8) configuration provided for
+reference:
-httpd(8)
---------
+/etc/httpd.conf:
-# httpd.conf(5)
-server "mycorrhiza.example.com" {
- listen on * port http
- location "/.well-known/acme-challenge/*" {
- root "/acme"
- request strip 2
+ server "mycorrhiza.example.com" {
+ listen on * port http
+ location "/.well-known/acme-challenge/*" {
+ root "/acme"
+ request strip 2
+ }
+ location "*" {
+ block return 302 "https://$HTTP_HOST$REQUEST_URI"
+ }
}
- location "*" {
- block return 302 "https://$HTTP_HOST$REQUEST_URI"
- }
-}
-mycorrhiza# rcctl enable httpd
-mycorrhiza# rcctl start httpd
-acme-client(1)
---------------
+/etc/relayd.conf:
-# acme-client.conf(5)
-domain mycorrhiza.example.com {
- domain key "${SYSCONFDIR}/ssl/private/mycorrhiza.example.com.key"
- domain full chain cerificate "${SYSCONFDIR}/ssl/mycorrhiza.example.com.crt"
- sign with letsencrypt
-}
+ ext_ip="123.45.67.89"
+ ext_ip6="1234:5678:dead:beef"
+ mycorrhiza_port="1737"
+ table <mycorrhiza> { 127.0.0.1 ::1 }
-mycorrhiza# acme-client -v mycorrhiza.example.com
+ http protocol https {
+ match request header append "X-Forwarded-For" \
+ value "$REMOTE_ADDR"
+ match request header append "X-Forwarded-By" \
+ value "$SERVER_ADDR:$SERVER_PORT"
+ match request header set "Connection" value "close"
-relayd(8)
----------
+ match request header "Host" value "mycorrhiza.*" \
+ forward to <mycorrhiza>
-# relayd.conf(5)
-ext_ip="123.45.67.89"
-ext_ip6="1234:5678:dead:beef"
-mycorrhiza_port="1737"
-table <mycorrhiza> { 127.0.0.1 ::1 }
+ tcp { sack, backlog 128 }
+ tls keypair mycorrhiza.example.com
+ }
-http protocol https {
- match request header append "X-Forwarded-For" value "$REMOTE_ADDR"
- match request header append "X-Forwarded-By" \
- value "$SERVER_ADDR:$SERVER_PORT"
- match request header set "Connection" value "close"
+ relay https {
+ listen on $ext_ip port https tls
+ listen on $ext_ip6 port https tls
+ protocol https
+ forward to <mycorrhiza> port $mycorrhiza_port check tcp
+ }
- match request header "Host" value "mycorrhiza.*" forward to <mycorrhiza>
+Don't forget to set up a TLS certificate (for example using
+acme-client(1)) and start httpd(8) and relayd(8):
- tcp { sack, backlog 128 }
- tls keypair mycorrhiza.example.com
-}
-relay https {
- listen on $ext_ip port https tls
- listen on $ext_ip6 port https tls
- protocol https
- forward to <mycorrhiza> port $mycorrhiza_port check tcp
-}
+ # rcctl enable httpd relayd
+ # rcctl start httpd relayd
-mycorrhiza# rcctl enable relayd
-mycorrhiza# rcctl start relayd
Setup
=====
-See ${HOMEPAGE} for details about configuration and deployment.
-Be sure to set up proper authentication.
-Set desired wiki name, enable and start the daemon.
+See the official documentation for details about configuration and
+deployment. Be sure to set up proper authentication.
-mycorrhiza# rcctl set mycorrhiza flags '${LOCALSTATEDIR}/mycorrhiza'
-mycorrhiza# rcctl enable mycorrhiza
-mycorrhiza# rcctl start mycorrhiza
+By default the wiki will be created in ${LOCALSTATEDIR}/mycorrhiza, but
+it's possible to change it by overwriting the daemon flags with rcctl(8)
+
+ # rcctl set mycorrhiza flags '/path/to/wiki/dir'
+
+Finally, enable and start the daemon:
+
+ # rcctl enable mycorrhiza
+ # rcctl start mycorrhiza
wiki will be available at https://mycorrhiza.example.com
diff -ru mycorrhiza.orig/pkg/mycorrhiza.rc mycorrhiza/pkg/mycorrhiza.rc
--- mycorrhiza.orig/pkg/mycorrhiza.rc Wed Sep 7 12:50:26 2022
+++ mycorrhiza/pkg/mycorrhiza.rc Wed Sep 7 13:53:02 2022
@@ -1,7 +1,7 @@
#!/bin/ksh
daemon="${TRUEPREFIX}/bin/mycorrhiza"
-daemon_flags="."
+daemon_flags="${LOCALSTATEDIR}/mycorrhiza"
daemon_user="_mycorrhiza"
. /etc/rc.d/rc.subr
No comments:
Post a Comment