Merge ~ubuntu-docker-images/ubuntu-docker-images/+git/prometheus-alertmanager:readme-template into ~ubuntu-docker-images/ubuntu-docker-images/+git/prometheus-alertmanager:edge

Proposed by Lucas Kanashiro
Status: Merged
Merged at revision: 2a3135a1c111cbc4245965449e227b9e040a668a
Proposed branch: ~ubuntu-docker-images/ubuntu-docker-images/+git/prometheus-alertmanager:readme-template
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/prometheus-alertmanager:edge
Diff against target: 215 lines (+119/-36)
2 files modified
oci/README.md (+117/-34)
oci/examples/README.md (+2/-2)
Reviewer Review Type Date Requested Status
Lucas Kanashiro Approve
Sergio Durigan Junior Needs Fixing
Review via email: mp+393914@code.launchpad.net

Commit message

Make OCI doc files compliance with the defined template.

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks, Lucas. Just needs a few minor adjustments and it'll be good to go.

review: Needs Fixing
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Comments addressed, I am going to merge it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/oci/README.md b/oci/README.md
2index 715fd2e..8367dc5 100644
3--- a/oci/README.md
4+++ b/oci/README.md
5@@ -1,65 +1,145 @@
6-# Ubuntu Prometheus Alertmanager OCI image
7+# Prometheus Alertmanager | Ubuntu
8
9-This OCI image was built based on the upstream one (prom/alertmanager). Alertmanager in Ubuntu is supported as a snap package, so both are built from the same source. The Ubuntu Dockerfile differs a bit from upstream, instead of relying on the upstream Makefile to do the build and copy the binaries and needed file into the image, we do the build and test of the code during OCI build time.
10+## About Prometheus Alertmanager
11
12-As an initial attempt to not require Internet access to build the image the following was changed:
13+The Alertmanager handles alerts sent by client applications such as the Prometheus server. It takes care of deduplicating, grouping, and routing them to the correct receiver integration such as email, PagerDuty, or OpsGenie. It also takes care of silencing and inhibition of alerts. Read more on the [Prometheus Alertmanager website](https://prometheus.io/docs/alerting/latest/alertmanager/).
14
15-* Add the promu (tool used to build prometheus) binaries for the supported architectures to this repo to avoid downloading them from Github. Build promu from source was also considerd but it depends on itself (older version) to build, for now the binaries built from upstream are used.
16+## Tags
17
18-There is no change that should impact users.
19-
20-## Versions supported
21-
22-* `edge` = `0.21.0`
23+* `0.21.0`, `0.21`, `beta` - **/!\ this is a beta release**
24
25 ## Architectures supported
26
27-* amd64
28-* arm64
29-* ppc64el
30-* s390x
31+* `amd64`, `arm64`, `ppc64el`, `s390x`
32
33 ## Usage
34
35-To get this image run:
36+### Docker CLI
37
38-```
39-$ docker pull squeakywheel/prometheus-alertmanager:edge
40+```sh
41+$ docker run --name alertmanager -e TZ=UTC -d squeakywheel/prometheus-alertmanager:edge
42 ```
43
44-The prometheus-alertmanager OCI image contains the `amtool` tool that you can call it:
45+Since containers are ephemeral, you may want to use persistent data rather than initializing a new database for each newly launched container. To do this, you can use docker volumes:
46
47+```sh
48+$ docker run --name alertmanager -v /path/to/persisted/data:/alertmanager -e TZ=UTC -d squeakywheel/prometheus-alertmanager:edge
49 ```
50-$ docker run --entrypoint "/bin/amtool" squeakywheel/prometheus-alertmanager:edge -h
51-```
52
53-Pay attention that the default entrypoint is the `alertmanager` binary and not `amtool`, then we need to define it as a new entrypoint. The command above will display the output of the `amtool -h`.
54+**Important note**: the directory you will be using to persist the data needs to belong to `nogroup:nobody`. You can run `chown nogroup:nobody <path_to_persist_data>` before launching your container.
55+
56+#### Parameters
57+
58+| Parameter | Description |
59+|---|---|
60+| `-e TZ=UTC` | Timezone. |
61+| `-v /path/to/persisted/data:/alertmanager` | Pass the directory used to persist the data. |
62+| `-v /path/to/alertmanager/config/file/alertmanager.yml:/etc/prometheus/alertmanger.yml` | Pass a custom config file. |
63+
64+#### Testing/Debugging
65
66-Since containers are ephemeral you might be interested in persist data and not loose them every time you launch a new container. To do that you can use docker volumes:
67+In case you need to debug what it is happening with the container you can run `docker logs <name_of_the_container>`. To get access to an interactive shell run:
68
69 ```
70-$ docker run --name alertmanager \
71- --volume /path/to/persisted/data:/alertmanager \
72- squeakywheel/prometheus-alertmanager:edge
73+$ docker exec -it <name_of_the_container> /bin/bash
74 ```
75
76-Important note: the directory you will be using to persist the data needs to belong to `nogroup:nobody`. You can run `chown nogroup:nobody <path_to_persist_data>` before launching your container.
77+### Deploy with Kubernetes
78+
79+You can use your favorite Kubernetes distribution; if you don't have one, consider [installing MicroK8s](https://microk8s.io/).
80
81-You can also pass your own configuration file to the container doing the following:
82+With microk8s running, enable the `dns` and `storage` add-ons:
83+```sh
84+$ microk8s enable dns storage
85+ ```
86
87+Create a configmap for the configuration file (check the upstream documentation [here](https://prometheus.io/docs/alerting/latest/configuration/)):
88+
89+```sh
90+$ microk8s kubectl create configmap alertmanager-config --from-file=alertmanager=config/alertmanager.yml
91 ```
92-$ docker run --name alertmanager \
93- --volume /path/to/alertmanager/config/file/alertmanager.yml:/etc/prometheus/alertmanager.yml
94- squeakywheel/prometheus-alertmanager:edge
95+
96+Use the sample deployment yaml provided [here](https://git.launchpad.net/~canonical-server/ubuntu-server-oci/+git/prometheus-alertmanager/plain/examples/prometheus-alertmanager-deployment.yml).
97+
98+<details>
99+ <summary>Apply the `prometheus-alertmanager-deployment.yml` (click to expand)</summary>
100+
101+```yaml
102+# prometheus-alertmanager-deployment.yml
103+---
104+apiVersion: v1
105+kind: PersistentVolumeClaim
106+metadata:
107+ name: alertmanager-volume-claim
108+spec:
109+ accessModes:
110+ - ReadWriteOnce
111+ storageClassName: microk8s-hostpath
112+ resources:
113+ requests:
114+ storage: 500M
115+---
116+apiVersion: apps/v1
117+kind: Deployment
118+metadata:
119+ name: alertmanager-deployment
120+spec:
121+ replicas: 1
122+ selector:
123+ matchLabels:
124+ app: alertmanager
125+ template:
126+ metadata:
127+ labels:
128+ app: alertmanager
129+ spec:
130+ containers:
131+ - name: alertmanager
132+ image: squeakywheel/prometheus-alertmanager:edge
133+ volumeMounts:
134+ - name: alertmanager-config-volume
135+ mountPath: /etc/alertmanager/alertmanager.yml
136+ subPath: alertmanager.yml
137+ - name: alertmanager-data
138+ mountPath: /alertmanager
139+ ports:
140+ - containerPort: 9093
141+ name: alertmanager
142+ protocol: TCP
143+ volumes:
144+ - name: alertmanager-config-volume
145+ configMap:
146+ name: alertmanager-config
147+ items:
148+ - key: alertmanager
149+ path: alertmanager.yml
150+ - name: alertmanager-data
151+ persistentVolumeClaim:
152+ claimName: alertmanager-volume-claim
153+---
154+apiVersion: v1
155+kind: Service
156+metadata:
157+ name: alertmanager-service
158+spec:
159+ type: NodePort
160+ selector:
161+ app: alertmanager
162+ ports:
163+ - protocol: TCP
164+ port: 9093
165+ targetPort: 9093
166+ nodePort: 30093
167+ name: alertmanager
168 ```
169
170-In case you need to debug what it is happening with the container you can run `docker logs <name_of_the_container>`. But if you want to get access to an interactive shell run:
171+</details>
172
173-```
174-$ docker exec -it <name_of_the_container> /bin/bash
175+```sh
176+$ microk8s kubectl apply -f prometheus-alertmanager-deployment.yml
177 ```
178
179-To see how to use the Alertmanager OCI image with `docker-compose` and `microk8s` check the `examples/README.md` file.
180+You will now be able to connect to the Prometheus on `http://localhost:30093`.
181
182 ## Bugs and Features request
183
184@@ -71,6 +151,9 @@ In the title of the bug add `prometheus-alertmanager: <reason>`.
185
186 Make sure to include:
187
188-* The tag of the image you are using
189+* The digest of the image you are using, you can find it using this command replacing `<tag>` with the one you used to run the image:
190+```sh
191+$ docker images --no-trunc --quiet squeakywheel/prometheus-alertmanager:<tag>
192+```
193 * Reproduction steps for the deployment
194 * If it is a feature request, please provide as much detail as possible
195diff --git a/oci/examples/README.md b/oci/examples/README.md
196index d1d358d..7d7bc35 100644
197--- a/oci/examples/README.md
198+++ b/oci/examples/README.md
199@@ -35,10 +35,10 @@ $ microk8s kubectl create configmap alertmanager-config \
200 --from-file=alertmanager=config/alertmanager.yml
201 ```
202
203-Apply the `microk8s-deployments.yml`:
204+Apply the `prometheus-alertmanager-deployment.yml`:
205
206 ```
207-$ microk8s kubectl apply -f microk8s-deployments.yml
208+$ microk8s kubectl apply -f prometheus-alertmanager-deployment.yml
209 ```
210
211 Access `http://localhost:30093` and Alertmanager will be running.
212diff --git a/oci/examples/microk8s-deployments.yml b/oci/examples/prometheus-alertmanager-deployment.yml
213similarity index 100%
214rename from oci/examples/microk8s-deployments.yml
215rename to oci/examples/prometheus-alertmanager-deployment.yml

Subscribers

People subscribed via source and target branches

to all changes: