refactoring

This commit is contained in:
2024-05-07 16:54:47 +01:00
commit 75d305a03a
14 changed files with 443 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
version: '3'
services:
code-server:
container_name: code
image: lscr.io/linuxserver/code-server:latest
environment:
- PUID=0
- PGID=0
- TZ=Europe/London
- PASSWORD=${CODESERVER_PASSWORD}
- DEFAULT_WORKSPACE=/config/workspace
volumes:
- code-server_config:/config
- has_config:/mnt/has_config
- nginx_conf:/mnt/nginx_config
- mosquitto_config:/mnt/mosquitto_config
- hostfs_home_admin_repos:/mnt/hostfs_home_admin_repos
networks:
- code
- reverseproxy_public
ports:
- 8444:8443
restart: unless-stopped
volumes:
code-server_config:
has_config:
name: has_app_config
external: true
nginx_conf:
name: reverseproxy_nginx-conf.d
external: true
mosquitto_config:
external: true
hostfs_home_admin_repos:
external: true
networks:
code:
reverseproxy_public:
external: true

View File

@@ -0,0 +1,49 @@
version: '3'
services:
duplicati:
image: duplicati/duplicati:latest
volumes:
- duplicati-data:/data
- codeserver-config:/bck/codeserver-config
- duplicati-data:/bck/duplicati-data
- has-config:/bck/has-config
- lms-config:/bck/lms-config
- lms-playlist:/bck/lms-config
- host-fs:/bck/host-fs
- mosquitto-config:/bck/mosquitto-config
- mosquitto-data:/bck/mosquitto-data
- portainer-data:/bck/portainer-data
- host-fs:/hostfs:ro
ports:
- 8200:8200
restart: unless-stopped
volumes:
duplicati-data:
external: true
name: duplicati-data
codeserver-config:
name: code-server_code-server_config
external: true
has-config:
name: has_app_config
external: true
lms-config:
name: lms_config
external: true
lms-playlist:
name: lms_playlist
host-fs:
name: host_fs
external: true
mosquitto-config:
name: mosquitto_config
external: true
mosquitto-data:
name: mosquitto_data
external: true
portainer-data:
name: portainer_data
external: true

View File

@@ -0,0 +1,49 @@
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://lansrv01.dev.lan:3100/loki/api/v1/push
scrape_configs:
- job_name: varlogs
static_configs:
- targets:
- localhost
labels:
job: varlogs
host: homesrv01
__path__: /var/log/*log
- job_name: systemd-journal
journal:
json: true
max_age: 12h
path: /var/log/journal
# matches: _TRANSPORT=kernel
labels:
job: systemd-journal
host: homesrv01
relabel_configs:
- source_labels: ['__journal__systemd_unit']
target_label: 'journal_systemd_unit'
- source_labels: ['__journal_syslog_identifier']
target_label: 'journal_syslog_identifier'
- source_labels: ['__journal__hostname']
target_label: 'journal_hostname'
- job_name: docker
docker_sd_configs:
- host: unix:///var/run/docker.sock
refresh_interval: 1s
pipeline_stages:
- static_labels:
host: "homesrv01"
job: "docker"
relabel_configs:
- source_labels: ['__meta_docker_container_name']
regex: '/(.*)'
target_label: "container_name"
- source_labels: ['__meta_docker_container_id']
target_label: "container_id"

15
docker/promtail/docker-run.sh Executable file
View File

@@ -0,0 +1,15 @@
#! /bin/bash
# must be executed from repo promtail root folder
docker container stop promtail
docker container remove promtail
docker run -d \
--name promtail \
-v $(pwd)/config:/mnt/config \
-v /var/log:/var/log \
-v /var/log/journal/:/var/log/journal/ \
-v /run/log/journal/:/run/log/journal/ \
-v /etc/machine-id:/etc/machine-id \
-v /var/run/docker.sock:/var/run/docker.sock \
grafana/promtail:latest \
-config.file=/mnt/config/promtail-config.yaml

View File

@@ -0,0 +1,102 @@
[global_tags]
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
# rack = "1a"
## Environment variables can be used as tags, and throughout the config file
# user = "$USER"
[agent]
hostname = "homesrv01"
omit_hostname = false
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = "0s"
# Output Configuration for telegraf agent
[[outputs.influxdb_v2]]
## The URLs of the InfluxDB cluster nodes.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
## urls exp: http://127.0.0.1:8086
urls = ["http://influxdb01.lan:8086"]
## Token for authentication.
token = "V9iMrHJvI42_KcV0tcH5X3DcUEhvFQdnX5JqlBiKRsHEZMDDZQYdtxIuXlGzQTofUiLXc_QJN1pjpqnM6Fr1ow=="
## Organization is the name of the organization you wish to write to; must exist.
organization = "limbo"
## Destination bucket to write into.
bucket = "telegraf"
insecure_skip_verify = true
[[inputs.docker]]
endpoint = "unix:///var/run/docker.sock"
gather_services = false
container_names = []
source_tag = false
container_name_include = []
container_name_exclude = []
timeout = "5s"
perdevice = true
total = false
docker_label_include = []
docker_label_exclude = []
tag_env = ["JAVA_HOME", "HEAP_SIZE"]
# Read metrics about cpu usage
[[inputs.cpu]]
## Whether to report per-cpu stats or not
percpu = true
## Whether to report total system cpu stats or not
totalcpu = true
## If true, collect raw CPU time metrics
collect_cpu_time = false
## If true, compute and report the sum of all non-idle CPU states
report_active = false
# Read metrics about disk usage by mount point
[[inputs.disk]]
## By default stats will be gathered for all mount points.
## Set mount_points will restrict the stats to only the specified mount points.
# mount_points = ["/"]
## Ignore mount points by filesystem type.
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
# Get the number of processes and group them by status
[[inputs.processes]]
# no configuration
# Read metrics about swap memory usage
[[inputs.swap]]
# no configuration
# Read metrics about system load & uptime
[[inputs.system]]
# no configuration
# Read metrics about network interface usage
[[inputs.net]]
## By default, telegraf gathers stats from any up interface (excluding loopback)
## Setting interfaces will tell it to gather these explicit interfaces,
## regardless of status.
##
interfaces = ["eth0"]

18
docker/telegraf/docker-run.sh Executable file
View File

@@ -0,0 +1,18 @@
#! /bin/bash
# must be executed from repo/docker/telegraf
docker pull telegraf
docker container stop telegraf
docker container remove telegraf
docker run -d --name=telegraf \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ./config/telegraf.conf:/etc/telegraf/telegraf.conf \
-v /:/hostfs:ro \
-e HOST_ETC=/hostfs/etc \
-e HOST_PROC=/hostfs/proc \
-e HOST_SYS=/hostfs/sys \
-e HOST_VAR=/hostfs/var \
-e HOST_RUN=/hostfs/run \
-e HOST_MOUNT_PREFIX=/hostfs \
telegraf