feat: vmauth, alloy and glance configurations added

+10 -12
README.md
···
## Caveats
-
This is not a ready-to-use configuration that you can just apply. It requires additional configuration files
-
and initialized state. You can apply it, write those configs, then go to Pocket ID, generate OAuth2 Client IDs,
-
and paste them into container templates. Technically, it's possible to make it as generic as possible,
-
but I don't think anyone wants to copy my setup entirely. I see this more as a template for your own setups.
+
This is not a ready-to-use configuration that you can just apply. It requires initialized state.
+
You can apply it, then go to Pocket ID, generate OAuth2 Client IDs, and paste them into container templates.
+
Technically, it's possible to make it as generic as possible, but I don't think anyone wants to copy my setup entirely.
+
I see this more as a template for your own setups.
## Future plans
-
I would like to switch to Flatcar Linux, but for now it doesn't include the `i915` kernel driver,
-
which is a dealbreaker for me. However, it's [already merged](https://github.com/flatcar/scripts/pull/2349)
-
and will soon be available in the Alpha channel.
-
-
Also, I want to move my Traefik, Grafana Alloy and Victoria vmauth configurations to this repo
-
at some point, but I didn't figure out how to do it properly now.
-
-
And finally I want to harden my network setup, since for now it's pretty permissive.
+
- [x] Move Traefik, Graana Alloy and other configs to repository.
+
- [ ] Consider switching to Flatcar Linux. Personally I like it more, but in the current version they didn't ship
+
`i915` driver, which is a dealbreaker for me. However, it's [already merged](https://github.com/flatcar/scripts/pull/2349)
+
and will soon be available in the Alpha channel.
+
- [ ] Harden network setup; for now it's pretty permissive.
+
- [ ] Monitor uptime and setup alerts with Uptime Kuma.
+61
configs/alloy/config.alloy
···
+
logging {
+
level = "info"
+
format = "json"
+
}
+
+
discovery.docker "fcos" {
+
host = "unix:///var/run/docker.sock"
+
}
+
+
discovery.relabel "docker" {
+
targets = discovery.docker.fcos.targets
+
+
rule {
+
action = "labelmap"
+
regex = "^__meta_docker_(.*)$"
+
}
+
}
+
+
loki.source.docker "podman" {
+
host = "unix:///var/run/docker.sock"
+
targets = discovery.docker.fcos.targets
+
labels = { "source_name" = "podman" }
+
forward_to = [loki.process.copy_msg.receiver]
+
relabel_rules = discovery.relabel.docker.rules
+
}
+
+
loki.process "copy_msg" {
+
forward_to = [loki.write.victoria_logs.receiver]
+
+
// Bluesky logs plain json, so we need to manually remap msg to _msg.
+
stage.match {
+
selector = "{_msg=\"\"}"
+
+
stage.json {
+
expressions = { "msg" = "" }
+
}
+
+
stage.labels {
+
values = { "_msg" = "msg" }
+
}
+
}
+
}
+
+
loki.write "victoria_logs" {
+
endpoint {
+
url = "http://victoria:9428/insert/loki/api/v1/push?_stream_fields=source_name,container_name"
+
}
+
}
+
+
// Just Traefik for now
+
prometheus.scrape "scrape_metrics" {
+
targets = [{ __address__ = "traefik:8082" }]
+
forward_to = [prometheus.remote_write.victoria_metrics.receiver]
+
scrape_interval = "10s"
+
}
+
+
prometheus.remote_write "victoria_metrics" {
+
endpoint {
+
url = "http://victoria:8428/prometheus/api/v1/write"
+
}
+
}
+3 -1
configs/containers/systemd/glance.container.tftpl
···
User=1000:1000
UserNS=keep-id:uid=1000,gid=1000
+
Secret=glance-github-token,type=env,target=GITHUB_TOKEN
+
Label="glance.name=Glance"
Label="glance.icon=di:glance-light"
Label="glance.url=https://glance.${base_domain}"
···
Label="traefik.http.routers.glance-private.rule=Host(`glance.${base_domain}`) && (ClientIP(`10.88.0.0/15`) || ClientIP(`192.168.0.0/16`))"
Label="traefik.http.routers.glance-private.priority=2"
-
Volume=/var/mnt/docker/app_data/glance/config:/app/config:Z
+
Volume=%E/glance:/app/config:Z
Volume=/var/mnt/docker/app_data/glance/assets:/app/assets:Z
Volume=%t/podman/podman.sock:/var/run/docker.sock
+1 -1
configs/containers/systemd/grafana-alloy.container.tftpl
···
Exec=run --storage.path=/var/lib/alloy/data --disable-reporting /etc/alloy/config.alloy
-
Volume=/var/mnt/docker/app_data/grafana/alloy/config.alloy:/etc/alloy/config.alloy:Z
+
Volume=%E/alloy/config.alloy:/etc/alloy/config.alloy:Z
Volume=%t/podman/podman.sock:/var/run/docker.sock
Network=reverse-proxy.network
+2 -2
configs/containers/systemd/victoria/victoria-vmauth.container.tftpl
···
Label="traefik.http.services.vm.loadbalancer.server.port=8427"
Label="traefik.http.routers.vm-auth.rule=(Host(`metrics.${base_domain}`) || Host(`logs.${base_domain}`)) && PathPrefix(`/oauth2/`)"
Label="traefik.http.routers.vm-auth.service=oauth2-proxy"
-
Label="traefik.http.middlewares.add-victoria-bearer.headers.customRequestHeaders.Authorization=Bearer ${secrets.victoria_bearer_token}"
+
Label="traefik.http.middlewares.add-victoria-bearer.headers.customRequestHeaders.Authorization=Bearer ${secrets.vmauth_traefik_bearer_token}"
Label="traefik.http.routers.vm-api.rule=(Host(`metrics.${base_domain}`) || Host(`logs.${base_domain}`)) && (HeaderRegexp(`Authorization`, `^Bearer .*$`) || HeaderRegexp(`Authorization`, `^Token .*$`))"
Label="traefik.http.routers.vm-api.priority=2"
Exec="--auth.config=/etc/auth.yml"
-
Volume=/var/mnt/docker/app_data/victoria/vmauth/auth.yml:/etc/auth.yml:Z
+
Volume=%E/vmauth/auth.yml:/etc/auth.yml:Z
Pod=victoria.pod
+5
configs/glance/glance.yml
···
+
server:
+
assets-path: /app/assets
+
+
pages:
+
!include: home.yml
+86
configs/glance/home.yml
···
+
- name: Startpage
+
width: slim
+
hide-desktop-navigation: true
+
center-vertically: true
+
columns:
+
- size: full
+
widgets:
+
- type: search
+
search-engine: google
+
autofocus: true
+
+
- type: docker-containers
+
hide-by-default: true
+
+
- type: monitor
+
cache: 1m
+
title: TLS Passthrough
+
sites:
+
- title: Proxmox
+
url: https://pve.${base_domain}/
+
icon: di:proxmox-light
+
- title: TrueNAS
+
url: https://truenas.${base_domain}/
+
icon: di:truenas
+
+
- type: bookmarks
+
groups:
+
- title: General
+
links:
+
- title: Fastmail
+
icon: di:fastmail
+
url: https://app.fastmail.com/
+
- title: Github
+
icon: di:github-light
+
url: https://github.com/
+
- title: Social
+
links:
+
- title: Reddit
+
icon: di:reddit
+
url: https://www.reddit.com/
+
- title: Bluesky
+
icon: di:bluesky
+
url: https://bsky.app/
+
- title: DTF
+
icon: https://dtf.ru/assets/favicon-32x32.png
+
url: https://dtf.ru/
+
- title: Entertainment
+
links:
+
- title: YouTube
+
icon: di:youtube
+
url: https://www.youtube.com/
+
+
- size: small
+
widgets:
+
- type: weather
+
location: Belgrade, Serbia
+
+
- type: releases
+
show-source-icon: true
+
limit: 20
+
collapse-after: 10
+
repositories:
+
- actualbudget/actual
+
- glanceapp/glance
+
- grafana/alloy
+
- grafana/grafana
+
- hoarder-app/hoarder
+
- immich-app/immich
+
- miniflux/miniflux
+
- oauth2-proxy/oauth2-proxy
+
- open-webui/open-webui
+
- outline/outline
+
- pocket-id/pocket-id
+
- dockerhub:qbittorrentofficial/qbittorrent-nox
+
- traefik/traefik
+
- VictoriaMetrics/VictoriaMetrics
+
+
- type: server-stats
+
servers:
+
- type: local
+
name: Services
+
hide-mountpoints-by-default: true
+
mountpoints:
+
"/app/config":
+
name: iSCSI
+
hide: false
+16
configs/vmauth/auth.yml
···
+
users:
+
# Traefik
+
- bearer_token: "${secrets.vmauth_traefik_bearer_token}"
+
url_map:
+
- src_hosts:
+
- "metrics\\.${replace(base_domain, ".", "\\\\.")}"
+
url_prefix: "http://victoria-metrics:8428/"
+
- src_hosts:
+
- "logs\\.${replace(base_domain, ".", "\\\\.")}"
+
url_prefix: "http://victoria-logs:9428/"
+
# Proxmox
+
- bearer_token: "${secrets.vmauth_proxmox_bearer_token}"
+
url_map:
+
- src_hosts:
+
- "metrics\\.${replace(base_domain, ".", "\\\\.")}"
+
url_prefix: "http://victoria-metrics:8428/"
+12 -7
fcos.tf
···
-
data "bitwarden_secret" "victoria_bearer_token" {
-
id = var.containers_secret_config.victoria_bearer_token
+
data "bitwarden_secret" "vmauth_traefik_bearer_token" {
+
id = var.containers_secret_config.vmauth_traefik_bearer_token
+
}
+
+
data "bitwarden_secret" "vmauth_proxmox_bearer_token" {
+
id = var.containers_secret_config.vmauth_proxmox_bearer_token
}
data "bitwarden_secret" "immich_map_key" {
···
proxmox_ip : var.proxmox_config.host,
truenas_ip : var.fcos_config.truenas_ip,
secrets : {
-
victoria_bearer_token : data.bitwarden_secret.victoria_bearer_token.value
-
immich_map_key = data.bitwarden_secret.immich_map_key.value
+
vmauth_traefik_bearer_token : data.bitwarden_secret.vmauth_traefik_bearer_token.value
+
vmauth_proxmox_bearer_token : data.bitwarden_secret.vmauth_proxmox_bearer_token.value
+
immich_map_key : data.bitwarden_secret.immich_map_key.value
}
})
···
])
butane_config = merge(var.fcos_config, {
-
config_files = local.config_files
-
directories = local.directories,
+
config_files = local.config_files
+
directories = local.directories,
})
init_script_path = "${path.module}/scripts/init_fcos.sh.tftpl"
}
-
output "test" {
+
output "directories_to_create" {
value = local.directories
}
+4 -2
variables.tf
···
type = map(string)
default = {
traefik_cf_dns_api_token = "e9e0f0f0-abc8-4bde-b05f-b292018179bb"
-
victoria_bearer_token = "fba802cf-948f-4ff7-8965-b29f00e2da48"
+
vmauth_traefik_bearer_token = "fba802cf-948f-4ff7-8965-b29f00e2da48"
+
vmauth_proxmox_bearer_token = "bb281df0-e5e8-4348-a92e-b2a300a30117"
oauth2_proxy_cookie_secret = "289c0832-27c2-463b-97b7-b29200a8cebd"
oauth2_proxy_client_secret = "afdb8ef2-a3d4-4a17-b839-b29200ab6f87"
pocket_id_maxmind_license_key = "08c549a4-bf48-4998-8cb0-b29200ac845d"
···
outline_postgres_password = "4212e3a7-acd3-4804-ac0e-b29d01015850"
outline_oidc_client_secret = "9c8cae9a-db6d-45d0-8cc0-b29d0101844c"
outline_smtp_password = "5fdbfb32-257e-4cc3-8b07-b29d01063ba6"
-
grafana_oauth2_client_secret = "697cf367-a80c-41f6-b975-b2a200a986d8"
+
grafana_oauth2_client_secret = "697cf367-a80c-41f6-b975-b2a200a986d8"
+
glance_github_token = "de3353d8-09d9-4063-b513-b2a3008cc2c9"
}
}