Skip to content

Instantly share code, notes, and snippets.

@tuaris
Created March 26, 2025 23:11
Show Gist options
  • Save tuaris/ac5b0bcc2e04ae331b44304b602bbe63 to your computer and use it in GitHub Desktop.
Save tuaris/ac5b0bcc2e04ae331b44304b602bbe63 to your computer and use it in GitHub Desktop.
net/smoothmq port for FreeBSD
diff --git a/net/smoothmq/Makefile b/net/smoothmq/Makefile
new file mode 100644
index 000000000000..ff378084a88b
--- /dev/null
+++ b/net/smoothmq/Makefile
@@ -0,0 +1,38 @@
+PORTNAME= smoothmq
+DISTVERSIONPREFIX= v
+DISTVERSION= 0.2.3
+CATEGORIES= net
+
+MAINTAINER= [email protected]
+COMMENT= An improved drop-in replacement for SQS
+WWW= https://github.com/poundifdef/smoothmq
+
+LICENSE= AGPLv3
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+USES= go:1.22,modules
+GH_ACCOUNT= poundifdef
+GH_PROJECT= smoothmq
+
+USE_RC_SUBR= smoothmq
+
+GO_MODULE= github.com/poundifdef/smoothmq
+
+SMOOTHMQ_USER?= nobody
+SMOOTHMQ_GROUP?= nobody
+SMOOTHMQ_DATADIR?= /var/db/${PORTNAME}
+
+SUB_LIST= SMOOTHMQ_USER=${SMOOTHMQ_USER} \
+ SMOOTHMQ_GROUP=${SMOOTHMQ_GROUP} \
+ SMOOTHMQ_DATADIR=${SMOOTHMQ_DATADIR} \
+
+USERS= ${SMOOTHMQ_USER}
+GROUPS= ${SMOOTHMQ_GROUP}
+
+PLIST_SUB= ${SUB_LIST}
+
+post-install:
+ @${CP} ${WRKSRC}/config.yaml ${STAGEDIR}${PREFIX}/etc/smoothmq.yaml.sample
+ @${MKDIR} ${STAGEDIR}${SMOOTHMQ_DATADIR}
+
+.include <bsd.port.mk>
diff --git a/net/smoothmq/distinfo b/net/smoothmq/distinfo
new file mode 100644
index 000000000000..87899718a10a
--- /dev/null
+++ b/net/smoothmq/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1743024634
+SHA256 (go/net_smoothmq/smoothmq-v0.2.3/v0.2.3.mod) = 3e5666f6d4ce001d0111c688c5dfdf716442b50724ce9e6b2309a1ad9bcd234c
+SIZE (go/net_smoothmq/smoothmq-v0.2.3/v0.2.3.mod) = 2627
+SHA256 (go/net_smoothmq/smoothmq-v0.2.3/v0.2.3.zip) = 04aef1e591f477678cae885f93a4d132883b432109810f866d65539809cc3362
+SIZE (go/net_smoothmq/smoothmq-v0.2.3/v0.2.3.zip) = 5189778
diff --git a/net/smoothmq/files/patch-config.yaml b/net/smoothmq/files/patch-config.yaml
new file mode 100644
index 000000000000..c75fdbbc8ff7
--- /dev/null
+++ b/net/smoothmq/files/patch-config.yaml
@@ -0,0 +1,9 @@
+--- config.yaml.orig 1979-11-30 05:00:00 UTC
++++ config.yaml
+@@ -12,4 +12,4 @@ server:
+ port: 3000
+
+ sqlite:
+- path: smoothmq.sqlite
+\ No newline at end of file
++ path: /var/db/smoothmq/smoothmq.sqlite
diff --git a/net/smoothmq/files/smoothmq.in b/net/smoothmq/files/smoothmq.in
new file mode 100644
index 000000000000..f3738a79de44
--- /dev/null
+++ b/net/smoothmq/files/smoothmq.in
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# PROVIDE: smoothmq
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+# Add the following lines to /etc/rc.conf to enable smoothmq
+# smoothmq_enable="YES"
+#
+# smoothmq_enable (bool):
+# Set it to YES to enable grafana
+# Set to NO by default
+# smoothmq_user (string):
+# Set user that grafana will run under
+# Default is "%%SMOOTHMQ_USER%%"
+# smoothmq_group (string):
+# Set group that own grafana files
+# Default is "%%SMOOTHMQ_GROUP%%"
+# smoothmq_config (string)
+# Set full path to config file
+# Default is "%%PREFIX%%/etc/smoothmq.yaml"
+# smoothmq_logfile (string)
+# Set full path to log file
+# Default is "/var/log/smoothmq/smoothmq.log"
+# smoothmq_loglevel (string)
+# Set log level. Only log messages with the given severity or above.
+# Valid levels: [debug, info, warn, error]
+# Default is "warn"
+# smoothmq_args (string)
+# Set additional command line arguments
+# Default is ""
+
+. /etc/rc.subr
+
+name=smoothmq
+rcvar=smoothmq_enable
+
+load_rc_config $name
+
+: ${smoothmq_enable:="NO"}
+: ${smoothmq_user:="%%SMOOTHMQ_USER%%"}
+: ${smoothmq_group:="%%SMOOTHMQ_GROUP%%"}
+: ${smoothmq_config:="%%PREFIX%%/etc/smoothmq.yaml"}
+: ${smoothmq_logfile:="/var/log/smoothmq/smoothmq.log"}
+: ${smoothmq_loglevel:="warn"}
+
+pidfile="/var/run/${name}/${name}.pid"
+required_files="${smoothmq_config}"
+
+procname="%%PREFIX%%/bin/smoothmq"
+command="/usr/sbin/daemon"
+start_precmd=start_precmd
+command_args="-p ${pidfile} -t ${name} -o ${smoothmq_logfile} \
+ ${procname} \
+ --config=${smoothmq_config} \
+ --log-pretty \
+ --log-level="${smoothmq_loglevel}" \
+ server ${smoothmq_args}"
+
+start_precmd()
+{
+ if [ ! -e /var/run/${name} ]; then
+ install -d -m 0750 -o ${smoothmq_user} -g ${smoothmq_group} /var/run/${name};
+ fi
+
+ if [ ! -e /var/log/${name} ]; then
+ install -d -m 0750 -o ${smoothmq_user} -g ${smoothmq_group} /var/log/${name};
+ fi
+}
+
+run_rc_command "$1"
diff --git a/net/smoothmq/pkg-descr b/net/smoothmq/pkg-descr
new file mode 100644
index 000000000000..7e9f2c6aa4e2
--- /dev/null
+++ b/net/smoothmq/pkg-descr
@@ -0,0 +1,3 @@
+SmoothMQ is a drop-in replacement for SQS with a much smoother developer
+experience. It has a functional UI, observability, tracing, message scheduling,
+and rate-limiting. SmoothMQ lets you run a private SQS instance on any cloud.
diff --git a/net/smoothmq/pkg-plist b/net/smoothmq/pkg-plist
new file mode 100644
index 000000000000..6bb52938e384
--- /dev/null
+++ b/net/smoothmq/pkg-plist
@@ -0,0 +1,10 @@
+bin/smoothmq
+@sample etc/smoothmq.yaml.sample
+@owner %%SMOOTHMQ_USER%%
+@group %%SMOOTHMQ_GROUP%%
+@mode 750
+@dir %%SMOOTHMQ_DATADIR%%
+@mode
+@group
+@owner
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment