#!/usr/bin/env bash

# Copyright (c) 2021-2025 community-scripts ORG
# Author: hoholms
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/grafana/loki

source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os

msg_info "Setting up Grafana Repository"
setup_deb822_repo \
  "grafana" \
  "https://apt.grafana.com/gpg.key" \
  "https://apt.grafana.com" \
  "stable" \
  "main"
msg_ok "Grafana Repository setup sucessfully"

msg_info "Installing Loki"
$STD apt install -y loki
systemctl enable -q --now loki
msg_ok "Installed Loki"

msg_info "Installing Promtail"
$STD apt install -y promtail
systemctl enable -q --now promtail
msg_ok "Installed Promtail"

motd_ssh
customize
cleanup_lxc
