Skip to content

Service Management

Core packages provide a systemd unit on Linux and an rc.d script in FreeBSD packages. The APK contains systemd files, not an OpenRC service; Alpine operators must supply the reviewed OpenRC script described below. A binary-only install supplies no service unless the Linux installer is given --with-service.

Source instructions and release qualification

These instructions reflect the checked-in 1.8.0 package/service sources. Existing CI recipes and historical rehearsals are not proof that a particular published package, repository signature or installed host has passed current qualification. Select and verify the exact released version, architecture, SKU and installed binary; 1.8.0 publication and full package lifecycle evidence remain separate release gates.

Select configuration and credentials first

For systemd, inspect the effective unit and environment-file path:

systemctl cat trident
systemctl show trident -p FragmentPath -p ExecStart -p User -p EnvironmentFiles

The core package selects /etc/trident/config.toml through /etc/default/trident. To use JSON, set TRIDENT_CONFIG=/etc/trident/config.json in that environment file and provide real JSON. Keep existing operator settings; the existence of another config file does not select it. An environment-file or unit change needs the appropriate restart; a configuration reload does not replace process environment.

The service user must traverse/read the selected configuration, includes, secret files and licence, and write its configured state/log directories. A check run as root can conceal permission errors. On Linux, an illustrative user-level preflight is:

sudo -u trident /usr/bin/trident --config /etc/trident/config.toml --check

Supply the same required secret/environment values securely: sudo does not automatically load /etc/default/trident, and a user-level check does not reproduce systemd's ProtectHome/filesystem sandbox. Avoid secrets under a home directory hidden by the unit. For a binary install use its actual prefix, such as /usr/local/bin/trident.

Configure admin authentication with a protected secret file or an environment-sourced admin.auth_token. Use a strong generated value; never copy a demonstration token into production. The admin default secret file is /var/run/trident/admin.secret; ensure its creation/read permissions fit the service sandbox, or configure an explicit protected path/token. The CLI accepts TRIDENT_ADMIN_TOKEN or TRIDENT_SECRET_FILE; avoid --admin-token on the command line because process listings can expose it.

A core instance without a valid licence operates in unlicensed PASS mode; a running/ready process does not prove caching is enabled. Configure license.path when licensed behavior is required and make the actual file readable by trident. A standalone Commerce SKU has its own service/configuration/product-bound licence and must be qualified separately.

systemd (Linux)

Start, stop and boot policy

After configuration and permissions have been validated:

sudo systemctl start trident
sudo systemctl status trident
sudo systemctl enable trident

To stop, or to enable and start together:

sudo systemctl stop trident
# Use only when starting immediately is intended:
sudo systemctl enable --now trident

Fresh package installation enables without starting. An upgrade should preserve an intentionally inactive service; do not enable/start it as a generic recovery step without checking operator intent.

Logs and reload

journalctl -u trident -f
journalctl -u trident --since "1 hour ago"
sudo systemctl reload trident

ExecReload sends SIGHUP. A successful signal delivery is not proof that new configuration was accepted: inspect the reload result/logs and effective configuration. Invalid or restart-only changes can be refused while the previous generation keeps serving. For a process environment, unit or restart-only setting change, use a planned restart after candidate preflight and traffic drain.

Liveness, readiness and authenticated status

For the bundled config's loopback admin address:

curl --fail --silent --show-error http://127.0.0.1:6085/admin/health
curl --fail --silent --show-error http://127.0.0.1:6085/admin/ready
trident-cli --config /etc/trident/config.toml admin status

/admin/health and /admin/ready are bearer-auth-exempt monitoring endpoints; keep admin access restricted. Readiness reflects draining, backend availability and required subsystem health. It is distinct from simple process liveness, licence entitlement and application/body correctness. A /health response on the proxy/metrics plane is not a substitute for admin readiness. Other admin operations require the configured authentication; load CLI credentials securely as above.

The in-code admin fallback is http://localhost:9000, while bundled package configs use 127.0.0.1:6085. The CLI can read admin.address from --config or TRIDENT_CONFIG; use that selected path or an explicit TRIDENT_ADMIN_URL. The service's environment is not automatically inherited by an interactive CLI.

Shipped unit

The package installs /usr/lib/systemd/system/trident.service (/lib may be a distribution symlink). A binary installer rewrites ExecStart to its selected prefix. This is the current packaged unit:

[Unit]
Description=Trident HTTP Cache Proxy
Documentation=https://github.com/qoliber/trident
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
NotifyAccess=main
User=trident
Group=trident
EnvironmentFile=-/etc/default/trident
ExecStart=/usr/bin/trident --config ${TRIDENT_CONFIG}
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=5s

# Startup and runtime watchdog
TimeoutStartSec=30
WatchdogSec=60

# Security hardening
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/trident /var/log/trident
PrivateTmp=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true

# Resource limits
LimitNOFILE=65535
LimitNPROC=4096

[Install]
WantedBy=multi-user.target

It uses Type=notify, NotifyAccess=main, a 30-second startup timeout and 60-second watchdog. LimitNOFILE=65535 and LimitNPROC=4096 are configured limits, not measured throughput/headroom promises. The separate socket unit is not started by the commands above; do not enable it without validating the intended socket-activation topology and listener ownership.

OpenRC (Alpine)

The APK does not install an OpenRC script. The source reference is tests/release-rehearsal/apk/trident.initd. Obtain and review the script from the same approved release source before installing it as /etc/init.d/trident, mode 0755. It runs /usr/bin/trident as trident:trident under supervise-daemon and defaults cfgfile to /etc/trident/config.toml; configure that variable in /etc/conf.d/trident for another path. Provision its secret environment/file access separately; it does not read systemd's environment file by itself.

After installing and reviewing that service script:

sudo rc-service trident checkconfig
sudo rc-service trident start
sudo rc-update add trident default
sudo rc-service trident status
sudo rc-service trident reload

The reviewed script validates the installed candidate before restart stops the old process. APK upgrades themselves do not restart it. reload sends HUP; inspect acceptance and readiness afterward. Do not apply the systemd checked-package-upgrade helper on OpenRC: it calls systemctl even for --check-only.

rc.d (FreeBSD)

The package provides /usr/local/etc/rc.d/trident. It does not enable/start automatically. As an administrator, configure then run:

sysrc trident_enable="YES"
service trident configtest
service trident start
service trident status
service trident reload

start and restart run the installed binary's --check first; a refused configuration stops/starts nothing. The rc.d check runs in the service-management context: independently verify the actual trident user's read/write permissions and secret environment. reload sends HUP and still needs acceptance verification.

rc.conf variable Source default Purpose
trident_enable NO Boot policy
trident_config /usr/local/etc/trident/config.toml Selected configuration
trident_user / trident_group trident / trident Service identity/directory ownership
trident_flags empty Additional supported daemon arguments
trident_logfile /var/log/trident/trident.log Service log

The current script finds the process by executable name; it does not manage a trident_pidfile variable. It creates /var/db/trident and /var/log/trident. Review each configured state path for this platform rather than assuming Linux paths are rebased automatically.

For upgrades, retain package/configuration recovery, preflight the new binary and verify cold recovery; see the source package-upgrade procedure. No service command here establishes an installed-package or published-signature acceptance result.