1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

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
This commit is contained in:
Matthias Fechner 2024-10-13 08:58:22 +03:00
parent d482759b60
commit d2f0651277
11 changed files with 212 additions and 2 deletions

2
GIDs
View File

@ -305,7 +305,7 @@ httptunnel:*:361:
readarr:*:362:
victoria-logs:*:363:
elog:*:364:
# free: 365
gotify:*:365:
# free: 366
# free: 367
# free: 368

2
UIDs
View File

@ -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

View File

@ -209,6 +209,7 @@
SUBDIR += gopher
SUBDIR += goreplay
SUBDIR += gorss
SUBDIR += gotify-server
SUBDIR += gotthard
SUBDIR += graphpath
SUBDIR += grilo

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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"

View File

@ -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.

View File

@ -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
}
]