Skip to content
Snippets Groups Projects
Commit a8b0e0ec authored by Jan David Mol's avatar Jan David Mol
Browse files

Merge branch 'add-alloy' into L2SS-2385-add-distro-hawkbit

parents deb6ddaa 759a1030
No related branches found
No related tags found
1 merge request!8Work in progress adding publish distro
Pipeline #124617 passed
...@@ -86,7 +86,7 @@ local_conf_header: ...@@ -86,7 +86,7 @@ local_conf_header:
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit" DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd" VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units" VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
IMAGE_INSTALL:append = "consul-exporter node-exporter chrony-exporter ntp python3-pypcc python3-halibut-py vcgencmd dtc i2c-tools swupdate swupdate-www libgpiod libgpiod-tools libgpiod-dev kernel-module-i2c-gpio" IMAGE_INSTALL:append = "alloy consul-exporter node-exporter chrony-exporter ntp python3-pypcc python3-halibut-py vcgencmd dtc i2c-tools swupdate swupdate-www libgpiod libgpiod-tools libgpiod-dev kernel-module-i2c-gpio"
IMAGE_FSTYPES = "tar.bz2 ext4 ext4.gz wic.bz2 wic.bmap" IMAGE_FSTYPES = "tar.bz2 ext4 ext4.gz wic.bz2 wic.bmap"
SWUPDATE_IMAGES_FSTYPES[core-image-full-cmdline] = ".ubifs" SWUPDATE_IMAGES_FSTYPES[core-image-full-cmdline] = ".ubifs"
IMAGE_BOOT_FILES:append = "halibut.dtbo;overlays/halibut.dtbo" IMAGE_BOOT_FILES:append = "halibut.dtbo;overlays/halibut.dtbo"
......
SUMMARY = "Open source OpenTelemetry Collector distribution with built-in Prometheus pipelines and support for metrics, logs, traces, and profiles."
HOMEPAGE = "https://github.com/grafana/alloy"
DEPENDS += "systemd"
RDEPENDS_${PN} = "systemd"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://${S}/../LICENSE;md5=650b869bd8ff2aed59c62bad2a22a821"
FILESEXTRAPATHS:prepend := "${THISDIR}:"
SRC_URI = " \
https://github.com/grafana/alloy/releases/download/v1.9.2/alloy-linux-arm64.zip;name=binary \
https://raw.githubusercontent.com/grafana/alloy/refs/tags/v1.9.2/LICENSE;name=license \
file://files/alloy.service \
file://files/alloy.sysconfig \
file://files/config.alloy \
"
SRC_URI[binary.sha256sum] = "235eca6f86bdf3ed0f8ad6d8385c81e029494d7cd375f59668560198499b66ff"
SRC_URI[license.sha256sum] = "7c34d28e784b202aa4998f477fd0aa9773146952d7f6fa5971369fcdda59cf48"
FILES:${PN} += "\
${systemd_unitdir}/system/alloy.service \
${systemd_unitdir}/system/multi-user.target.wants/alloy.service \
${sysconfdir}/sysconfig/alloy \
${sysconfdir}/alloy/config.alloy \
"
inherit systemd useradd
USERADD_PACKAGES = "${PN}"
USERADD_PARAM:${PN} = "--system --no-create-home --user-group --groups adm,systemd-journal --home-dir ${sysconfdir}/${BPN}-1 --shell /bin/nologin alloy"
SYSTEMD_SERVICE:${PN} = "\
alloy.service \
"
INSANE_SKIP:${PN} += "already-stripped"
do_install() {
install -Dm755 ${S}/../alloy-linux-arm64 ${D}${bindir}/alloy
install -Dm644 ${WORKDIR}/files/alloy.service ${D}${systemd_unitdir}/system/alloy.service
install -Dm644 ${WORKDIR}/files/alloy.sysconfig ${D}${sysconfdir}/sysconfig/alloy
install -Dm644 ${WORKDIR}/files/config.alloy ${D}${sysconfdir}/alloy
install -d -o alloy ${D}${localstatedir}/lib/alloy/data
}
[Unit]
Description= Vendor-agnostic OpenTelemetry Collector distribution with programmable pipelines
Documentation=https://grafana.com/docs/alloy
Wants=network-online.target
After=network-online.target
[Service]
Restart=always
User=alloy
Environment=HOSTNAME=%H
#Environment=ALLOY_DEPLOY_MODE=deb
EnvironmentFile=/etc/sysconfig/alloy
WorkingDirectory=/var/lib/alloy
ExecStart=/usr/bin/alloy run $CUSTOM_ARGS --storage.path=/var/lib/alloy/data $CONFIG_FILE
ExecReload=/usr/bin/env kill -HUP $MAINPID
TimeoutStopSec=20s
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
CONFIG_FILE=/etc/alloy/config.alloy
# see also https://grafana.com/docs/alloy/latest/tutorials/send-logs-to-loki/
loki.relabel "journal" {
forward_to = []
rule {
source_labels = ["__journal_priority"]
target_label = "level"
}
rule {
source_labels = ["__journal__hostname"]
target_label = "hostname"
}
rule {
source_labels = ["__journal__comm"]
target_label = "comm"
}
rule {
source_labels = ["__journal__systemd_unit"]
target_label = "systemd_unit"
}
rule {
source_labels = ["__journal_unit"]
target_label = "unit"
}
}
loki.source.journal "journal_scrape" {
forward_to = [loki.process.filter_logs.receiver]
relabel_rules = loki.relabel.journal.rules
}
loki.process "filter_logs" {
stage.drop {
source = "systemd_unit,unit"
expression = "serial-getty@ttyS0.service"
drop_counter_reason = "ignore ttyS0 errors"
}
forward_to = [loki.write.lcu_loki.receiver, loki.write.central_loki.receiver]
}
loki.write "lcu_loki" {
endpoint {
url = "http://loki.service.consul:3100/loki/api/v1/push"
}
}
loki.write "central_loki" {
endpoint {
url = "http://logs.service.lofar-central.consul:3100/loki/api/v1/push"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment