File tree Expand file tree Collapse file tree 9 files changed +103
-70
lines changed Expand file tree Collapse file tree 9 files changed +103
-70
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.
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+
Original file line number Diff line number Diff line change 11 prometheus :
22 container_name : prometheus
3- image : prom/ prometheus:latest
3+ build : ./.templates/ prometheus/.
44 restart : unless-stopped
55 user : " 0"
66 ports :
7- - 9090:9090
8- env_file :
9- - ./services/prometheus/prometheus.env
10- depends_on :
7+ - " 9090:9090"
8+ environment :
9+ - IOTSTACK_UID=1000
10+ - IOTSTACK_GID=1000
1111 volumes :
12- - ./services/prometheus/config.yml:/etc/prometheus/config.yml
13- - ./volumes/prometheus/data:/data
12+ - ./volumes/prometheus/data:/prometheus
1413 command :
15- - ' --config.file=/etc/prometheus/config.yml'
16- - ' --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
1723
24+ cadvisor :
25+ container_name : cadvisor
26+ image : zcube/cadvisor:latest
27+ restart : unless-stopped
28+ ports :
29+ - " 8082:8080"
30+ volumes :
31+ - /:/rootfs:ro
32+ - /var/run:/var/run:rw
33+ - /sys:/sys:ro
34+ - /var/lib/docker/:/var/lib/docker:ro
35+
36+ nodeexporter :
37+ container_name : nodeexporter
38+ image : prom/node-exporter:latest
39+ restart : unless-stopped
40+ expose :
41+ - " 9100"
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments