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

Proposed by Lucas Kanashiro
Status: Merged
Merged at revision: 050c24c35cfdff4ccb5eb17539d6ada8e90cb58c
Proposed branch: ~ubuntu-docker-images/ubuntu-docker-images/+git/prometheus:readme-template
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/prometheus:edge
Diff against target: 223 lines (+126/-37)
2 files modified
oci/README.md (+124/-35)
oci/examples/README.md (+2/-2)
Reviewer Review Type Date Requested Status
Lucas Kanashiro Approve
Sergio Durigan Junior Needs Fixing
Review via email: mp+393915@code.launchpad.net

Description of the change

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
diff --git a/oci/README.md b/oci/README.md
index e5d8126..5679e90 100644
--- a/oci/README.md
+++ b/oci/README.md
@@ -1,66 +1,152 @@
1# Ubuntu Prometheus OCI image1# Prometheus | Ubuntu
22
3This OCI image was built based on the upstream one (prom/prometheus). Prometheus 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.3## About Prometheus
44
5As an initial attempt to not require Internet access to build the image the following was changed:5Prometheus is a systems and service monitoring system. It collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some condition is observed to be true. Read more on the [Prometheus website](https://prometheus.io/).
66
7* 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.7## Tags
88
9There is no change that should impact users.9* `2.20.1`, `2.20`, `2`, `beta` - **/!\ this is a beta release**
10
11## Versions supported
12
13* `edge` = `2.20.1`
1410
15## Architectures supported11## Architectures supported
1612
17* amd6413* `amd64`, `arm64`, `ppc64el`, `s390x`
18* arm64
19* ppc64el
20* s390x
2114
22## Usage15## Usage
2316
24To get this image run:17### Docker CLI
2518
26```19```sh
27$ docker pull squeakywheel/prometheus:edge20$ docker run --name prometheus -e TZ=UTC -d squeakywheel/prometheus:edge
28```21```
2922
30Prometheus command line can be called like this:23Since 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:
3124
25```sh
26$ docker run --name prometheus -v /path/to/persisted/data:/prometheus -e TZ=UTC -d squeakywheel/prometheus:edge
32```27```
33$ docker run squeakywheel/prometheus:edge -h
34```
3528
36The command above will display the output of the `prometheus -h`.29**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.
30
31#### Parameters
32
33| Parameter | Description |
34|---|---|
35| `-e TZ=UTC` | Timezone. |
36| `-v /path/to/persisted/data:/prometheus` | Pass the directory used to persist the data. |
37| `-v /path/to/prometheus/config/file/prometheus.yml:/etc/prometheus/prometheus.yml` | Pass a custom config file. |
38| `-v /path/to/prometheus/config/file/alerts.yml:/etc/prometheus/alerts.yml` | Pass a custom alerts config file. |
39
40
41#### Testing/Debugging
3742
38Since containers are ephemeral you might be interested in persist data and not initialize a new TSDB database every time you launch a new container. To do that you can use docker volumes:43In 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:
3944
40```45```
41$ docker run --name prometheus \46$ docker exec -it <name_of_the_container> /bin/bash
42 --volume /path/to/persisted/data:/prometheus \
43 squeakywheel/prometheus:edge
44```47```
4548
46Important 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.49### Deploy with Kubernetes
50
51You can use your favorite Kubernetes distribution; if you don't have one, consider [installing MicroK8s](https://microk8s.io/).
4752
48You can also pass your own configuration files to the container doing the following:53With microk8s running, enable the `dns` and `storage` add-ons:
54```sh
55$ microk8s enable dns storage
56 ```
4957
58Create a configmap for the configuration files (check the upstream documentation [here](https://prometheus.io/docs/prometheus/2.20/getting_started/)):
59
60```sh
61$ microk8s kubectl create configmap prometheus-config --from-file=prometheus=config/prometheus.yml --from-file=prometheus-alerts=config/alerts.yml
50```62```
51$ docker run --name prometheus \63
52 --volume /path/to/prometheus/config/file/prometheus.yml:/etc/prometheus/prometheus.yml64Use the sample deployment yaml provided [here](https://git.launchpad.net/~canonical-server/ubuntu-server-oci/+git/prometheus/plain/examples/prometheus-deployment.yml).
53 --volume /path/to/prometheus/config/file/alerts.yml:/etc/prometheus/alerts.yml65
54 squeakywheel/prometheus:edge66<details>
67 <summary>Apply the `prometheus-deployment.yml` (click to expand)</summary>
68
69```yaml
70# prometheus-deployment.yml
71---
72apiVersion: v1
73kind: PersistentVolumeClaim
74metadata:
75 name: prometheus-volume-claim
76spec:
77 accessModes:
78 - ReadWriteOnce
79 storageClassName: microk8s-hostpath
80 resources:
81 requests:
82 storage: 500M
83---
84apiVersion: apps/v1
85kind: Deployment
86metadata:
87 name: prometheus-deployment
88spec:
89 replicas: 1
90 selector:
91 matchLabels:
92 app: prometheus
93 template:
94 metadata:
95 labels:
96 app: prometheus
97 spec:
98 containers:
99 - name: prometheus
100 image: squeakywheel/prometheus:edge
101 volumeMounts:
102 - name: prometheus-config-volume
103 mountPath: /etc/prometheus/prometheus.yml
104 subPath: prometheus.yml
105 - name: prometheus-config-volume
106 mountPath: /etc/prometheus/alerts.yml
107 subPath: alerts.yml
108 - name: prometheus-data
109 mountPath: /prometheus
110 ports:
111 - containerPort: 9090
112 name: prometheus
113 protocol: TCP
114 volumes:
115 - name: prometheus-config-volume
116 configMap:
117 name: prometheus-config
118 items:
119 - key: prometheus
120 path: prometheus.yml
121 - key: prometheus-alerts
122 path: alerts.yml
123 - name: prometheus-data
124 persistentVolumeClaim:
125 claimName: prometheus-volume-claim
126---
127apiVersion: v1
128kind: Service
129metadata:
130 name: prometheus-service
131spec:
132 type: NodePort
133 selector:
134 app: prometheus
135 ports:
136 - protocol: TCP
137 port: 9090
138 targetPort: 9090
139 nodePort: 30090
140 name: prometheus
55```141```
56142
57In 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:143</details>
58144
59```145```sh
60$ docker exec -it <name_of_the_container> /bin/bash146$ microk8s kubectl apply -f prometheus-deployment.yml
61```147```
62148
63To see how to use the Prometheus OCI image with `docker-compose` and `microk8s` check the `examples/README.md` file.149You will now be able to connect to the Prometheus on `http://localhost:30090`.
64150
65## Bugs and Features request151## Bugs and Features request
66152
@@ -72,6 +158,9 @@ In the title of the bug add `prometheus: <reason>`.
72158
73Make sure to include:159Make sure to include:
74160
75* The tag of the image you are using161* 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:
162```sh
163$ docker images --no-trunc --quiet squeakywheel/prometheus:<tag>
164```
76* Reproduction steps for the deployment165* Reproduction steps for the deployment
77* If it is a feature request, please provide as much detail as possible166* If it is a feature request, please provide as much detail as possible
diff --git a/oci/examples/README.md b/oci/examples/README.md
index 9377185..eed65b5 100644
--- a/oci/examples/README.md
+++ b/oci/examples/README.md
@@ -36,10 +36,10 @@ $ microk8s kubectl create configmap prometheus-config \
36 --from-file=prometheus-alerts=config/alerts.yml36 --from-file=prometheus-alerts=config/alerts.yml
37```37```
3838
39Apply the `microk8s-deployments.yml`:39Apply the `prometheus-deployment.yml`:
4040
41```41```
42$ microk8s kubectl apply -f microk8s-deployments.yml42$ microk8s kubectl apply -f prometheus-deployment.yml
43```43```
4444
45Access `http://localhost:30090` and Prometheus will be running.45Access `http://localhost:30090` and Prometheus will be running.
diff --git a/oci/examples/microk8s-deployments.yml b/oci/examples/prometheus-deployment.yml
46similarity index 100%46similarity index 100%
47rename from oci/examples/microk8s-deployments.yml47rename from oci/examples/microk8s-deployments.yml
48rename to oci/examples/prometheus-deployment.yml48rename to oci/examples/prometheus-deployment.yml

Subscribers

People subscribed via source and target branches