Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Oct 2024 06:04:17 GMT
From:      Matthias Fechner <mfechner@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: d2f0651277ea - main - net/gotify-server: create new port version 2.5.0 of gotify-server
Message-ID:  <202410130604.49D64HE6068339@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mfechner:

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

commit d2f0651277eaaf7ec0b22f1f79226f5e43cdedba
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2024-10-13 05:58:22 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2024-10-13 06:04:06 +0000

    net/gotify-server: create new port version 2.5.0 of gotify-server
    
    A simple selfhosted message service with nice UI and a client for
    Android.
    
    Thanks a lot for help I received here:
    https://github.com/gotify/server/issues/199
---
 GIDs                                             |  2 +-
 UIDs                                             |  2 +-
 net/Makefile                                     |  1 +
 net/gotify-server/Makefile                       | 71 ++++++++++++++++++++++++
 net/gotify-server/distinfo                       |  7 +++
 net/gotify-server/files/gotify_server.in         | 50 +++++++++++++++++
 net/gotify-server/files/patch-config.example.yml | 36 ++++++++++++
 net/gotify-server/files/patch-config_config.go   | 11 ++++
 net/gotify-server/files/patch-ui_tsconfig.json   | 12 ++++
 net/gotify-server/pkg-descr                      |  4 ++
 net/gotify-server/pkg-message                    | 18 ++++++
 11 files changed, 212 insertions(+), 2 deletions(-)

diff --git a/GIDs b/GIDs
index 8fb4f413b3d2..00127f18d247 100644
--- a/GIDs
+++ b/GIDs
@@ -305,7 +305,7 @@ httptunnel:*:361:
 readarr:*:362:
 victoria-logs:*:363:
 elog:*:364:
-# free: 365
+gotify:*:365:
 # free: 366
 # free: 367
 # free: 368
diff --git a/UIDs b/UIDs
index ce212d8f54c8..25eef941e6ce 100644
--- a/UIDs
+++ b/UIDs
@@ -310,7 +310,7 @@ httptunnel:*:361:361::0:0:httptunnel Daemon:/nonexistent:/usr/sbin/nologin
 readarr:*:362:362::0:0:Readarr Daemon:/nonexistent:/usr/sbin/nologin
 victoria-logs:*:363:363::0:0:VictoriaLogs Daemon:/nonexistent:/usr/sbin/nologin
 elog:*:364:364::0:0:Elog server:/nonexistent:/usr/sbin/nologin
-# free: 365
+gotify:*:365:365::0:0:Gotify User:/var/db/gotify:/usr/sbin/nologin
 # free: 366
 # free: 367
 # free: 368
diff --git a/net/Makefile b/net/Makefile
index 55189a0e36af..a7b1f39811eb 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -209,6 +209,7 @@
     SUBDIR += gopher
     SUBDIR += goreplay
     SUBDIR += gorss
+    SUBDIR += gotify-server
     SUBDIR += gotthard
     SUBDIR += graphpath
     SUBDIR += grilo
diff --git a/net/gotify-server/Makefile b/net/gotify-server/Makefile
new file mode 100644
index 000000000000..d3a31a0d4705
--- /dev/null
+++ b/net/gotify-server/Makefile
@@ -0,0 +1,71 @@
+PORTNAME=	gotify-server
+PORTVERSION=	2.5.0
+DISTVERSIONPREFIX=	v
+CATEGORIES=	net
+MASTER_SITES=	https://github.com/mfechner/freebsd-net-gotify-server/raw/refs/heads/main/:yarn_cache
+DISTNAME=	server
+DISTFILES=	${PORTNAME}-yarn-offline-cache-${DISTVERSION}${EXTRACT_SUFX}:yarn_cache
+
+MAINTAINER=	mfechner@FreeBSD.org
+COMMENT=	Simple server for sending and receiving messages
+WWW=		https://github.com/gotify/server
+
+LICENSE=	MIT
+
+BUILD_DEPENDS=	yarn${NODEJS_SUFFIX}>=1.10.0:www/yarn${NODEJS_SUFFIX} \
+		
+USES=		go:modules,1.22 nodejs:build
+GO_MODULE=	github.com/gotify/server/v2
+
+_BUILD_DATE=	$$(date -u "+%Y-%m-%d-%H%M UTC")
+#GO_TARGET=     ./
+GO_BUILDFLAGS=	-buildmode=pie -modcacherw \
+		-ldflags=" \
+		-X 'main.Version=${PORTVERSION}' \
+		-X 'main.Commit=${GL_TAGNAME:C/^(........).*/\1/}' \
+		-X 'main.BuildDate=${_BUILD_DATE}' \
+		-X 'main.Mode=prod'"
+
+USE_RC_SUBR=	gotify_server
+
+USERS=		gotify
+GROUPS=		gotify
+
+PLIST_FILES=	bin/gotify-server
+
+post-patch:
+	# setup yarnrc for offline node_modules installatio
+	@${ECHO_CMD} 'yarn-offline-mirror "${WRKDIR}/yarn-offline-cache"' >> ${WRKSRC}/ui/.yarnrc
+	
+pre-build:
+	@cd ${WRKSRC}/ui && ${SETENV} ${MAKE_ENV} HOME=${WRKDIR} PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn install --offline
+	@cd ${WRKSRC}/ui && NODE_OPTIONS=--openssl-legacy-provider yarn build
+	#${RM} -r ${STAGEDIR}${PREFIX}/share/.cache
+
+
+pre-install:
+	@${RM} ${WRKSRC}/.yarnrc
+
+do-install:
+	@${INSTALL_PROGRAM} ${WRKDIR}/bin/gotify-server ${STAGEDIR}${PREFIX}/bin/gotify-server
+	@${MV} ${WRKSRC}/config.example.yml ${WRKSRC}/config.yml.sample
+	@${MKDIR} ${STAGEDIR}${ETCDIR}
+.for x in config.yml.sample
+	@${CP} ${WRKSRC}/${x} ${STAGEDIR}${ETCDIR}/${x}
+.endfor
+	@${MKDIR} ${STAGEDIR}/var/db/gotify
+
+post-install:
+	@${ECHO} "@sample ${ETCDIR}/config.yml.sample" >> ${TMPPLIST}
+	@${ECHO_CMD} "@owner gotify" >> ${TMPPLIST}
+	@${ECHO_CMD} "@group gotify" >> ${TMPPLIST}
+	@${ECHO_CMD} "@dir /var/db/gotify" >> ${TMPPLIST}
+	#@${ECHO_CMD} "@dir /var/db/gotify/certs" >> ${TMPPLIST}
+
+make-yarn-cache: patch
+	${RM} -r ${WRKDIR}/yarn-offline-cache
+	cd ${WRKSRC}/ui && ${SETENV} ${MAKE_ENV} PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn --frozen-lockfile --ignore-scripts
+	cd ${WRKDIR} && ${TAR} -czf ${PORTNAME}-yarn-offline-cache-${DISTVERSION}${EXTRACT_SUFX} yarn-offline-cache
+	@${ECHO_CMD} upload ${PORTNAME}-yarn-offline-cache-${DISTVERSION}${EXTRACT_SUFX}
+
+.include <bsd.port.mk>
diff --git a/net/gotify-server/distinfo b/net/gotify-server/distinfo
new file mode 100644
index 000000000000..bcee0d15b4c8
--- /dev/null
+++ b/net/gotify-server/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1728659826
+SHA256 (go/net_gotify-server/server/gotify-server-yarn-offline-cache-2.5.0.tar.gz) = c175aedf9b868a717949aa8c7541646b5dd8103b1f640f6e601896351e8220dc
+SIZE (go/net_gotify-server/server/gotify-server-yarn-offline-cache-2.5.0.tar.gz) = 54176992
+SHA256 (go/net_gotify-server/server/v2.5.0.mod) = 414f96622e4dda6c03aa4047133d6226c0cde3feaf79bfa9761a1883685c9de9
+SIZE (go/net_gotify-server/server/v2.5.0.mod) = 2277
+SHA256 (go/net_gotify-server/server/v2.5.0.zip) = 9558ed31c4e48f92be2987c0fff29983e8befd2201ed288e0d8f74119bc3eb60
+SIZE (go/net_gotify-server/server/v2.5.0.zip) = 726894
diff --git a/net/gotify-server/files/gotify_server.in b/net/gotify-server/files/gotify_server.in
new file mode 100644
index 000000000000..6ee69e44dab3
--- /dev/null
+++ b/net/gotify-server/files/gotify_server.in
@@ -0,0 +1,50 @@
+#!/bin/sh
+# PROVIDE: gotify_server
+# REQUIRE: DAEMON NETWORKING
+# KEYWORD: shutdown
+
+#
+# Add these lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# gotify_server_enable (bool):        Set to NO by default.
+#                                     Set it to YES to enable mailpit.
+# gotify_server_dir (str):            Set to "/var/db/gotify" by default
+#                                     Set it to directory to run gotify in
+# gotify_server_user (str):           Set to "gotify" by default.
+#                                     Set it to user to run gotify-server under
+# gotify_server_group (str):          Set to "gotify" by default.
+#                                     Set it to group to run gotify-server under
+# gotify_server_args (string):        Custom extra arguments for gotify-server
+
+. /etc/rc.subr
+
+name="gotify_server"
+rcvar="gotify_server_enable"
+desc="Run Gotify notification server"
+
+load_rc_config ${name}
+
+: ${gotify_server_enable:="NO"}
+: ${gotify_server_dir:="/var/db/gotify"}
+: ${gotify_server_user:="gotify"}
+: ${gotify_server_group:="gotify"}
+: ${gotify_server_args:=""}
+
+export HOME=${gotify_server_dir}
+export PATH=${PATH}:%%PREFIX%%/bin
+
+pidfile="/var/run/${name}.pid"
+command="/usr/sbin/daemon"
+command_args="-f -P ${pidfile} %%PREFIX%%/bin/gotify-server ${gotify_server_args}"
+
+start_precmd="gotify_server_precmd"
+
+gotify_server_precmd()
+{
+	if [ ! -e "${pidfile}" ]; then
+		install -g ${gotify_server_group} -o ${gotify_server_user} -- /dev/null "${pidfile}";
+	fi
+}
+
+run_rc_command $1
diff --git a/net/gotify-server/files/patch-config.example.yml b/net/gotify-server/files/patch-config.example.yml
new file mode 100644
index 000000000000..ccfd46addd3d
--- /dev/null
+++ b/net/gotify-server/files/patch-config.example.yml
@@ -0,0 +1,36 @@
+--- config.example.yml.orig	1979-11-29 22:00:00 UTC
++++ config.example.yml
+@@ -4,7 +4,7 @@ server:
+ server:
+   keepaliveperiodseconds: 0 # 0 = use Go default (15s); -1 = disable keepalive; set the interval in which keepalive packets will be sent. Only change this value if you know what you are doing.
+   listenaddr: "" # the address to bind on, leave empty to bind on all addresses. Prefix with "unix:" to create a unix socket. Example: "unix:/tmp/gotify.sock".
+-  port: 80 # the port the HTTP server will listen on
++  port: 9071 # the port the HTTP server will listen on
+ 
+   ssl:
+     enabled: false # if https should be enabled
+@@ -16,7 +16,7 @@ server:
+     letsencrypt:
+       enabled: false # if the certificate should be requested from letsencrypt
+       accepttos: false # if you accept the tos from letsencrypt
+-      cache: data/certs # the directory of the cache from letsencrypt
++      cache: /var/db/gotify/certs # the directory of the cache from letsencrypt
+       hosts: # the hosts for which letsencrypt should request certificates
+ #      - mydomain.tld
+ #      - myotherdomain.tld
+@@ -46,12 +46,12 @@ database: # for database see (configure database secti
+ 
+ database: # for database see (configure database section)
+   dialect: sqlite3
+-  connection: data/gotify.db
++  connection: /var/db/gotify/gotify.db
+ 
+ defaultuser: # on database creation, gotify creates an admin user
+   name: admin # the username of the default user
+   pass: admin # the password of the default user
+ passstrength: 10 # the bcrypt password strength (higher = better but also slower)
+-uploadedimagesdir: data/images # the directory for storing uploaded images
+-pluginsdir: data/plugins # the directory where plugin resides
++uploadedimagesdir: /var/db/gotify/data/images # the directory for storing uploaded images
++pluginsdir: /var/db/gotify/data/plugins # the directory where plugin resides
+ registration: false # enable registrations
diff --git a/net/gotify-server/files/patch-config_config.go b/net/gotify-server/files/patch-config_config.go
new file mode 100644
index 000000000000..dce728c6700b
--- /dev/null
+++ b/net/gotify-server/files/patch-config_config.go
@@ -0,0 +1,11 @@
+--- config/config.go.orig	2024-10-11 14:37:05 UTC
++++ config/config.go
+@@ -60,7 +60,7 @@ func configFiles() []string {
+ 	if mode.Get() == mode.TestDev {
+ 		return []string{"config.yml"}
+ 	}
+-	return []string{"config.yml", "/etc/gotify/config.yml"}
++	return []string{"config.yml", "/usr/local/etc/gotify-server/config.yml"}
+ }
+ 
+ // Get returns the configuration extracted from env variables or config file.
diff --git a/net/gotify-server/files/patch-ui_tsconfig.json b/net/gotify-server/files/patch-ui_tsconfig.json
new file mode 100644
index 000000000000..065235c0f35f
--- /dev/null
+++ b/net/gotify-server/files/patch-ui_tsconfig.json
@@ -0,0 +1,12 @@
+--- ui/tsconfig.json.orig	2024-10-11 13:53:39 UTC
++++ ui/tsconfig.json
+@@ -38,7 +38,8 @@
+     "acceptance-tests",
+     "webpack",
+     "jest",
+-    "src/setupTests.ts"
++    "src/setupTests.ts",
++    "**/test/*.ts"
+   ],
+   "include": [
+     "src"
diff --git a/net/gotify-server/pkg-descr b/net/gotify-server/pkg-descr
new file mode 100644
index 000000000000..5a58281f3a8c
--- /dev/null
+++ b/net/gotify-server/pkg-descr
@@ -0,0 +1,4 @@
+We wanted a simple server for sending and receiving messages (in real time per
+WebSocket). For this, not many open source projects existed and most of the
+existing ones were abandoned. Also, a requirement was that it can be
+self-hosted.
diff --git a/net/gotify-server/pkg-message b/net/gotify-server/pkg-message
new file mode 100644
index 000000000000..8b9f0dfcaff4
--- /dev/null
+++ b/net/gotify-server/pkg-message
@@ -0,0 +1,18 @@
+[
+{
+  message: <<EOM
+Gotify-Server was installed successfully.
+
+It is be default listening on port 9071.
+
+You can change the settings in file:
+/usr/local/etc/gotify-server/config.yml
+
+To enable to start it execute:
+sysrc gotify_server_enable="YES"
+service gotify_server start
+EOM
+  type: install
+}
+]
+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410130604.49D64HE6068339>