Re: New port for www/goatcounter

2021-12-03 Thread Omar Polo
Omar Polo  writes:

> Vinh Nguyen  writes:
>
>>  Hello Omar,
>>
>> I'm sorry for the long delay, time flied, I fixed the port following
>> all comments on your message.
>
> no problem :)
>
>> The author have just updated Goatcounter to v2.1.0. Yesterday, I
>> tried to update dependencies by command
>>
>> make modgo-gen-modules > modules.inc
>>
>> but it still gets v1.4.2, do you have any idea?
>>
>> I attached the modified port in the attachment below.
>
> I managed to get 2.1.0 by using
>
> MODGO_MODNAME = zgo.at/goatcounter/v2
> MODGO_VERSION = v2.1.0
>
> most of the variables default are fine, so here's an improved tarball
> that seems to build the correct version.  I haven't tried it yet
> thought, so only build-time testing and `goatcounter version'.
>
> % goatcounter version
> version=v2.1.0; go=go1.17.3; GOOS=openbsd; GOARCH=amd64; race=false; cgo=true
>
> I dropped the -static from ldflags and used the default install target
> provided by modgo (gcbench seems potentially useful to provide.)
> @comment bin/check because it's meant for development (goes some check
> on go sources if i've understood correctly.)  Added WANTLIB and fixed
> MODGO_FLAGS.  Also, the syntax for -X to set the version changed, I've
> updated MODGO_LDFLAGS to reflect what's on the readme.
>
> It'd be nice if we could convince it to use the sqlite from ports and
> link dynamically to it instead of whatever is doing right now (either
> statically link it or bundle its own version.)  Some digging on
> github.com/mattn/go-sqlite3 may be needed.

this was easier than expected, it just needs the libsqlite3 tag.
Attaching an updated tarball with a LDEP on sqlite3 \o/ and MODGO_FLAGS
trimmed down to `-tags libsqlite3' only.

I've also tweaked goatcounter.rc: it's ugly to send its output to
/dev/null, it's more useful to log it, isn't it?  Also, to don't
hardcode /var.  Also, I'm wondering if it's a bad idea to set
-automigrate by default: that's what I'm doing in the attached tarball,
but I haven't digged deeper to see if it can bite us.

Regarding the email, I added `-stmp smtp://localhost' so it uses smtpd
to send them rather the printing to /var/log/daemon.log, but I haven't
tried to actually send emails from it.

Then, since we're using a custom path for the database I tried to add a
README with some info on how to start using it.  I've tested in on
localhost and it's working fine!

I'd like if someone with more experience on go ports would give a
feedback nevertheless.  (Also, I'd like if someone could review the
README to ensure it reads fine ^^")

(it'd be also cool if someone could test it against postgresql)

`make test' passes ;)

portcheck complains about a long line in goatcounter.rc (daemon_flags)

> Also, for the user you need a diff along the lines of the following one.
>
> Cheers,
>
> Omar Polo

Index: infrastructure/db/user.list
===
RCS file: /home/cvs/ports/infrastructure/db/user.list,v
retrieving revision 1.392
diff -u -p -r1.392 user.list
--- infrastructure/db/user.list 17 Nov 2021 20:32:34 -  1.392
+++ infrastructure/db/user.list 3 Dec 2021 09:02:28 -
@@ -380,3 +380,4 @@ id  usergroup   port
 869 _headscale _headscale  net/headscale
 870 _unit  _unit   www/unit
 871 _gelatod   _gelatodnet/gelatod
+872 _goatcounter   _goatcounterwww/goatcounter



goatcounter.tar.gz
Description: Binary data


Re: New port for www/goatcounter

2021-12-03 Thread Omar Polo
Vinh Nguyen  writes:

>  Hello Omar,
>
> I'm sorry for the long delay, time flied, I fixed the port following
> all comments on your message.

no problem :)

> The author have just updated Goatcounter to v2.1.0. Yesterday, I
> tried to update dependencies by command
>
> make modgo-gen-modules > modules.inc
>
> but it still gets v1.4.2, do you have any idea?
>
> I attached the modified port in the attachment below.

I managed to get 2.1.0 by using

MODGO_MODNAME = zgo.at/goatcounter/v2
MODGO_VERSION = v2.1.0

most of the variables default are fine, so here's an improved tarball
that seems to build the correct version.  I haven't tried it yet
thought, so only build-time testing and `goatcounter version'.

% goatcounter version
version=v2.1.0; go=go1.17.3; GOOS=openbsd; GOARCH=amd64; race=false; cgo=true

I dropped the -static from ldflags and used the default install target
provided by modgo (gcbench seems potentially useful to provide.)
@comment bin/check because it's meant for development (goes some check
on go sources if i've understood correctly.)  Added WANTLIB and fixed
MODGO_FLAGS.  Also, the syntax for -X to set the version changed, I've
updated MODGO_LDFLAGS to reflect what's on the readme.

It'd be nice if we could convince it to use the sqlite from ports and
link dynamically to it instead of whatever is doing right now (either
statically link it or bundle its own version.)  Some digging on
github.com/mattn/go-sqlite3 may be needed.

Also, for the user you need a diff along the lines of the following one.

Cheers,

Omar Polo

Index: infrastructure/db/user.list
===
RCS file: /home/cvs/ports/infrastructure/db/user.list,v
retrieving revision 1.392
diff -u -p -r1.392 user.list
--- infrastructure/db/user.list 17 Nov 2021 20:32:34 -  1.392
+++ infrastructure/db/user.list 3 Dec 2021 09:02:28 -
@@ -380,3 +380,4 @@ id  usergroup   port
 869 _headscale _headscale  net/headscale
 870 _unit  _unit   www/unit
 871 _gelatod   _gelatodnet/gelatod
+872 _goatcounter   _goatcounterwww/goatcounter



goatcounter.tar.gz
Description: Binary data


New port for www/goatcounter

2021-09-19 Thread Vinh Nguyen
GoatCounter is an open source web analytics platform that we could
self-hosted. The home page could be found here:
https://www.goatcounter.com/ and the Github repository:
https://github.com/zgoat/goatcounter


The intention of this port is:
* Have a binary package for GoatCounter in OpenBSD.
* Provide rc script to control the daemon.
* Store sqlite database of GoatCounter to /var/goatcounter
* User can configure GoatCounter via "goatcounter_flags" put into
/etc/rc.conf.local


Current status:
* Build OK.
* Package installed OK.
* Can control GoatCounter via rc script.

I'm very new in porting, please give me feedback if there is
improvement I should make for this port.

Attached the port in this email. You can extract it to
/usr/ports

Best Regards,
Vinh.


www-goatcounter_2021-09-19.tar.gz
Description: GNU Zip compressed data


Re: New port for www/goatcounter

2021-09-19 Thread Omar Polo


Vinh Nguyen  writes:

> GoatCounter is an open source web analytics platform that we could
> self-hosted. The home page could be found here:
> https://www.goatcounter.com/ and the Github repository:
> https://github.com/zgoat/goatcounter
>
>
> The intention of this port is:
> * Have a binary package for GoatCounter in OpenBSD.
> * Provide rc script to control the daemon.
> * Store sqlite database of GoatCounter to /var/goatcounter
> * User can configure GoatCounter via "goatcounter_flags" put into
> /etc/rc.conf.local
>
>
> Current status:
> * Build OK.
> * Package installed OK.
> * Can control GoatCounter via rc script.
>
> I'm very new in porting, please give me feedback if there is
> improvement I should make for this port.
>
> Attached the port in this email. You can extract it to
> /usr/ports
>
> Best Regards,
> Vinh.

Hello,

some quick comments on the makefile:

 - 1.4.2 is old, but there are problems fetching 2.0 (as you're probably
   aware, but other people here may not).  See
   https://github.com/zgoat/goatcounter/issues/517

 - please follow the order in Makefile.template.  Comments like "Owner"
   or "Download and extract information" are usually absent.  In
   particular, the comment before PERMIT_PACKAGE should be only the
   license name (EUPL in this case).

 - MODGO_MODFILES is usually in its own `modules.inc' file and included
   right before bsd.port.mk.  The workflow should be something like

make modgo-gen-modules > modules.inc

   see net/tailscale or net/headscale for example (just the first two go
   ports that comes to mind)

 - don't need to define PKGNAME, DISTNAME here is enough and the
   infrastructure already drops the `v' from the version number:

make show=PKGNAME
goatcounter-1.4.2

regarding the rc script:

 - are rc_stop, rc_restart and rc_check really needed?  They look really
   similar to the default ones in rc.subr.


In addition, I'd drop the second paragraph from DESCR.  If the user has
installed the package I guess it's not really interested of being
reminded that they can use the hosted service at goatcounter.com,
because then the package itself becomes useless.  (I understand that
this is opinable)

I'm not attaching an updated tarball because I was trying (without
success) to convince google' servers to let me download version 2.0.4
and I've added a couple of hacks ^^"


Cheers,

Omar Polo


P.S.: the port tree is already locked for the 7.0 release.