This commit is contained in:
ai-dev 2025-01-16 00:53:01 +01:00
commit 70581e700e
16 changed files with 74 additions and 88 deletions

View File

@ -1,9 +0,0 @@
---
build_from:
amd64: ghcr.io/hassio-addons/debian-base/amd64:7.5.1
armhf: ghcr.io/hassio-addons/debian-base/armhf:7.5.1
armv7: ghcr.io/hassio-addons/debian-base/armv7:7.5.1
aarch64: ghcr.io/hassio-addons/debian-base/aarch64:7.5.1
codenotary:
base_image: codenotary@frenck.dev
signer: codenotary@degatano.com

View File

@ -1,27 +0,0 @@
---
- job_name: journal
journal:
json: false
max_age: 12h
labels:
job: systemd-journal
path: "${JOURNAL_PATH}"
relabel_configs:
- source_labels:
- __journal__systemd_unit
target_label: unit
- source_labels:
- __journal__hostname
target_label: nodename
- source_labels:
- __journal_syslog_identifier
target_label: syslog_identifier
- source_labels:
- __journal_container_name
target_label: container_name
pipeline_stages:
- match:
selector: '{container_name=~"homeassistant|hassio_supervisor"}'
stages:
- multiline:
firstline: '^\x{001b}'

View File

@ -1,45 +1,33 @@
---
# This is a complete configuration to deploy Loki backed by the filesystem.
# The index will be shipped to the storage via tsdb-shipper.
auth_enabled: false auth_enabled: false
server: {} server:
http_listen_port: 3100
ingester: common:
lifecycler:
address: 127.0.0.1
ring: ring:
instance_addr: 127.0.0.1
kvstore: kvstore:
store: inmemory store: inmemory
replication_factor: 1 replication_factor: 1
final_sleep: 0s path_prefix: /tmp/loki
chunk_idle_period: 1h
max_chunk_age: 1h
chunk_target_size: 1048576
chunk_retain_period: 30s
wal:
dir: /data/loki/wal
schema_config: schema_config:
configs: configs:
- from: 2020-11-09 - from: 2020-05-15
store: tsdb # Changed to tsdb store: tsdb
object_store: filesystem object_store: filesystem
schema: v13 # Changed to v13 schema: v13
index: index:
prefix: index_ prefix: index_
period: 24h period: 24h
storage_config: storage_config:
tsdb_shipper:
active_index_directory: /data/loki/tsdb-active # Set this path
cache_location: /data/loki/tsdb-cache # Set this path
filesystem: filesystem:
directory: /data/loki/chunks directory: /tmp/loki/chunks
compactor:
working_directory: /data/loki/tsdb-shipper-compactor
retention_enabled: true
delete_request_store: filesystem # Added this line
limits_config: limits_config:
reject_old_samples: true reject_old_samples: true
reject_old_samples_max_age: 168h reject_old_samples_max_age: 168h

View File

@ -1,6 +1,3 @@
# https://github.com/mdegat01/promtail-journal/releases
#FROM ghcr.io/mdegat01/promtail-journal/${BUILD_ARCH}:1.6.0 as build_promtail
# https://github.com/hassio-addons/addon-debian-base/releases # https://github.com/hassio-addons/addon-debian-base/releases
# hadolint ignore=DL3006 # hadolint ignore=DL3006
ARG BUILD_FROM ARG BUILD_FROM
@ -8,19 +5,22 @@ FROM ${BUILD_FROM}
# https://github.com/mikefarah/yq/releases # https://github.com/mikefarah/yq/releases
ARG YQ_VERSION=4.44.3 ARG YQ_VERSION=4.44.3
ARG PROMTAIL_VERSION=3.2.1
ARG BUILD_ARCH ARG BUILD_ARCH
COPY rootfs /
# Add yq and tzdata (required for the timestamp stage) # Add yq and tzdata (required for the timestamp stage)
RUN echo "deb http://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list
RUN apt-get update && apt-get install -t bullseye-backports -qy libsystemd-dev
RUN set -eux; \ RUN set -eux; \
apt-get update; \ apk update; \
apt-get install -qy --no-install-recommends \
tar=1.34+dfsg-1 \
; \
update-ca-certificates; \
\ \
case "${BUILD_ARCH}" in \ apk add --no-cache --virtual .build-deps \
tar;
RUN apk add --no-cache \
ca-certificates;
RUN update-ca-certificates;
RUN case "${BUILD_ARCH}" in \
amd64) BINARCH='amd64' ;; \ amd64) BINARCH='amd64' ;; \
armhf) BINARCH='arm' ;; \ armhf) BINARCH='arm' ;; \
armv7) BINARCH='arm' ;; \ armv7) BINARCH='arm' ;; \
@ -35,16 +35,27 @@ RUN set -eux; \
rm /tmp/yq.tar.gz; \ rm /tmp/yq.tar.gz; \
yq --version; \ yq --version; \
\ \
apt-get clean; \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*; \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*; \
chmod +x /etc/cont-init.d/promtail_setup.sh; \ chmod +x /etc/cont-init.d/promtail_setup.sh; \
chmod +x /etc/services.d/promtail/*; chmod +x /etc/services.d/promtail/*;
# Add promtail # Install dependencies for building Promtail
COPY --from=grafana/promtail:latest /usr/bin/promtail /usr/bin/promtail RUN apk add --no-cache go git build-base
RUN promtail --version
# Download the Promtail source code
RUN git clone --branch "v${PROMTAIL_VERSION}" https://github.com/grafana/loki.git /promtail-src
# Build Promtail
WORKDIR /promtail-src/clients/cmd/promtail
RUN go build -o /usr/bin/promtail
# Clean up source and unnecessary packages
RUN apk del go git build-base && \
rm -rf /promtail-src
# Verify the installation
RUN /usr/bin/promtail -version
COPY rootfs /
WORKDIR /data/promtail WORKDIR /data/promtail
# Build arguments # Build arguments

9
promtail/build.yaml Normal file
View File

@ -0,0 +1,9 @@
---
build_from:
amd64: ghcr.io/hassio-addons/base/amd64:16.3.4
armhf: ghcr.io/hassio-addons/base/armhf:16.3.4
armv7: ghcr.io/hassio-addons/base/armv7:16.3.4
aarch64: ghcr.io/hassio-addons/base/aarch64:16.3.4
codenotary:
base_image: codenotary@frenck.dev
signer: codenotary@degatano.com

View File

@ -11,10 +11,15 @@ arch:
description: Promtail for Home Assistant description: Promtail for Home Assistant
codenotary: codenotary@degatano.com codenotary: codenotary@degatano.com
init: false init: false
journald: true hassio_api: true
homeassistant_api: true
auth_api: true
docker_api: true
host_network: true
host_pid: true
map: map:
- config - config:rw
- share - share:rw
- ssl - ssl
watchdog: http://[HOST]:[PORT:9080]/ready watchdog: http://[HOST]:[PORT:9080]/ready
ports: ports:

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,9 @@
---
- job_name: home_assistant_logs
static_configs:
- targets:
- localhost # Target for the logs, can be anything since it's just a label
labels:
job: home_assistant # Job label for your logs in Loki
host: home_assistant # Optional label for host, useful if running multiple Home Assistant instances
__path__: /config/home-assistant.log # Path to Home Assistant log file