mirror of
https://github.com/zulip/zulip.git
synced 2026-06-03 21:01:43 +08:00
kandra: Use tbot application proxy + teleport-sd for service discovery.
Some checks failed
Code scanning / CodeQL (push) Has been cancelled
Zulip production suite / Ubuntu 22.04 production build (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:bookworm, true, false, Debian 12 (Python 3.11, backend + documentation), bookworm) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:jammy, false, true, Ubuntu 22.04 (Python 3.10, backend + frontend), jammy) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:noble, false, false, Ubuntu 24.04 (Python 3.12, backend), noble) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:resolute, false, false, Ubuntu 26.04 (Python 3.14, backend), resolute) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:trixie, false, false, Debian 13 (Python 3.13, backend), trixie) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm, --test-custom-db, Debian 12 production install with custom db name and user, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:jammy, , Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga, jammy) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble, , Ubuntu 24.04 production install, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:resolute, , Ubuntu 26.04 production install, resolute) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:trixie, , Debian 13 production install, trixie) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm-7.0, 7.0 Version Upgrade, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm-8.0, 8.0 Version Upgrade, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:jammy-6.0, 6.0 Version Upgrade, jammy) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble-10.0, 10.0 Version Upgrade, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble-9.0, 9.0 Version Upgrade, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:trixie-11.0, 11.0 Version Upgrade, trixie) (push) Has been cancelled
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Has been cancelled
Zulip production suite / Ubuntu 22.04 production build (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:bookworm, true, false, Debian 12 (Python 3.11, backend + documentation), bookworm) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:jammy, false, true, Ubuntu 22.04 (Python 3.10, backend + frontend), jammy) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:noble, false, false, Ubuntu 24.04 (Python 3.12, backend), noble) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:resolute, false, false, Ubuntu 26.04 (Python 3.14, backend), resolute) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:trixie, false, false, Debian 13 (Python 3.13, backend), trixie) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm, --test-custom-db, Debian 12 production install with custom db name and user, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:jammy, , Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga, jammy) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble, , Ubuntu 24.04 production install, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:resolute, , Ubuntu 26.04 production install, resolute) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:trixie, , Debian 13 production install, trixie) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm-7.0, 7.0 Version Upgrade, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm-8.0, 8.0 Version Upgrade, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:jammy-6.0, 6.0 Version Upgrade, jammy) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble-10.0, 10.0 Version Upgrade, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble-9.0, 9.0 Version Upgrade, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:trixie-11.0, 11.0 Version Upgrade, trixie) (push) Has been cancelled
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
This makes the Prometheus configuration no longer have to know anything about which hosts run which exporters; instead, hosts register the exporter in Teleport, and Prometheus asks Teleport which instances of a given exporter it knows about.
This commit is contained in:
parent
c58ab6667c
commit
67482a5591
18
puppet/kandra/files/tbot.service
Normal file
18
puppet/kandra/files/tbot.service
Normal file
@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=tbot - Teleport Machine & Workload Identity Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=teleport
|
||||
Group=teleport
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
Environment="TELEPORT_ANONYMOUS_TELEMETRY=0"
|
||||
ExecStart=/usr/local/bin/tbot start -c /etc/tbot.yaml --pid-file=/var/lib/teleport/bot/pid
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
PIDFile=/var/lib/teleport/bot/pid
|
||||
LimitNOFILE=524288
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
24
puppet/kandra/files/tbot.yaml
Normal file
24
puppet/kandra/files/tbot.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
version: v2
|
||||
proxy_server: teleport.zulipchat.net:443
|
||||
onboarding:
|
||||
join_method: iam
|
||||
# This "token" is defined in Teleport, and links to the AWS role
|
||||
# https://teleport.zulipchat.net/web/tokens
|
||||
# https://goteleport.com/docs/reference/deployment/join-methods/#aws-iam-role-iam
|
||||
# https://goteleport.com/docs/installation/agents/aws-iam/
|
||||
token: prometheus-scrape-bot
|
||||
ca_pins:
|
||||
- "sha256:062db37249ea74c450579da8f02043b317cb8a174d653bb5090a89752d68efe7"
|
||||
storage:
|
||||
type: directory
|
||||
path: /var/lib/teleport/bot
|
||||
services:
|
||||
# Prometheus proxies all exporter traffic through this proxy
|
||||
- type: application-proxy
|
||||
listen: tcp://127.0.0.1:8080
|
||||
outputs:
|
||||
# This is consumed by teleport-sd to list exporters
|
||||
- type: identity
|
||||
destination:
|
||||
type: directory
|
||||
path: /var/lib/teleport/bot-identity
|
||||
@ -6,6 +6,10 @@ class kandra::profile::prometheus_server inherits kandra::profile::base {
|
||||
|
||||
include kandra::prometheus::base
|
||||
|
||||
# Service discovery via Teleport
|
||||
include kandra::teleport::tbot
|
||||
include kandra::teleport::sd
|
||||
|
||||
# This blackbox monitoring of the backup system runs locally
|
||||
include kandra::prometheus::wal_g
|
||||
|
||||
@ -72,6 +76,7 @@ class kandra::profile::prometheus_server inherits kandra::profile::base {
|
||||
File[$bin],
|
||||
File[$data_dir],
|
||||
File['/etc/prometheus/prometheus.yaml'],
|
||||
Service['tbot'],
|
||||
],
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
|
||||
31
puppet/kandra/manifests/teleport/sd.pp
Normal file
31
puppet/kandra/manifests/teleport/sd.pp
Normal file
@ -0,0 +1,31 @@
|
||||
# @summary Returns Prometheus scrape targets based on Teleport apps
|
||||
#
|
||||
# Only one instance is necessary.
|
||||
#
|
||||
class kandra::teleport::sd {
|
||||
include zulip::supervisor
|
||||
include kandra::teleport::tbot
|
||||
|
||||
$version = $zulip::common::versions['teleport-sd']['version']
|
||||
$bin = "/srv/zulip-teleport-sd-${version}"
|
||||
|
||||
zulip::external_dep { 'teleport-sd':
|
||||
version => $version,
|
||||
url => "https://github.com/alexmv/teleport-sd/releases/download/v${version}/teleport-sd-linux-${zulip::common::goarch}",
|
||||
cleanup_after => [Service[supervisor]],
|
||||
}
|
||||
|
||||
file { "${zulip::common::supervisor_conf_dir}/teleport-sd.conf":
|
||||
ensure => file,
|
||||
require => [
|
||||
Package[teleport],
|
||||
Package[supervisor],
|
||||
File[$bin],
|
||||
],
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
content => template('kandra/supervisor/conf.d/teleport-sd.conf.erb'),
|
||||
notify => Service[supervisor],
|
||||
}
|
||||
}
|
||||
40
puppet/kandra/manifests/teleport/tbot.pp
Normal file
40
puppet/kandra/manifests/teleport/tbot.pp
Normal file
@ -0,0 +1,40 @@
|
||||
# @summary Provide a local application proxy
|
||||
# https://goteleport.com/docs/reference/machine-workload-identity/configuration/#application-proxy
|
||||
class kandra::teleport::tbot {
|
||||
include kandra::teleport::base
|
||||
|
||||
file { '/etc/tbot.yaml':
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
source => 'puppet:///modules/kandra/tbot.yaml',
|
||||
notify => Service['tbot'],
|
||||
}
|
||||
|
||||
file { '/etc/systemd/system/tbot.service':
|
||||
require => [
|
||||
Package[teleport],
|
||||
],
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
source => 'puppet:///modules/kandra/tbot.service',
|
||||
notify => [Exec['reload systemd'], Service['tbot']],
|
||||
}
|
||||
|
||||
file { ['/var/lib/teleport/bot', '/var/lib/teleport/bot-identity']:
|
||||
ensure => directory,
|
||||
owner => 'teleport',
|
||||
group => 'teleport',
|
||||
mode => '0644',
|
||||
require => Service['teleport'],
|
||||
before => Service['tbot'],
|
||||
}
|
||||
|
||||
service {'tbot':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => [Service['teleport'], Exec['reload systemd']],
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
[program:teleport-sd]
|
||||
command=<%= @bin %> --listen 127.0.0.1:9092 --proxy teleport.zulipchat.net:443 --identity /var/lib/teleport/bot-identity/identity
|
||||
priority=15
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=teleport
|
||||
@ -194,6 +194,15 @@ class zulip::common {
|
||||
},
|
||||
},
|
||||
|
||||
# https://github.com/alexmv/teleport-sd/releases
|
||||
'teleport-sd' => {
|
||||
'version' => '0.1.0',
|
||||
'sha256' => {
|
||||
'amd64' => '2128d78dd602c6a24c13fbd759bf19d0c3cebaa732ad0824019ced53163cf455',
|
||||
'aarch64' => 'df93ba9510cb8898ba0f15b293d7c6877173a8d06b1f284dcc42ffc7ff32978e',
|
||||
},
|
||||
},
|
||||
|
||||
# https://github.com/timonwong/uwsgi_exporter/releases
|
||||
'uwsgi_exporter' => {
|
||||
'version' => '1.3.0',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user