From 365e09a77c5e6c17b7e12905fe8f1874fae35861 Mon Sep 17 00:00:00 2001 From: Christian Elberfeld <6413499+elberfeld@users.noreply.github.com> Date: Sun, 12 May 2024 00:04:16 +0200 Subject: [PATCH] change dockerstats to default cotainer --- common/docker_dockerstats/tasks/main.yml | 1 - .../docker_dockerstats/templates/Dockerfile | 19 ------------------- .../templates/docker-compose.yml | 10 ++++++---- site.yml | 12 ++++++++---- 4 files changed, 14 insertions(+), 28 deletions(-) delete mode 100644 common/docker_dockerstats/templates/Dockerfile diff --git a/common/docker_dockerstats/tasks/main.yml b/common/docker_dockerstats/tasks/main.yml index dbc65c10..18547002 100644 --- a/common/docker_dockerstats/tasks/main.yml +++ b/common/docker_dockerstats/tasks/main.yml @@ -14,7 +14,6 @@ src: "{{ item }}" dest: "{{ basedir }}/{{ item }}" with_items: - - Dockerfile - docker-compose.yml diff --git a/common/docker_dockerstats/templates/Dockerfile b/common/docker_dockerstats/templates/Dockerfile deleted file mode 100644 index 793b7781..00000000 --- a/common/docker_dockerstats/templates/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM node:21-alpine - -RUN apk update \ - && apk upgrade \ - && apk add --no-cache git - -RUN mkdir -p /usr/src/app \ - && cd /usr/src/app \ - && git clone https://github.com/elberfeld/docker_stats_exporter.git \ - && cd /usr/src/app/docker_stats_exporter \ - && git checkout 2020.07.30.1 \ - && npm install - -WORKDIR /usr/src/app/docker_stats_exporter - -EXPOSE 9487 -ENV DOCKERSTATS_PORT=9487 DOCKERSTATS_INTERVAL=15 DEBUG=0 - -ENTRYPOINT [ "npm", "start" ] diff --git a/common/docker_dockerstats/templates/docker-compose.yml b/common/docker_dockerstats/templates/docker-compose.yml index d126e20b..cac91491 100644 --- a/common/docker_dockerstats/templates/docker-compose.yml +++ b/common/docker_dockerstats/templates/docker-compose.yml @@ -4,12 +4,14 @@ services: app: - build: . + image: wywywywy/docker_stats_exporter restart: always ports: - - "{{ int_ip4 }}:9487:9487" + - "{{ int_ip4 }}:{{ metrics_port }}:{{ metrics_port }}" volumes: - /var/run/docker.sock:/var/run/docker.sock - /usr/bin/docker:/usr/bin/docker - labels: - - com.centurylinklabs.watchtower.enable=false + environment: + DOCKERSTATS_PORT: {{ metrics_port }} + DOCKERSTATS_INTERVAL: 15 + DEBUG: 0 diff --git a/site.yml b/site.yml index e2cec181..7c50784e 100644 --- a/site.yml +++ b/site.yml @@ -99,7 +99,8 @@ - { role: common/docker_dockerstats, tags: dockerstats, servicename: dockerstats, - basedir: /srv/dockerstats + basedir: /srv/dockerstats, + metrics_port: 9487 } - { role: common/docker_traefik, tags: traefik, @@ -193,7 +194,8 @@ - { role: common/docker_dockerstats, tags: dockerstats, servicename: dockerstats, - basedir: /srv/dockerstats + basedir: /srv/dockerstats, + metrics_port: 9487 } - { role: common/docker_ldap, tags: ldap, @@ -310,7 +312,8 @@ - { role: common/docker_dockerstats, tags: dockerstats, servicename: dockerstats, - basedir: /srv/dockerstats + basedir: /srv/dockerstats, + metrics_port: 9487 } - { role: common/docker_traefik, tags: traefik, @@ -380,7 +383,8 @@ - { role: common/docker_dockerstats, tags: dockerstats, servicename: dockerstats, - basedir: /srv/dockerstats + basedir: /srv/dockerstats, + metrics_port: 9487 } - { role: common/docker_traefik, tags: traefik, -- GitLab