- Install the cli
curl -s -L https://releases.hoop.dev/release/install-cli.sh | sh
- Create the systemd unit
Make sure to create the token in your local machine (
hoop admin create agent linux-vm
) and change the mysql configuration
cat - >/etc/systemd/system/hoopagent.service <<EOF
[Unit]
Description=Hoop Agent
After=network.target
[Service]
ExecStart=hoop start agent
Environment="HOME=/root"
Environment="HOOP_TOKEN=<AGENT_TOKEN>"
Environment="HOOP_GRPCURL=app.hoop.dev:8443"
Environment='MYSQL_CONFIG={"HOST": "<HOST>", "PORT": "3306", "USER": "<USER>", "PASS": "<PASS>"}'
StandardOutput=true
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
EOF
- start the agent
systemctl daemon-reload
systemctl enable hoopagent.service
systemctl start hoopagent
Make sure to install a mysql client, on ubuntu:
apt-get update -y && apt-get install -y default-mysql-client
- Login
hoop login
- Enable the secretsmanager plugin
hoop admin create plugin secretsmanager \
--connection mysql-utm \
--source hoop/secretsmanager \
--overwrite
- Associate a new connection with the secrets manager plugin
hoop admin create connection mysql-utm --agent linux-vm \
-e HOST=envjson:MYSQL_CONFIG:HOST \
-e PORT=envjson:MYSQL_CONFIG:PORT \
-e USER=envjson:MYSQL_CONFIG:USER \
-e MYSQL_PWD=envjson:MYSQL_CONFIG:PASS \
--plugin secretsmanager \
--overwrite -- mysql -h '$HOST' --port '$PORT' -u '$USER'
- Connect it
hoop connect mysql-utm