Skip to content

Commit

Permalink
Use launchctl service to run monitoring services (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
remi committed May 4, 2023
1 parent 4d987ca commit 0105940
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
19 changes: 18 additions & 1 deletion monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,24 @@ $ colima start
## Configuration

- Download the _monitoring_ folder from this repo to the machine.

```
$ scp -r monitoring admin@<HOST_IP>:grafana
```

- Replace the HOST_URL and the MACHINE_NAME in promtail's configuration files.
- Replace the HOST_URL in the `docker-compose.yaml`
- Launch all components with `docker compose up -d`

## Start the Containers

On the remote machine, install the service and launch it.

```
$ sudo chown root:wheel launch.sh
$ sudo cp com.mirego.ekiden-monitoring.plist /Library/LaunchDaemons
$ sudo launchctl load -w /Library/LaunchDaemons/com.mirego.ekiden-monitoring.plist
```

## Post-Launch Configuration

- _Optionally_ import the pre-built dashboard in the _grafana_ folder
26 changes: 26 additions & 0 deletions monitoring/com.mirego.ekiden-monitoring.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.mirego.ekiden-monitoring</string>
<key>LaunchOnlyOnce</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>/Users/admin/grafana/launch.sh</string>
</array>
<key>UserName</key>
<string>admin</string>
<key>WorkingDirectory</key>
<string>/Users/admin/grafana</string>
<key>StandardErrorPath</key>
<string>/Users/admin/grafana/stderr</string>
<key>StandardOutPath</key>
<string>/Users/admin/grafana/stdout</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion monitoring/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- ./grafana/:/var/lib/grafana
environment:
GF_SERVER_ROOT_URL: http://HOST_URL:3000

loki:
image: grafana/loki:2.6.1
ports:
Expand Down
4 changes: 4 additions & 0 deletions monitoring/launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

colima start
docker-compose up

0 comments on commit 0105940

Please sign in to comment.