mirror of
https://git.freebsd.org/ports.git
synced 2025-04-28 01:26:39 -04:00
sysutils/kleene-daemon: new port for container management
PR: 279003 Sponsored by: SkunkWerks, GmbH Differential Revision: https://reviews.freebsd.org/D49018
This commit is contained in:
parent
4a7cd62cf1
commit
92eeb2761b
7 changed files with 231 additions and 0 deletions
|
@ -586,6 +586,7 @@
|
|||
SUBDIR += kiconvtool
|
||||
SUBDIR += kldfind
|
||||
SUBDIR += kldpatch
|
||||
SUBDIR += kleene-daemon
|
||||
SUBDIR += kopia
|
||||
SUBDIR += kops
|
||||
SUBDIR += kpmcore
|
||||
|
|
88
sysutils/kleene-daemon/Makefile
Normal file
88
sysutils/kleene-daemon/Makefile
Normal file
|
@ -0,0 +1,88 @@
|
|||
PORTNAME= kleene-daemon
|
||||
DISTVERSIONPREFIX= v
|
||||
DISTVERSION= 0.1.0
|
||||
DISTVERSIONSUFFIX= -rc.5
|
||||
CATEGORIES= sysutils
|
||||
MASTER_SITES+= https://builds.hex.pm/installs/1.16.0/:hex
|
||||
DISTFILES+= hex-${_HEXPM_VERSION}.ez:hex
|
||||
|
||||
MAINTAINER= lasse@philomath.dk
|
||||
COMMENT= Kleene backend daemon for managing containers on FreeBSD
|
||||
WWW= https://kleene.dev
|
||||
|
||||
LICENSE= APACHE20 BSD2CLAUSE
|
||||
LICENSE_COMB= multi
|
||||
|
||||
BUILD_DEPENDS= ca_root_nss>0:security/ca_root_nss \
|
||||
mix:lang/elixir \
|
||||
rebar3:devel/rebar3
|
||||
|
||||
USES= gmake ssl
|
||||
USE_GITHUB= yes
|
||||
|
||||
GH_ACCOUNT= kleene-project
|
||||
GH_PROJECT= kleened
|
||||
USE_RC_SUBR= kleened
|
||||
|
||||
MAKE_ENV+= ERL_LIBS='' \
|
||||
HEX_HOME=${WRKDIR}/.hex \
|
||||
HEX_OFFLINE=true \
|
||||
LANG=en_US_UTF-8 \
|
||||
LC_ALL=en_US.UTF-8 \
|
||||
MIX_ARCHIVES=${WRKDIR} \
|
||||
MIX_ENV=prod \
|
||||
MIX_HOME=${WRKDIR}/.mix \
|
||||
MIX_PATH=${WRKDIR}/.mix/archives/hex-${_HEXPM_VERSION}/hex-${_HEXPM_VERSION}/ebin \
|
||||
MIX_REBAR3=${LOCALBASE}/bin/rebar3
|
||||
|
||||
ETCDIR= ${PREFIX}/etc/kleened
|
||||
SUB_FILES= pkg-message
|
||||
PLIST_SUB= DISTVERSION=${DISTVERSION}
|
||||
|
||||
_HEXPM_VERSION= 2.1.1
|
||||
_HEX_DIR= ${WRKDIR}/.mix/archives/hex-${_HEXPM_VERSION}
|
||||
_RELEASE_PATH= ${WRKSRC}/_build/prod/rel/kleened
|
||||
_RELEASE_BINARIES= escript dialyzer erlexec beam.smp heart dyn_erl to_erl \
|
||||
erlc epmd run_erl typer inet_gethost erl_child_setup \
|
||||
ct_run erl_call yielding_c_fun
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
post-extract:
|
||||
${MKDIR} ${_HEX_DIR}
|
||||
${MV} ${WRKDIR}/hex-* \
|
||||
${_HEX_DIR}/
|
||||
|
||||
do-build:
|
||||
(cd ${WRKSRC} && \
|
||||
${SETENV} ${MAKE_ENV} ${LOCALBASE}/bin/mix do deps.compile, \
|
||||
compile, release)
|
||||
|
||||
do-install:
|
||||
# sample configs
|
||||
${MKDIR} ${STAGEDIR}${ETCDIR}
|
||||
${INSTALL_DATA} ${WRKSRC}/example/kleened_config.yaml \
|
||||
${STAGEDIR}${ETCDIR}/config.yaml.sample
|
||||
${INSTALL_DATA} ${WRKSRC}/example/pf.conf.kleene \
|
||||
${STAGEDIR}${ETCDIR}/pf.conf.kleene.sample
|
||||
# the release
|
||||
${CP} -a ${WRKSRC}/_build/prod/rel/kleened ${STAGEDIR}${PREFIX}/libexec/
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/priv/bin/kleened_pty \
|
||||
${STAGEDIR}${PREFIX}/libexec/kleened/bin/
|
||||
${RM} ${STAGEDIR}${PREFIX}/libexec/kleened/bin/*.src
|
||||
# strip binaries and objects
|
||||
${FIND} ${STAGEDIR}${PREFIX}/libexec/kleened/lib -type f -name \
|
||||
*.so -exec ${STRIP_CMD} {} \;
|
||||
.for bin in ${_RELEASE_BINARIES}
|
||||
${STRIP_CMD} ${STAGEDIR}${PREFIX}/libexec/kleened/erts-*/bin/${bin}
|
||||
.endfor
|
||||
|
||||
post-install:
|
||||
@cd ${STAGEDIR}${PREFIX} && \
|
||||
${FIND} libexec/kleened/erts-* -type f -o -type l | \
|
||||
${SORT} >> ${TMPPLIST}
|
||||
@cd ${STAGEDIR}${PREFIX} && \
|
||||
${FIND} libexec/kleened/lib/* -type f -o -type l | \
|
||||
${SORT} >> ${TMPPLIST}
|
||||
|
||||
.include <bsd.port.post.mk>
|
5
sysutils/kleene-daemon/distinfo
Normal file
5
sysutils/kleene-daemon/distinfo
Normal file
|
@ -0,0 +1,5 @@
|
|||
TIMESTAMP = 1739837077
|
||||
SHA256 (hex-2.1.1.ez) = 59c163c3e4efe4bdbb7029cd494e30c09b87beebc99359c175960cc4101beada
|
||||
SIZE (hex-2.1.1.ez) = 777696
|
||||
SHA256 (kleene-project-kleened-v0.1.0-rc.5_GH0.tar.gz) = 2fa2f9f907c8046a3c67daf100a5d6937f8a8be08865a9fb03c2cb6d31745fb7
|
||||
SIZE (kleene-project-kleened-v0.1.0-rc.5_GH0.tar.gz) = 5080006
|
74
sysutils/kleene-daemon/files/kleened.in
Normal file
74
sysutils/kleene-daemon/files/kleened.in
Normal file
|
@ -0,0 +1,74 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: kleened
|
||||
# REQUIRE: LOGIN
|
||||
# KEYWORD: shutdown
|
||||
#
|
||||
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
|
||||
# to enable and configure this service:
|
||||
#
|
||||
# kleened_enable (bool): Set to NO by default.
|
||||
# Set it to YES to enable kleened.
|
||||
# kleened_user (str): Set to "root" by default.
|
||||
# kleened_config (str): Path to config file.
|
||||
# Default: %%PREFIX%%/etc/kleened/config.yaml
|
||||
# kleened_shutdown_timeout (int): Seconds to wait for graceful shutdown.
|
||||
# Default: 60
|
||||
|
||||
. /etc/rc.subr
|
||||
name=kleened
|
||||
rcvar=kleened_enable
|
||||
extra_commands="init dryinit"
|
||||
# kleened_init: Initialize host configuration
|
||||
# kleened_dryinit: Test host configuration without applying changes
|
||||
|
||||
required_files="${kleened_config}"
|
||||
|
||||
command="%%PREFIX%%/libexec/kleened/bin/kleened"
|
||||
pidfile="/var/run/kleened.pid"
|
||||
procname="$(/usr/bin/find %%PREFIX%%/libexec/kleened -name beam.smp)"
|
||||
|
||||
start_cmd="${command} daemon"
|
||||
status_cmd="${command} ping"
|
||||
stop_cmd="kleened_stop"
|
||||
init_cmd="kleened_init"
|
||||
dryinit_cmd="kleened_dryinit"
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${kleened_enable:=no}
|
||||
: ${kleened_user:="root"}
|
||||
: ${kleened_config:="%%ETCDIR%%/config.yaml"}
|
||||
: ${kleened_shutdown_timeout:=60}
|
||||
: ${kleened_env="LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 PATH=%%PREFIX%%/libexec/kleened/bin:${PATH}"}
|
||||
|
||||
kleened_stop()
|
||||
{
|
||||
echo "Stopping ${name}."
|
||||
${command} stop
|
||||
wait_for_pids ${pidfile} ${kleened_shutdown_timeout}
|
||||
}
|
||||
|
||||
kleened_init()
|
||||
{
|
||||
echo "Initializing kleened host configuration..."
|
||||
if %%PREFIX%%/libexec/kleened/bin/kleened eval "Kleened.Core.Config.initialize_host(%{dry_run: false})"; then
|
||||
echo "Host initialization completed successfully"
|
||||
else
|
||||
echo "Host initialization failed"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
kleened_dryinit()
|
||||
{
|
||||
echo "Testing kleened host configuration..."
|
||||
if %%PREFIX%%/libexec/kleened/bin/kleened eval "Kleened.Core.Config.initialize_host(%{dry_run: true})"; then
|
||||
echo "Host configuration test completed successfully"
|
||||
else
|
||||
echo "Host configuration test failed"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
33
sysutils/kleene-daemon/files/pkg-message.in
Normal file
33
sysutils/kleene-daemon/files/pkg-message.in
Normal file
|
@ -0,0 +1,33 @@
|
|||
[
|
||||
{ type: install
|
||||
message: <<EOM
|
||||
Kleene is a new tool and should be used for
|
||||
testing and experimentation purposes only.
|
||||
|
||||
To use Kleened, enable it in rc.conf using
|
||||
|
||||
sysrc kleened_enable=YES
|
||||
|
||||
Kleened requires certain services and kernel modules to be configured in order
|
||||
to work properly. Run
|
||||
|
||||
service kleened init
|
||||
|
||||
to make Kleened automatically try and configure the host for you.
|
||||
Alternatively, run
|
||||
|
||||
service kleened dryinit
|
||||
|
||||
to get an overview of what needs to be configured, without actually changing
|
||||
the host.
|
||||
|
||||
NB. The %%ETCDIR%%/config.yaml file should be edited before running
|
||||
'service kleened init' since some of the parameters are used during host
|
||||
initialization.
|
||||
|
||||
You can then start Kleened by running:
|
||||
|
||||
service kleened start
|
||||
EOM
|
||||
}
|
||||
]
|
3
sysutils/kleene-daemon/pkg-descr
Normal file
3
sysutils/kleene-daemon/pkg-descr
Normal file
|
@ -0,0 +1,3 @@
|
|||
Backend daemon for Kleene, a modern FreeBSD-native container management tool.
|
||||
Extensive documentation is available at https://kleene.dev/ and community
|
||||
via #kleene IRC channel on https://libera.chat/ .
|
27
sysutils/kleene-daemon/pkg-plist
Normal file
27
sysutils/kleene-daemon/pkg-plist
Normal file
|
@ -0,0 +1,27 @@
|
|||
@sample %%ETCDIR%%/config.yaml.sample
|
||||
@sample %%ETCDIR%%/pf.conf.kleene.sample
|
||||
libexec/kleened/bin/kleened
|
||||
libexec/kleened/bin/kleened_pty
|
||||
libexec/kleened/releases/%%DISTVERSION%%/consolidated/Elixir.Collectable.beam
|
||||
libexec/kleened/releases/%%DISTVERSION%%/consolidated/Elixir.DBConnection.Query.beam
|
||||
libexec/kleened/releases/%%DISTVERSION%%/consolidated/Elixir.Enumerable.beam
|
||||
libexec/kleened/releases/%%DISTVERSION%%/consolidated/Elixir.IEx.Info.beam
|
||||
libexec/kleened/releases/%%DISTVERSION%%/consolidated/Elixir.Inspect.beam
|
||||
libexec/kleened/releases/%%DISTVERSION%%/consolidated/Elixir.Jason.Encoder.beam
|
||||
libexec/kleened/releases/%%DISTVERSION%%/consolidated/Elixir.List.Chars.beam
|
||||
libexec/kleened/releases/%%DISTVERSION%%/consolidated/Elixir.OpenApiSpex.Extendable.beam
|
||||
libexec/kleened/releases/%%DISTVERSION%%/consolidated/Elixir.Plug.Exception.beam
|
||||
libexec/kleened/releases/%%DISTVERSION%%/consolidated/Elixir.String.Chars.beam
|
||||
libexec/kleened/releases/%%DISTVERSION%%/elixir
|
||||
libexec/kleened/releases/%%DISTVERSION%%/env.sh
|
||||
libexec/kleened/releases/%%DISTVERSION%%/iex
|
||||
libexec/kleened/releases/%%DISTVERSION%%/kleened.rel
|
||||
libexec/kleened/releases/%%DISTVERSION%%/remote.vm.args
|
||||
libexec/kleened/releases/%%DISTVERSION%%/start.boot
|
||||
libexec/kleened/releases/%%DISTVERSION%%/start.script
|
||||
libexec/kleened/releases/%%DISTVERSION%%/start_clean.boot
|
||||
libexec/kleened/releases/%%DISTVERSION%%/start_clean.script
|
||||
libexec/kleened/releases/%%DISTVERSION%%/sys.config
|
||||
libexec/kleened/releases/%%DISTVERSION%%/vm.args
|
||||
libexec/kleened/releases/COOKIE
|
||||
libexec/kleened/releases/start_erl.data
|
Loading…
Add table
Reference in a new issue