summaryrefslogtreecommitdiff
path: root/net/dataplaneapi
diff options
context:
space:
mode:
Diffstat (limited to 'net/dataplaneapi')
-rw-r--r--net/dataplaneapi/Makefile54
-rw-r--r--net/dataplaneapi/distinfo5
-rw-r--r--net/dataplaneapi/files/dataplaneapi.in27
-rw-r--r--net/dataplaneapi/files/dataplaneapi.yaml42
-rw-r--r--net/dataplaneapi/files/patch-configuration_configuration.go34
-rw-r--r--net/dataplaneapi/pkg-descr3
-rw-r--r--net/dataplaneapi/pkg-message7
7 files changed, 172 insertions, 0 deletions
diff --git a/net/dataplaneapi/Makefile b/net/dataplaneapi/Makefile
new file mode 100644
index 000000000000..b4e724d851f2
--- /dev/null
+++ b/net/dataplaneapi/Makefile
@@ -0,0 +1,54 @@
+PORTNAME= dataplaneapi
+DISTVERSIONPREFIX= v
+DISTVERSION= 3.2.1
+CATEGORIES= net
+
+MAINTAINER= dtxdf@FreeBSD.org
+COMMENT= HAProxy Data Plane API
+WWW= https://github.com/haproxytech/${PORTNAME}
+
+LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+USES= go:modules
+USE_GITHUB= yes
+GH_ACCOUNT= haproxytech
+
+USE_RC_SUBR= ${PORTNAME}
+
+GO_MOD_DIST= github
+GO_MODULE= github.com/haproxytech/${PORTNAME}
+GO_TARGET= ./cmd/${PORTNAME}
+GO_BUILDFLAGS= -ldflags "\
+ -X 'main.GitRepo=https://github.com/haproxytech/${PORTNAME}' \
+ -X 'main.GitTag=${DISTVERSIONPREFIX}${DISTVERSION}' \
+ -X 'main.GitCommit=${GITID}' \
+ -X 'main.BuildTime=${BUILD_DATE}'"
+
+PLIST_FILES= "@sample(,,640) etc/dataplaneapi.yaml.sample" \
+ bin/${PORTNAME}
+
+PORTDOCS= CONFIG.md README.md
+
+OPTIONS_DEFINE= DOCS
+
+# Run 'git checkout ${DISTVERSIONPREFIX}${DISTVERSION} && git rev-parse --short HEAD'
+# in the Data Plane API repository to get the value of GITID.
+GITID= 32af2b44
+
+BUILD_DATE= $$(date -u "+%Y-%m-%dT%H:%M:%SZ")
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' \
+ ${WRKSRC}/configuration/configuration.go
+
+post-install:
+ ${SED} -e 's|%%PREFIX%%|${PREFIX}|' ${FILESDIR}/dataplaneapi.yaml \
+ > ${STAGEDIR}${PREFIX}/etc/dataplaneapi.yaml.sample
+
+post-install-DOCS-on:
+ @${MKDIR} ${STAGEDIR}${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/configuration/doc/README.md ${STAGEDIR}${DOCSDIR}/CONFIG.md
+
+.include <bsd.port.mk>
diff --git a/net/dataplaneapi/distinfo b/net/dataplaneapi/distinfo
new file mode 100644
index 000000000000..b874220f6cc5
--- /dev/null
+++ b/net/dataplaneapi/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1750225459
+SHA256 (go/net_dataplaneapi/haproxytech-dataplaneapi-v3.2.1_GH0/go.mod) = 319b1fe6d9dbfba8df886756481398ef98f7c277703698225258f221b20936b3
+SIZE (go/net_dataplaneapi/haproxytech-dataplaneapi-v3.2.1_GH0/go.mod) = 4279
+SHA256 (go/net_dataplaneapi/haproxytech-dataplaneapi-v3.2.1_GH0/haproxytech-dataplaneapi-v3.2.1_GH0.tar.gz) = 48fa6905a4b9b956b9addb19220a486c271319ba48fd353089af9335cfa11123
+SIZE (go/net_dataplaneapi/haproxytech-dataplaneapi-v3.2.1_GH0/haproxytech-dataplaneapi-v3.2.1_GH0.tar.gz) = 1068852
diff --git a/net/dataplaneapi/files/dataplaneapi.in b/net/dataplaneapi/files/dataplaneapi.in
new file mode 100644
index 000000000000..fb5f74c483c5
--- /dev/null
+++ b/net/dataplaneapi/files/dataplaneapi.in
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# PROVIDE: dataplaneapi
+# REQUIRE: LOGIN haproxy
+# KEYWORD: shutdown
+#
+# Configuration settings for Data Plane API in /etc/rc.conf
+#
+# dataplaneapi_enable (bool): Enable Data Plane API. (default=NO)
+#
+
+. /etc/rc.subr
+
+name="dataplaneapi"
+desc="HAProxy Data Plane API"
+rcvar="${name}_enable"
+
+load_rc_config $name
+
+: ${dataplaneapi_enable:="NO"}
+
+pidfile="/var/run/${name}.pid"
+procname="%%LOCALBASE%%/bin/${name}"
+command="/usr/sbin/daemon"
+command_args="-c -p ${pidfile} -t \"${desc}\" ${procname}"
+
+run_rc_command "$1"
diff --git a/net/dataplaneapi/files/dataplaneapi.yaml b/net/dataplaneapi/files/dataplaneapi.yaml
new file mode 100644
index 000000000000..00dca6fb2a5f
--- /dev/null
+++ b/net/dataplaneapi/files/dataplaneapi.yaml
@@ -0,0 +1,42 @@
+config_version: 2
+name: haproxy-dataplaneapi
+dataplaneapi:
+ host: 0.0.0.0
+ port: 5555
+ advertised:
+ api_address: ""
+ api_port: 0
+ scheme:
+ - http
+ userlist:
+ userlist: controller
+ userlist_file: ""
+ transaction:
+ transaction_dir: %%PREFIX%%/etc/haproxy/transactions
+ backups_number: 10
+ backups_dir: %%PREFIX%%/etc/haproxy/backups
+ max_open_transactions: 10
+ resources:
+ maps_dir: %%PREFIX%%/etc/haproxy/maps
+ ssl_certs_dir: %%PREFIX%%/etc/haproxy/ssl
+ general_storage_dir: %%PREFIX%%/etc/haproxy/general
+ dataplane_storage_dir: %%PREFIX%%/etc/haproxy/dataplane
+ spoe_dir: %%PREFIX%%/etc/haproxy/spoe
+haproxy:
+ config_file: %%PREFIX%%/etc/haproxy/haproxy.cfg
+ haproxy_bin: /usr/local/sbin/haproxy
+ master_worker_mode: false
+ reload:
+ reload_delay: 5
+ reload_cmd: service haproxy reload
+ restart_cmd: service haproxy restart
+ status_cmd: service haproxy status
+ reload_strategy: custom
+ validate_cmd: service haproxy configtest
+log_targets:
+- log_to: file
+ log_file: /var/log/haproxy-dataplaneapi.log
+ log_level: info
+ log_types:
+ - access
+ - app
diff --git a/net/dataplaneapi/files/patch-configuration_configuration.go b/net/dataplaneapi/files/patch-configuration_configuration.go
new file mode 100644
index 000000000000..ed3337fb83d8
--- /dev/null
+++ b/net/dataplaneapi/files/patch-configuration_configuration.go
@@ -0,0 +1,34 @@
+--- configuration/configuration.go.orig 2025-05-26 14:19:12 UTC
++++ configuration/configuration.go
+@@ -37,7 +37,7 @@ type HAProxyConfiguration struct {
+ var cfg *Configuration
+
+ type HAProxyConfiguration struct {
+- SpoeDir string `long:"spoe-dir" description:"Path to SPOE directory." default:"/etc/haproxy/spoe" group:"resources"`
++ SpoeDir string `long:"spoe-dir" description:"Path to SPOE directory." default:"%%PREFIX%%/etc/haproxy/spoe" group:"resources"`
+ ServiceName string `long:"service" description:"Name of the HAProxy service" group:"reload"`
+ HAProxy string `short:"b" long:"haproxy-bin" description:"Path to the haproxy binary file" default:"haproxy" group:"haproxy"`
+ UserListFile string `long:"userlist-file" description:"Path to the dataplaneapi userlist file. By default userlist is read from HAProxy conf. When specified userlist would be read from this file" group:"userlist"`
+@@ -50,16 +50,16 @@ type HAProxyConfiguration struct {
+ TransactionDir string `short:"t" long:"transaction-dir" description:"Path to the transaction directory" default:"/tmp/haproxy" group:"transaction"`
+ ValidateCmd string `long:"validate-cmd" description:"Executes a custom command to perform the HAProxy configuration check" group:"reload"`
+ BackupsDir string `long:"backups-dir" description:"Path to directory in which to place backup files" group:"transaction"`
+- MapsDir string `short:"p" long:"maps-dir" description:"Path to directory of map files managed by dataplane" default:"/etc/haproxy/maps" group:"resources"`
++ MapsDir string `short:"p" long:"maps-dir" description:"Path to directory of map files managed by dataplane" default:"%%PREFIX%%/etc/haproxy/maps" group:"resources"`
+ SpoeTransactionDir string `long:"spoe-transaction-dir" description:"Path to the SPOE transaction directory" default:"/tmp/spoe-haproxy" group:"resources"`
+- DataplaneConfig string `short:"f" description:"Path to the dataplane configuration file" default:"/etc/haproxy/dataplaneapi.yaml" yaml:"-"`
+- ConfigFile string `short:"c" long:"config-file" description:"Path to the haproxy configuration file" default:"/etc/haproxy/haproxy.cfg" group:"haproxy"`
++ DataplaneConfig string `short:"f" description:"Path to the dataplane configuration file" default:"%%PREFIX%%/etc/dataplaneapi.yaml" yaml:"-"`
++ ConfigFile string `short:"c" long:"config-file" description:"Path to the haproxy configuration file" default:"%%PREFIX%%/etc/haproxy/haproxy.cfg" group:"haproxy"`
+ Userlist string `short:"u" long:"userlist" description:"Userlist in HAProxy configuration to use for API Basic Authentication" default:"controller" group:"userlist"`
+ MasterRuntime string `short:"m" long:"master-runtime" description:"Path to the master Runtime API socket" group:"haproxy"`
+- SSLCertsDir string `long:"ssl-certs-dir" description:"Path to SSL certificates directory" default:"/etc/haproxy/ssl" group:"resources"`
+- GeneralStorageDir string `long:"general-storage-dir" description:"Path to general storage directory" default:"/etc/haproxy/general" group:"resources"`
++ SSLCertsDir string `long:"ssl-certs-dir" description:"Path to SSL certificates directory" default:"%%PREFIX%%/etc/haproxy/ssl" group:"resources"`
++ GeneralStorageDir string `long:"general-storage-dir" description:"Path to general storage directory" default:"%%PREFIX%%/etc/haproxy/general" group:"resources"`
+ ClusterTLSCertDir string `long:"cluster-tls-dir" description:"Path where cluster tls certificates will be stored. Defaults to same directory as dataplane configuration file" group:"cluster"`
+- DataplaneStorageDir string `long:"dataplane-storage-dir" description:"Path to dataplane internal storage directory" default:"/etc/haproxy/dataplane" group:"resources"`
++ DataplaneStorageDir string `long:"dataplane-storage-dir" description:"Path to dataplane internal storage directory" default:"%%PREFIX%%/etc/haproxy/dataplane" group:"resources"`
+ PreferredTimeSuffix string `long:"time-suffix" description:"Preferred time unit to use when writing time values in configuration (nearest, none, ms, s, m, h, d)" default:"nearest" group:"haproxy"`
+ UpdateMapFilesPeriod int64 `long:"update-map-files-period" description:"Elapsed time in seconds between two maps syncing operations" default:"10" group:"resources"`
+ ReloadDelay int `short:"d" long:"reload-delay" description:"Minimum delay between two reloads (in s)" default:"5" group:"reload"`
diff --git a/net/dataplaneapi/pkg-descr b/net/dataplaneapi/pkg-descr
new file mode 100644
index 000000000000..c47451e43c33
--- /dev/null
+++ b/net/dataplaneapi/pkg-descr
@@ -0,0 +1,3 @@
+Data Plane API is a sidecar process that runs next to HAProxy and
+provides API endpoints for managing HAProxy. It requires HAProxy
+version 1.9.0 or higher.
diff --git a/net/dataplaneapi/pkg-message b/net/dataplaneapi/pkg-message
new file mode 100644
index 000000000000..cb87f2fccc0a
--- /dev/null
+++ b/net/dataplaneapi/pkg-message
@@ -0,0 +1,7 @@
+[
+{ type: install
+ message: <<EOM
+net/dataplaneapi needs HAProxy to work properly, please install it.
+EOM
+}
+]