diff --git a/.gitignore b/.gitignore index 8594faf..000402a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ go.work heimdall dist/ +main \ No newline at end of file diff --git a/README.md b/README.md index c9eae6b..a185fcb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,184 @@ -## Using Docker Desktop -Run this command to create a symlink to the docker.sock file: +
+ + Logo + +

Heimdall

+

Docker container state monitor with notifications for Discord

+
+ + +
+ Table of Contents +
    +
  1. + About Heimdall +
  2. +
  3. + Features +
  4. +
  5. + Usage + +
  6. +
  7. + Technologies + +
  8. +
  9. + Screenshots +
  10. +
+
+ + +## About Heimdall +Heimdall is a monitoring application for your Docker containers. It sends you notifications through a webhook whenever the state of a container changes. +It does this by using the Docker socket to listen for events. Heimdall also provides the option to receive periodic notifications about the state of your containers, where it sends you an overview of every container's status. + +## Features +- [x] Easy monitoring for Docker containers +- [x] Receive notifications through Discord webhooks +- [x] Receive periodic notifications about the state of your containers +- [ ] Status API +- [ ] Web UI +- [ ] Bugs (hopefully) + +## Usage +Heimdall can be used in a couple different ways: +1. As a Docker container +2. As a standalone application + +### Docker container +The easiest way to use Heimdall is by running it as a Docker container. You can do this by running the following command: +```bash +docker run -d \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -e HEIMDALL_WEBHOOK_URL= \ + --name heimdall \ + drfractum/heimdall:latest +``` + +#### Using Docker Desktop +In some cases, Docker Desktop puts the Docker socket in a different location than the standard Docker installation. +You can change the above command to the following to point to the right location: +```diff +docker run -d \ +- -v /var/run/docker.sock:/var/run/docker.sock \ ++ -v ~/.docker/desktop/docker.sock:/var/run/docker.sock \ + -e HEIMDALL_WEBHOOK_URL= \ + --name heimdall \ + drfractum/heimdall:latest +``` + +### Standalone application +You can also run Heimdall as a standalone application. This is useful if you want to run it on a server or your local machine. +To run Heimdall as a standalone application, you can download the latest release from the [releases page](https://github.com/RobinHeidenis/heimdall/releases). + +Be sure to download the right binary for your operating system. + +| Platform | Binary | +|----------------------------------------------------------------------------------------------------------|-------------------------| +| ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) | heimdall_Linux_x86_64 | +| ![Raspberry Pi](https://img.shields.io/badge/-RaspberryPi-C51A4A?style=for-the-badge&logo=Raspberry-Pi) | heimdall_Linux_armv7 | +| ![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white) | heimdall_Windows_x86_64 | +| ![macOS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge&logo=macos&logoColor=F0F0F0) | heimdall_Darwin_x86_64 | + +Other binaries are available in case you have a different architecture or operating system. +Other binaries are available in case you have a different architecture or operating system. + + +After downloading the release, you can run it by executing the following command: +```bash +./heimdall --webhook-url= +``` + +On Windows you can run it by executing the following command: +```bash +heimdall.exe --webhook-url= +``` + +#### Using Docker Desktop +In some cases if you're using Docker Desktop, you might run into an error where Heimdall can't connect to the Docker socket. +By default, Docker Desktop puts the Docker socket in a different location than the standard Docker installation. +If Heimdall doesn't automatically detect your environment and the right location for the Docker socket, you'll need to create a symlink to the docker.sock file. You can do this by running the following command: ```bash sudo ln -s ~/.docker/desktop/docker.sock /var/run/docker.sock -`` \ No newline at end of file +``` + +## Customisation +Heimdall can be customised by using the following environment variables: + +| Long flag | Short flag | Environment Variable | Default | Required | Explanation | +|---------------------------|------------|----------------------------------|-----------|--------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| +| `--periodic-notification` | `-n` | `HEIMDALL_PERIODIC_NOTIFICATION` | `false` | No | Enable periodic notifications | +| `--notification-interval` | `-i` | `HEIMDALL_NOTIFICATION_INTERVAL` | `60` | Only if periodic notifications are enabled and you want a different value than default | How often (in minutes) periodic notifications should be sent | +| `--all-containers` | `-a` | `HEIMDALL_ALL_CONTAINERS` | `false` | Only if periodic notifications are enabled and you want periodic notifications on all containers | Enable periodic notification reporting on all containers, including stopped ones | +| `--retry` | `-r` | `HEIMDALL_RETRY` | `10` | No | How long Heimdall should sleep before retrying in case the Docker event stream ends unexpectedly | +| `--provider` | `-p` | `HEIMDALL_PROVIDER` | `discord` | No | What notification provider should be used. Possible values: `discord` | +| `--webhook-url` | `-w` | `HEIMDALL_WEBHOOK_URL` | - | Yes | What URL Heimdall should use to send notifications to | +| `--debug` | `-d` | `HEIMDALL_DEBUG` | `false` | No | Enable extra debug messages | + + +## Technologies +Heimdall was created using Go. The CI/CD pipeline is handled by GitHub Actions and the Docker image is hosted on Docker Hub. + +The program is mostly based on the [Docker SDK for Go](https://pkg.go.dev/github.com/docker/docker/client#section-readme) + +It uses the following technologies: +### Language +[![Go](https://img.shields.io/badge/go-%2300ADD8.svg?style=for-the-badge&logo=go&logoColor=white)](https://go.dev) + +### Deployed to +[![Docker](https://img.shields.io/badge/docker-%231d63ed.svg?style=for-the-badge&logo=docker&logoColor=white)](https://hub.docker.com/r/drfractum/heimdall) + +### CI/CD +[![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)](https://github.com/RobinHeidenis/heimdall/actions) + +### Released using +[![GoReleaser](https://img.shields.io/badge/goreleaser-%23000.svg?style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAQX0lEQVRoQ7VaCXCb5Zl+fv26JeuwJFuSbfmSrfiKcye4HMkCbZfQMlzmmG1LSzvAljLATDs7u53uDttlm93Z7bS06TXp9gqF7W6XKyRQAgQIcRySOImJr1i2JVu2JcuSLOv6de37yTFxHMuSk/ZjxEys73+/772e93nfXxz+fEtEomQ6XY1MpORLkOFKOKTVIi4lA8RcOp1JZjlxWMal5yN8MhyemIjR/gR90n+OK3DXKIQ9rzVabPVKlb5JKlNslMlVjbxUVi2RKkp4XqzgRCIxwCGbzaTTqWQsLcQjqWTCIyQT/YlY+Ew8Mt87PTE1DMz7SVbmau9zLYqUWWscuzV6660qTekmmaLELJHK1LxYwnMcD44j0eyzdGWzYP9lMhlk0qlMWkhEE4mINz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4DJP4As37SkvoTS5xq2Akg64BAX86r0M4KsbnQ07sVIoxHE9gPw1ZI+X1xQ0YluUIQynfxOCJidG+rwa841e8vcqbBypdWXtV9brvU77cJJVfUmapFViy89koDArKC2V6QRG6/HSE6AgbxoV8uD/mAmNNb6TlGDNSN01hVWjktNxTDOZnPMMfT4yee2rW63mLvr+iSVk1oXU6S7W5uuGXZbZ1u6Ry1Yp7mTKXUIO9RV8YyjFCx00MwhINYFJHHaDeAhF7DVEkcVhUhr3Gm/Fc6J0YG/ja7PRoN/19xWFaQWRinqmoWfes2bbuFgozuknBR3J3YArSrxxy1bzQWGelXGH2oRxMUzid9oz2//2s13U4nxKXDJkv6y7+XU7DL3N53ZMmq/0+tdZkzr3g+QsuBrHR+dmAf9J5aGba/T3KCTZxX3WsWZx5Fy6traxr2a03Wh7VGCu3K1T6v4g2rNiF/J7+4MzET8YGe/6Hzp0uxmZrUWRRnsFsrXnCWNHwDYOlTl+ozyjqEpRT9CMBBL3uqNfd/7sJ1+Aees5ZzLOLe65GEfYsg+Tm6ob2To3BcrNKa7JT/uh4XiKh9nThNymrzHAZELDZFdUFun9sLjLvd80Hpt73uAdejIXDJ0g2FY+1ratVZPEUsVyuqyi1lLcrFZrNUoWmXSJTVJNSRrFUqhKJiFBxHPXPlLmU+zS7EugnQRGaHQeERMwVj4bPCZHQqeC8ryc8MzNGQgkdrm5dqyJLPStXq81qhY76ALHMkMpmjTwnMtLbXuqWaEKdpReO6fQsDbi9WZEwG4oEghGvl/1gJkqf1YdXRej2/7tsyvMgscqKAAAAAElFTkSuQmCC)](https://goreleaser.com) + +### Logo created using +[![Bing Image Creator](https://img.shields.io/badge/bing%20image%20creator-%230078D4.svg?style=for-the-badge&logo=microsoftbing&logoColor=white)](https://www.bing.com/images/create) + + +## Screenshots +### Terminal output +![logo.png](public/terminal-output.png) + +### Discord notifications +#### Container started +![container-started.png](public/container-started.png) + +#### Container stopped +![container-stopped.png](public/container-stopped.png) + +#### Container healthy +![container-healthy.png](public/container-healthy.png) + +#### Container unhealthy +![container-unhealthy.png](public/container-unhealthy.png) + +#### Container errored +![container-errored.png](public/container-errored.png) + +### Periodic notification +#### Running containers +![container-list.png](public/container-list.png) + +#### All containers +![container-list-all.png](public/container-list-all.png) diff --git a/go.mod b/go.mod index 1028b69..fe4db85 100644 --- a/go.mod +++ b/go.mod @@ -17,18 +17,18 @@ require ( github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/mattn/go-runewidth v0.0.13 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/moby/term v0.5.0 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/rivo/uniseg v0.2.0 // indirect + github.com/rivo/uniseg v0.4.4 // indirect github.com/stretchr/testify v1.8.4 // indirect - golang.org/x/mod v0.8.0 // indirect - golang.org/x/net v0.6.0 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/time v0.4.0 // indirect - golang.org/x/tools v0.6.0 // indirect + golang.org/x/tools v0.16.0 // indirect gotest.tools/v3 v3.5.1 // indirect ) diff --git a/go.sum b/go.sum index 832474c..63f225d 100644 --- a/go.sum +++ b/go.sum @@ -29,6 +29,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= @@ -48,6 +50,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= +github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -63,12 +67,16 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -80,6 +88,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.4.0 h1:Z81tqI5ddIoXDPvVQ7/7CC9TnLM7ubaFG2qXYd5BbYY= @@ -90,6 +100,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/heimdall/discord.go b/pkg/heimdall/discord.go index f98c319..bb175bf 100644 --- a/pkg/heimdall/discord.go +++ b/pkg/heimdall/discord.go @@ -15,9 +15,10 @@ func New(webhookURL string) *DiscordProvider { } } +var AvatarUrl = "https://github.com/RobinHeidenis/heimdall/blob/52fe5004e0e254d2e24e574807f4879b494024fc/public/logo.png?raw=true" +var BotName = "Heimdall" + func (p DiscordProvider) SendPeriodicContainerStatusUpdate(updateTable string) { - username := "Heimdall" - avatarUrl := "https://neellik.com/wp-content/uploads/2022/03/heimdall.png" authorName := "Docker Container Status" authorIconUrl := "https://www.docker.com/wp-content/uploads/2023/04/cropped-Docker-favicon-32x32.png" title := "Periodic status update" @@ -35,8 +36,8 @@ func (p DiscordProvider) SendPeriodicContainerStatusUpdate(updateTable string) { }} message := discordwebhook.Message{ - Username: &username, - AvatarUrl: &avatarUrl, + Username: &BotName, + AvatarUrl: &AvatarUrl, Embeds: &embeds, } @@ -139,12 +140,9 @@ func makeWebhookMessage(event ContainerEvent) discordwebhook.Message { Color: &embedColor, }} - username := "Heimdall" - avatarUrl := "https://neellik.com/wp-content/uploads/2022/03/heimdall.png" - return discordwebhook.Message{ Embeds: &embeds, - Username: &username, - AvatarUrl: &avatarUrl, + Username: &BotName, + AvatarUrl: &AvatarUrl, } } diff --git a/public/container-errored.png b/public/container-errored.png new file mode 100644 index 0000000..295645f Binary files /dev/null and b/public/container-errored.png differ diff --git a/public/container-healthy.png b/public/container-healthy.png new file mode 100644 index 0000000..49fe5be Binary files /dev/null and b/public/container-healthy.png differ diff --git a/public/container-list-all.png b/public/container-list-all.png new file mode 100644 index 0000000..ff6f787 Binary files /dev/null and b/public/container-list-all.png differ diff --git a/public/container-list.png b/public/container-list.png new file mode 100644 index 0000000..7a5020b Binary files /dev/null and b/public/container-list.png differ diff --git a/public/container-started.png b/public/container-started.png new file mode 100644 index 0000000..e50c41c Binary files /dev/null and b/public/container-started.png differ diff --git a/public/container-stopped.png b/public/container-stopped.png new file mode 100644 index 0000000..e7f87a5 Binary files /dev/null and b/public/container-stopped.png differ diff --git a/public/container-unhealthy.png b/public/container-unhealthy.png new file mode 100644 index 0000000..1dd96ab Binary files /dev/null and b/public/container-unhealthy.png differ diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 0000000..0cb8024 Binary files /dev/null and b/public/logo.png differ diff --git a/public/terminal-output.png b/public/terminal-output.png new file mode 100644 index 0000000..d33df6f Binary files /dev/null and b/public/terminal-output.png differ