19 lines
954 B
Bash
Executable File
19 lines
954 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
[[ $EUID -eq 0 ]] || { echo 'Run as root on the monitored host.'; exit 1; }
|
|
[[ "$PWD" == /opt/dilib-dashboard ]] || { echo 'Extract project to /opt/dilib-dashboard first.'; exit 1; }
|
|
apt-get update
|
|
apt-get install -y python3 python3-venv
|
|
id dilib-agent >/dev/null 2>&1 || useradd --system --home /var/lib/dilib-agent --shell /usr/sbin/nologin dilib-agent
|
|
install -d -o dilib-agent -g dilib-agent -m 750 /var/lib/dilib-agent /var/lib/dilib-flower
|
|
install -d -o root -g dilib-agent -m 750 /etc/dilib-agent
|
|
python3 -m venv .venv-agent
|
|
.venv-agent/bin/pip install -r agent/requirements.txt
|
|
if [[ ! -f /etc/dilib-agent/agent.env ]]; then
|
|
install -m 640 -o root -g dilib-agent agent/.env.example /etc/dilib-agent/agent.env
|
|
fi
|
|
install -m 644 deploy/systemd/dilib-agent.service /etc/systemd/system/
|
|
systemctl daemon-reload
|
|
echo 'Configure agent.env and start: systemctl enable --now dilib-agent'
|