malloc and start
This commit is contained in:
1 parent
e5b0609234
commit
bcb2dc838e
8 files changed
+66
-3
No files matched your search
@@ -30,4 +30,18 @@ if [ -x /usr/local/opnsense/mvc/script/run_migrations.php ]; then
|
||||
fi
|
||||
/usr/local/sbin/configctl template reload OPNsense/RustProxy >/dev/null 2>&1 || true
|
||||
|
||||
# A package upgrade invokes the previous package pre-deinstall hook, which stops
|
||||
# RustProxy before replacing the binary. Start it again after migrations and
|
||||
# template rendering. Use the installed service helper directly so this does
|
||||
# not depend on configd having finished reloading its action registry. The
|
||||
# helper itself checks enabled=1; on a fresh/default-disabled install this is a
|
||||
# no-op. restart is deliberate: if an old process survived a forced pkg add,
|
||||
# it is stopped before the new binary starts.
|
||||
if [ -x /usr/local/opnsense/scripts/rustproxy/service.sh ]; then
|
||||
if ! /usr/local/opnsense/scripts/rustproxy/service.sh restart; then
|
||||
echo "WARNING: RustProxy package installed but the service could not be started." >&2
|
||||
echo "Check /var/log/rustproxy/rustproxy.log and run: configctl rustproxy start" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Regular → Executable
+10
-1
@@ -1,4 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
/usr/local/sbin/configctl rustproxy stop >/dev/null 2>&1 || true
|
||||
# pkg upgrade runs the old package pre-deinstall hook before installing the new
|
||||
# binary. Stop the supervised child first so the upgrade never leaves an old
|
||||
# RustProxy process running from an unlinked executable. configctl is preferred
|
||||
# on OPNsense; the rc.d fallback also works while configd is restarting.
|
||||
if ! /usr/local/sbin/configctl rustproxy stop >/dev/null 2>&1; then
|
||||
if [ -x /usr/local/etc/rc.d/rustproxy ]; then
|
||||
/usr/local/etc/rc.d/rustproxy onestop >/dev/null 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -24,6 +24,12 @@ load_rc_config "$name"
|
||||
: ${rustproxy_command:="/usr/local/sbin/rust-proxy"}
|
||||
: ${rustproxy_restart_delay:="5"}
|
||||
: ${rustproxy_allow_remote_admin:="1"}
|
||||
# FreeBSD uses jemalloc rather than glibc. Keep the same low-arena intent as
|
||||
# Linux MALLOC_ARENA_MAX=2 with the native jemalloc knob. rc.conf can override
|
||||
# rustproxy_malloc_conf or set it to an empty value to disable the tuning.
|
||||
if [ "${rustproxy_malloc_conf+x}" != "x" ]; then
|
||||
rustproxy_malloc_conf="${MALLOC_CONF:-narenas:2}"
|
||||
fi
|
||||
|
||||
# Split listener settings written by the current OPNsense model.
|
||||
: ${rustproxy_proxy_address:=""}
|
||||
@@ -166,6 +172,16 @@ status_cmd="rustproxy_status"
|
||||
|
||||
rustproxy_prestart()
|
||||
{
|
||||
# RustProxy on OPNsense/FreeBSD uses jemalloc. MALLOC_ARENA_MAX is a
|
||||
# glibc/Linux setting and has no useful effect here, so export MALLOC_CONF
|
||||
# instead. daemon(8) inherits this environment and passes it to RustProxy.
|
||||
if [ -n "${rustproxy_malloc_conf}" ]; then
|
||||
MALLOC_CONF="${rustproxy_malloc_conf}"
|
||||
export MALLOC_CONF
|
||||
else
|
||||
unset MALLOC_CONF
|
||||
fi
|
||||
|
||||
# /var/run is ephemeral and recreated on boot.
|
||||
/usr/bin/install -d -o "${rustproxy_user}" -g "${rustproxy_group}" -m 0750 "${rustproxy_run_dir}"
|
||||
/usr/sbin/chown "${rustproxy_user}:${rustproxy_group}" "${rustproxy_run_dir}"
|
||||
@@ -181,6 +197,9 @@ rustproxy_prestart()
|
||||
/bin/chmod 0640 "${rustproxy_log_file}"
|
||||
|
||||
echo "RustProxy listeners: HTTP=${rustproxy_proxy_listen_resolved} TLS=${rustproxy_tls_listen_resolved} ADMIN=${rustproxy_admin_listen_resolved}"
|
||||
if [ -n "${rustproxy_malloc_conf}" ]; then
|
||||
echo "RustProxy allocator: MALLOC_CONF=${rustproxy_malloc_conf}"
|
||||
fi
|
||||
echo "RustProxy exec: ${rustproxy_command} ${rustproxy_runtime_args}"
|
||||
printf '%s\n' "${rustproxy_command} ${rustproxy_runtime_args}" > "${rustproxy_run_dir}/command.txt"
|
||||
/bin/chmod 0640 "${rustproxy_run_dir}/command.txt"
|
||||
|
||||
Reference in new issue
Block a user