Convert Netdata to a Compose stack, close #80

This commit is contained in:
Sam A. 2023-09-30 17:19:10 +02:00
parent 85aa718480
commit 728455f42a
Signed by untrusted user: samsapti
GPG key ID: CBBBE7371E81C4EA
2 changed files with 46 additions and 21 deletions

View file

@ -1,23 +1,12 @@
# vim: ft=yaml.ansible
---
- name: setup netdata docker container for system monitoring
docker_container:
name: netdata
image: netdata/netdata:{{ services.netdata.version }}
restart_policy: unless-stopped
hostname: "hevonen.servers.{{ base_domain }}"
capabilities:
- SYS_PTRACE
security_opts:
- apparmor:unconfined
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- name: external_services
env:
VIRTUAL_HOST : "{{ services.netdata.domain }}"
LETSENCRYPT_HOST: "{{ services.netdata.domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
PGID: "999"
- name: Upload Compose file for Netdata
template:
src: compose-files/netdata.yml.j2
dest: "{{ services.netdata.volume_folder }}/docker-compose.yml"
- name: Deploy Netdata
docker_compose:
project_src: "{{ services.netdata.volume_folder }}"
pull: true
state: present

View file

@ -0,0 +1,36 @@
# vim: ft=yaml.docker-compose
version: "3.8"
services:
app:
image: netdata/netdata:{{ services.netdata.version }}
restart: unless-stopped
hostname: hevonen.servers.{{ base_domain }}
volumes:
- "/proc:/host/proc:ro"
- "/sys:/host/sys:ro"
- "/etc/os-release:/host/etc/os-release:ro"
networks:
- default
- external_services
environment:
VIRTUAL_HOST : "{{ services.netdata.domain }}"
LETSENCRYPT_HOST: "{{ services.netdata.domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
PGID: "999"
DOCKER_HOST: "socket_proxy:2375"
cap_add:
- SYS_PTRACE
security_opt:
- apparmor:unconfined
socket_proxy:
image: tecnativa/docker-socket-proxy:latest
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
environment:
CONTAINERS: 1
networks:
external_services:
external: true