Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🎸 add README.md #15

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ go.work

heimdall
dist/
main
185 changes: 182 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,184 @@
## Using Docker Desktop
Run this command to create a symlink to the docker.sock file:
<div align="center">
<a href="https://hermes.fractum.nl">
<img src="public/logo.png" alt="Logo" width="80" height="80">
</a>
<h1>Heimdall</h1>
<p><i>Docker container state monitor with notifications for Discord</i></p>
</div>

<!-- TOC -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#about-heimdall">About Heimdall</a>
</li>
<li>
<a href="#features">Features</a>
</li>
<li>
<a href="#usage">Usage</a>
<ul>
<li><a href="#docker-container">Docker container</a></li>
<ul>
<li><a href="#using-docker-desktop-1">Using Docker Desktop</a></li>
</ul>
<li><a href="#standalone-application">Standalone application</a></li>
<ul>
<li><a href="#using-docker-desktop-2">Using Docker Desktop</a></li>
</ul>
</ul>
</li>
<li>
<a href="#technologies">Technologies</a>
<ul>
<li><a href="#language">Language</a></li>
<li><a href="#deployed-to">Deployed to</a></li>
<li><a href="#ci--cd">CI/CD</a></li>
<li><a href="#released-using">Released using</a></li>
<li><a href="#logo-created-using">Logo created using</a></li>
</ul>
</li>
<li>
<a href="#screenshots">Screenshots</a>
</li>
</ol>
</details>
<!-- TOC -->

## 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=<your-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=<your-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=<your-webhook-url>
```

On Windows you can run it by executing the following command:
```bash
heimdall.exe --webhook-url=<your-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
``
```

## 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+Ew8Mt87PTE1DMz7SVbmau9zLYqUWWscuzV6660qTekmmaLELJHK1LxYwnMcD44j0eyzdGWzYP9lMhlk0qlMWkhEE4mINzrn7w3PTr3tcva+QttHrkaZq1FEoTda7zSZbU8bKxpb5CqdRMSLRHRHuvsaxdFD9FSWvJVNxOaTfo9zbGZ8aK/PN/4bUiawFoXWcrLMZK3bqjNYH9OXVd5RoitXUdis5ayi9kbmZoSQb/z9YMDzQ8/IwNv00HwxDxariKGyrvVvjOaaRzRGq0MqU5IGxT5azDUu30M5lA0Hpty+yeHnfW733lhs1l1ISsHbKBSKKkttyz9YqlsflCs1JZyIzyuTIgTpVJyiRQReQmB1DYvCDcl4NDE93n/IOzbwnUDAe3Y1casrotdr6yz2H5MSnSwXrsxdlhgL4inQIWQEqGx1SCcFxCfckIrlC0l/DYvwIOMb63tncmzo4WBwciyfqLynKBR6m7nW/mxFTVsneUKyHIEymTTS9BEpFJCoNeB4HopyK5Ip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WsWZx5Fy6traxr2a03Wh7VGCu3K1T6v4g2rNiF/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)
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Loading
Loading