File tree Expand file tree Collapse file tree 9 files changed +107
-124
lines changed
.internal/templates/services/prometheus Expand file tree Collapse file tree 9 files changed +107
-124
lines changed Original file line number Diff line number Diff line change
1
+ # Download base image
2
+ FROM prom/prometheus:latest
3
+
4
+ USER root
5
+
6
+ # where IOTstack template files are stored
7
+ ENV IOTSTACK_DEFAULTS_DIR="iotstack_defaults"
8
+ ENV IOTSTACK_CONFIG_DIR="/prometheus/config/"
9
+
10
+ # copy template files to image
11
+ COPY --chown=nobody:nobody ${IOTSTACK_DEFAULTS_DIR} /${IOTSTACK_DEFAULTS_DIR}
12
+
13
+ # add default config from image to template
14
+ RUN cp /etc/prometheus/prometheus.yml /${IOTSTACK_DEFAULTS_DIR}
15
+
16
+ # replace the docker entry-point script
17
+ ENV IOTSTACK_ENTRY_POINT="docker-entrypoint.sh"
18
+ COPY ${IOTSTACK_ENTRY_POINT} /${IOTSTACK_ENTRY_POINT}
19
+ RUN chmod 755 /${IOTSTACK_ENTRY_POINT}
20
+ ENTRYPOINT ["/docker-entrypoint.sh" ]
21
+ ENV IOTSTACK_ENTRY_POINT=
22
+
23
+ USER nobody
24
+
25
+ # EOF
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/ash
2
+ set -e
3
+
4
+ # set defaults for config structure ownership
5
+ UID=" ${IOTSTACK_UID:- nobody} "
6
+ GID=" ${IOTSTACK_GID:- nobody} "
7
+
8
+ # were we launched as root?
9
+ if [ " $( id -u) " = " 0" -a -d /" $IOTSTACK_DEFAULTS_DIR " ]; then
10
+
11
+ # yes! ensure that the IOTSTACK_CONFIG_DIR exists
12
+ mkdir -p " $IOTSTACK_CONFIG_DIR "
13
+
14
+ # populate runtime directory from the defaults
15
+ for P in /" $IOTSTACK_DEFAULTS_DIR " /* ; do
16
+
17
+ C=$( basename " $P " )
18
+
19
+ if [ ! -e " $IOTSTACK_CONFIG_DIR /$C " ] ; then
20
+
21
+ cp -a " $P " " $IOTSTACK_CONFIG_DIR /$C "
22
+
23
+ fi
24
+
25
+ done
26
+
27
+ # enforce correct ownership
28
+ chown -R " $UID " :" $GID " " $IOTSTACK_CONFIG_DIR "
29
+
30
+ fi
31
+
32
+ # launch prometheus with supplied arguments
33
+ exec /bin/prometheus " $@ "
Original file line number Diff line number Diff line change
1
+ global :
2
+ scrape_interval : 10s
3
+ evaluation_interval : 10s
4
+
5
+ scrape_configs :
6
+ - job_name : " iotstack"
7
+ static_configs :
8
+ - targets :
9
+ - localhost:9090
10
+ - cadvisor:8080
11
+ - nodeexporter:9100
12
+
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
prometheus :
2
2
container_name : prometheus
3
- image : prom/ prometheus:latest
3
+ build : ./.templates/ prometheus/.
4
4
restart : unless-stopped
5
5
user : " 0"
6
6
ports :
7
7
- " 9090:9090"
8
+ environment :
9
+ - IOTSTACK_UID=1000
10
+ - IOTSTACK_GID=1000
8
11
volumes :
9
- - ./services/prometheus/config.yml:/etc/prometheus/config.yml
10
- - ./volumes/prometheus/data:/data
12
+ - ./volumes/prometheus/data:/prometheus
11
13
command :
12
- - ' --config.file=/etc/prometheus/config.yml'
13
- - ' --storage.tsdb.path=/data'
14
+ - ' --config.file=/prometheus/config/config.yml'
15
+ # defaults are:
16
+ # - --config.file=/etc/prometheus/prometheus.yml
17
+ # - --storage.tsdb.path=/prometheus
18
+ # - --web.console.libraries=/usr/share/prometheus/console_libraries
19
+ # - --web.console.templates=/usr/share/prometheus/consoles
20
+ depends_on :
21
+ - cadvisor
22
+ - nodeexporter
23
+ networks :
24
+ - iotstack_nw
25
+
26
+ cadvisor :
27
+ container_name : cadvisor
28
+ image : zcube/cadvisor:latest
29
+ restart : unless-stopped
30
+ ports :
31
+ - " 8082:8080"
32
+ volumes :
33
+ - /:/rootfs:ro
34
+ - /var/run:/var/run:rw
35
+ - /sys:/sys:ro
36
+ - /var/lib/docker/:/var/lib/docker:ro
37
+ networks :
38
+ - iotstack_nw
39
+
40
+ nodeexporter :
41
+ container_name : nodeexporter
42
+ image : prom/node-exporter:latest
43
+ restart : unless-stopped
44
+ expose :
45
+ - " 9100"
14
46
networks :
15
47
- iotstack_nw
You can’t perform that action at this time.
0 commit comments