Systemd Deployment
Run infrasagent as a managed systemd service on bare-metal or VM hosts.
Install Script
The fastest path — downloads the binary, installs it to /usr/local/bin, writes the systemd unit, and starts the service:
curl -fsSL https://get.infrasage.io/agent/install.sh | \
INFRASAGE_API_KEY=<YOUR_API_KEY> bash
The script:
- Detects the host architecture and downloads the matching binary
- Creates a dedicated
infrasagentuser (no login shell, no home directory) - Installs the binary to
/usr/local/bin/infrasagent - Writes a default config to
/etc/infrasagent/agent.yaml - Installs and enables the systemd unit
Manual Install
1. Download the Binary
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
VERSION=$(curl -s https://api.github.com/repos/infrasage/infrasagent/releases/latest \
| grep tag_name | cut -d'"' -f4)
curl -Lo /usr/local/bin/infrasagent \
"https://github.com/infrasage/infrasagent/releases/download/${VERSION}/infrasagent-linux-${ARCH}"
chmod +x /usr/local/bin/infrasagent
2. Create the Config
mkdir -p /etc/infrasagent
cat > /etc/infrasagent/agent.yaml <<'EOF'
agent:
name: "${HOSTNAME}-agent"
mode: agent
api:
listen: "0.0.0.0:8080"
sources:
otlp_in:
type: otlp
grpc:
listen: "0.0.0.0:4317"
http:
listen: "0.0.0.0:4318"
host_metrics:
type: hostmetrics
collection_interval: 15s
scrapers: [cpu, memory, disk, network, load, processes]
journal:
type: journald
processors:
batch_main:
type: batch
timeout: 5s
max_size: 10000
sources: [otlp_in, host_metrics, journal]
sinks:
infrasage:
type: otlp
endpoint: "https://api.infrasage.dev"
protocol: http
auth_header: "Bearer ${INFRASAGE_API_KEY}"
sources: [batch_main]
EOF
3. Create the Systemd Unit
cat > /etc/systemd/system/infrasagent.service <<'EOF'
[Unit]
Description=InfraSage Agent
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=60
StartLimitBurst=5
[Service]
Type=simple
User=infrasagent
Group=infrasagent
ExecStart=/usr/local/bin/infrasagent -config /etc/infrasagent/agent.yaml
Restart=on-failure
RestartSec=5s
EnvironmentFile=-/etc/infrasagent/env
# Security hardening
ProtectSystem=full
PrivateTmp=true
NoNewPrivileges=true
AmbientCapabilities=CAP_NET_BIND_SERVICE
# Resource limits
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
4. Create the Environment File
cat > /etc/infrasagent/env <<EOF
INFRASAGE_API_KEY=<YOUR_API_KEY>
EOF
chmod 600 /etc/infrasagent/env
5. Create the Service User
useradd --system --no-create-home --shell /sbin/nologin infrasagent
chown -R infrasagent:infrasagent /etc/infrasagent
6. Enable and Start
systemctl daemon-reload
systemctl enable infrasagent
systemctl start infrasagent
systemctl status infrasagent
Operations
# View logs
journalctl -u infrasagent -f
# Reload config without restart
systemctl kill -s HUP infrasagent
# Check health
curl http://localhost:8080/health
# View pipeline metrics
curl http://localhost:8080/metrics | grep records_exported
Upgrading
# Download new binary
curl -Lo /usr/local/bin/infrasagent \
"https://github.com/infrasage/infrasagent/releases/download/v1.x.y/infrasagent-linux-amd64"
chmod +x /usr/local/bin/infrasagent
# Restart the service
systemctl restart infrasagent