Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sia service daemons #261

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
6 changes: 3 additions & 3 deletions GIDs
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ prowlarr:*:359:
v2ray:*:360:
httptunnel:*:361:
readarr:*:362:
victoria-logs:*:363:
# free: 364
# free: 365
hostd:*:363:
walletd:*:364:
renterd:*:365:
# free: 366
# free: 367
# free: 368
Expand Down
6 changes: 3 additions & 3 deletions UIDs
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ prowlarr:*:359:359::0:0:Prowlarr Daemon:/nonexistent:/usr/sbin/nologin
v2ray:*:360:360::0:0:V2Ray Daemon:/nonexistent:/usr/sbin/nologin
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
# free: 364
# free: 365
hostd:*:363:363::0:0:hostd Daemon:/nonexistent:/usr/sbin/nologin
walletd:*:364:364::0:0:walletd Daemon:/nonexistent:/usr/sbin/nologin
renterd:*:365:365::0:0:renterd Daemon:/nonexistent:/usr/sbin/nologin
# free: 366
# free: 367
# free: 368
Expand Down
41 changes: 41 additions & 0 deletions net-p2p/hostd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
PORTNAME= hostd
DISTVERSIONPREFIX= v
DISTVERSION= 1.1.2
CATEGORIES= net-p2p

MAINTAINER= [email protected]
COMMENT= Offer your storage space on the Sia network
WWW= https://sia.tech/host

LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE

USES= go:modules
USE_RC_SUBR= hostd

GO_MODULE= go.sia.tech/hostd
GO_TARGET= ./cmd/hostd
GO_BUILDFLAGS+= -tags='netgo timetzdata' -trimpath

PLIST_FILES= bin/hostd \
"@sample ${PREFIX}/etc/hostd.yml.sample" \
"@sample ${PREFIX}/etc/newsyslog.conf.d/hostd.conf.sample" \
"@dir(${USERS},${GROUPS},750) /var/lib/${PORTNAME}"

SUB_FILES= ${PORTNAME}.yml ${PORTNAME}.conf

SUB_LIST= GROUPS=${GROUPS} \
USERS=${USERS}

USERS= ${PORTNAME}
GROUPS= ${PORTNAME}

post-install:
${INSTALL_DATA} ${WRKDIR}/${PORTNAME}.conf ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d/${PORTNAME}.conf.sample
${INSTALL_DATA} ${WRKDIR}/${PORTNAME}.yml ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.yml.sample
${INSTALL} -d ${STAGEDIR}/var/lib/${PORTNAME}

post-patch:
${REINPLACE_CMD} -e "s|BUILDTIME|$$(date +%s)|g" ${WRKSRC}/build/meta.go

.include <bsd.port.mk>
5 changes: 5 additions & 0 deletions net-p2p/hostd/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TIMESTAMP = 1723108114
SHA256 (go/net-p2p_hostd/hostd-v1.1.2/v1.1.2.mod) = 95799a6ba72849bce3927c537f01497995b8c80cf213a222cab884b82ef2fd33
SIZE (go/net-p2p_hostd/hostd-v1.1.2/v1.1.2.mod) = 2858
SHA256 (go/net-p2p_hostd/hostd-v1.1.2/v1.1.2.zip) = f3d10b5486cb68aef93d50887f3955f82a47034e3e8b4494581d58666afcdb2f
SIZE (go/net-p2p_hostd/hostd-v1.1.2/v1.1.2.zip) = 320194
2 changes: 2 additions & 0 deletions net-p2p/hostd/files/hostd.conf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# $FreeBSD$
/var/log/hostd.log 600 20 * @T00 J /var/run/hostd.pid
35 changes: 35 additions & 0 deletions net-p2p/hostd/files/hostd.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

# PROVIDE: hostd
# REQUIRE: LOGIN FILESYSTEMS netwait
# KEYWORD: SHUTDOWN
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# hostd_enable (bool): Set to NO by default.
# Set it to YES to enable doormand.
# hostd_config (path): Set to %%PREFIX%%/etc/hostd.yml
# by default.

. /etc/rc.subr

name=hostd
rcvar=${name}_enable

load_rc_config $name

: ${hostd_enable:=NO}
: ${hostd_executable:="%%PREFIX%%/bin/hostd"}
: ${hostd_config:="%%PREFIX%%/etc/hostd.yml"}

hostd_env="HOSTD_CONFIG_FILE=${hostd_config}"
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
command_args="-r -f -H \
-o \"/var/log/${name}.log\" \
-P \"${pidfile}\" \
-u %%USERS%% \"${hostd_executable}\""


run_rc_command "$1"
28 changes: 28 additions & 0 deletions net-p2p/hostd/files/hostd.yml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
directory: /var/lib/hostd
recoveryPhrase: indicate nature buzz route rude embody engage confirm aspect potato weapon bid
autoOpenWebUI: true
http:
address: :9980
password: sia is cool
consensus:
gatewayAddress: :9981
bootstrap: true
explorer:
url: https://api.siascan.com
rhp2:
address: :9982
rhp3:
tcp: :9983
websocket: :9984
log:
level: info # global log level
stdout:
enabled: true # enable logging to stdout
level: info # log level for console logger
format: human # log format (human, json)
enableANSI: false # enable ANSI color codes (disabled on Windows)
file:
enabled: false # enable logging to file
level: info # log level for file logger
path: /var/log/hostd.log # the path of the log file
format: json # log format (human, json)
15 changes: 15 additions & 0 deletions net-p2p/hostd/files/patch-build_meta.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- build/meta.go.orig 2024-08-08 09:09:43 UTC
+++ build/meta.go
@@ -1,7 +1,9 @@
+// Code generated by go generate; DO NOT EDIT.
+// This file was generated by go generate at 2024-08-08T11:10:58+02:00.
package build

const (
- commit = "?"
- version = "?"
- buildTime = 0
+ commit = "2e36a48"
+ version = "v1.1.2"
+ buildTime = BUILDTIME
)
8 changes: 8 additions & 0 deletions net-p2p/hostd/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
hostd is an advanced Sia host solution created by the Sia Foundation,
designed to enhance the experience for storage providers within the
Sia network. Tailored for both individual and large-scale storage
providers, hostd boasts a user-friendly interface and a robust API,
empowering providers to efficiently manage their storage resources and
revenue. hostd incorporates an embedded web-UI, simplifying deployment
and enabling remote management capabilities, ensuring a smooth user
experience across a diverse range of devices.
9 changes: 9 additions & 0 deletions net-p2p/hostd/pkg-message
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{ type: install
message: <<EOM
The program hostd has been installed. To enable it at boot time,
add it to /etc/rc.conf with the following command:
sysrc hostd_enable="YES"
EOM
}
]
41 changes: 41 additions & 0 deletions net-p2p/renterd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
PORTNAME= renterd
DISTVERSIONPREFIX= v
DISTVERSION= 1.0.7
CATEGORIES= net-p2p

MAINTAINER= [email protected]
COMMENT= Rent storage space on the Sia network
WWW= https://sia.tech/renterd

LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE

USES= go:modules
USE_RC_SUBR= renterd

GO_MODULE= go.sia.tech/renterd
GO_TARGET= ./cmd/renterd
GO_BUILDFLAGS+= -tags='netgo'

PLIST_FILES= bin/renterd \
"@sample ${PREFIX}/etc/renterd.yml.sample" \
"@sample ${PREFIX}/etc/newsyslog.conf.d/renterd.conf.sample" \
"@dir(${USERS},${GROUPS},750) /var/lib/${PORTNAME}"

SUB_FILES= ${PORTNAME}.yml ${PORTNAME}.conf

SUB_LIST= GROUPS=${GROUPS} \
USERS=${USERS}

USERS= ${PORTNAME}
GROUPS= ${PORTNAME}

post-install:
${INSTALL_DATA} ${WRKDIR}/${PORTNAME}.conf ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d/${PORTNAME}.conf.sample
${INSTALL_DATA} ${WRKDIR}/${PORTNAME}.yml ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.yml.sample
${INSTALL} -d ${STAGEDIR}/var/lib/${PORTNAME}

post-patch:
${REINPLACE_CMD} -e "s|BUILDTIME|$$(date +%s)|g" ${WRKSRC}/build/meta.go

.include <bsd.port.mk>
5 changes: 5 additions & 0 deletions net-p2p/renterd/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TIMESTAMP = 1716548661
SHA256 (go/net-p2p_renterd/renterd-v1.0.7/v1.0.7.mod) = cee887fd7a70ec8ba107fc5af90b45e27e79b3cbb302bad5d404b462fd76ddc4
SIZE (go/net-p2p_renterd/renterd-v1.0.7/v1.0.7.mod) = 3969
SHA256 (go/net-p2p_renterd/renterd-v1.0.7/v1.0.7.zip) = 125a016163a24f115280f64f75f161f4a9256a1a5cb101811b550673c5a13390
SIZE (go/net-p2p_renterd/renterd-v1.0.7/v1.0.7.zip) = 566677
22 changes: 22 additions & 0 deletions net-p2p/renterd/files/patch-build_meta.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- build/meta.go.orig 2024-05-24 11:05:03 UTC
+++ build/meta.go
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
-// This file was generated by go generate at 2023-08-11T11:44:04+02:00.
+// This file was generated by go generate at 2024-05-24T12:55:42+02:00.
package build

import (
@@ -7,9 +7,9 @@ const (
)

const (
- commit = "?"
- version = "?"
- buildTime = 0
+ commit = "7e6dcd5c"
+ version = "v1.0.7"
+ buildTime = BUILDTIME
)

// Commit returns the commit hash of hostd
2 changes: 2 additions & 0 deletions net-p2p/renterd/files/renterd.conf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# $FreeBSD$
/var/log/renterd.log 600 20 * @T00 J /var/run/renterd.pid
35 changes: 35 additions & 0 deletions net-p2p/renterd/files/renterd.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

# PROVIDE: renterd
# REQUIRE: LOGIN FILESYSTEMS netwait
# KEYWORD: SHUTDOWN
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# renterd_enable (bool): Set to NO by default.
# Set it to YES to enable doormand.
# renterd_config (path): Set to %%PREFIX%%/etc/renterd.yml
# by default.

. /etc/rc.subr

name=renterd
rcvar=${name}_enable

load_rc_config $name

: ${renterd_enable:=NO}
: ${renterd_executable:="%%PREFIX%%/bin/renterd"}
: ${renterd_config:="%%PREFIX%%/etc/renterd.yml"}

renterd_env="RENTERD_CONFIG_FILE=${renterd_config}"
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
command_args="-r -f -H \
-o \"/var/log/${name}.log\" \
-P \"${pidfile}\" \
-u %%USERS%% \"${renterd_executable}\""


run_rc_command "$1"
54 changes: 54 additions & 0 deletions net-p2p/renterd/files/renterd.yml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
seed: rotation dream build introduce memorandum sphere trouble title pedestrian get conclusion large
directory: /var/lib/renterd
shutdownTimeout: 5m0s
log:
level: warn
stdout:
enabled: true
format: human
enableANSI: false
file:
enabled: false
http:
address: localhost:9980
password: sia is cool
bus:
announcementMaxAgeHours: 8736
bootstrap: true
gatewayAddr: :9981
persistInterval: 1m0s
usedUtxoExpiry: 24h0m0s
slabBufferCompleionThreshold: 4096
worker:
enabled: true
id: worker
busFlushInterval: 5s
contractLockTimeout: 30s
downloadOverdriveTimeout: 3s
uploadOverdriveTimeout: 3s
downloadMaxOverdrive: 5
downloadMaxMemory: 1073741824
uploadMaxMemory: 1073741824
uploadMaxOverdrive: 5
s3:
address: localhost:8080
enabled: true
autopilot:
enabled: true
accountsRefillInterval: 10s
heartbeat: 30m0s
migrationHealthCutoff: 0.75
revisionBroadcastInterval: 168h0m0s
revisionSubmissionBuffer: 144
scannerInterval: 24h0m0s
scannerBatchSize: 1000
scannerNumThreads: 100
migratorParallelSlabsPerWorker: 1
database:
log:
ignoreRecordNotFoundError: true
slowThreshold: 100ms
mysql:
user: renterd
database: renterd
metricsDatabase: renterd_metrics
4 changes: 4 additions & 0 deletions net-p2p/renterd/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
renterd is an advanced Sia renter engineered by the Sia
Foundation. Designed to cater to both casual users seeking
straightforward data storage and developers requiring a robust API for
building apps on Sia.
9 changes: 9 additions & 0 deletions net-p2p/renterd/pkg-message
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{ type: install
message: <<EOM
The program renterd has been installed. To enable it at boot time,
add it to /etc/rc.conf with the following command:
sysrc renterd_enable="YES"
EOM
}
]
Loading