From 865a6e84daf121965589099a3c0af45fd40bd8e8 Mon Sep 17 00:00:00 2001 From: Thomas Bianchi Date: Tue, 7 Sep 2021 14:39:11 +0200 Subject: [PATCH] feat: add deployment config example --- deploy/after_install.sh | 7 ------- deploy/cortex-tenant.deb.service | 18 ------------------ deploy/cortex-tenant.env | 1 - deploy/cortex-tenant.rpm.service | 14 ++++++-------- deploy/cortex-tenant.yml | 30 ++++++++++++++++++++++-------- 5 files changed, 28 insertions(+), 42 deletions(-) delete mode 100644 deploy/after_install.sh delete mode 100644 deploy/cortex-tenant.deb.service delete mode 100644 deploy/cortex-tenant.env diff --git a/deploy/after_install.sh b/deploy/after_install.sh deleted file mode 100644 index aec2743..0000000 --- a/deploy/after_install.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -USER="cortex-tenant" -HOME="/var/lib/$USER" - -useradd -d $HOME -s /bin/false -M $USER > /dev/null 2>&1 || true -chown $USER:$USER $HOME diff --git a/deploy/cortex-tenant.deb.service b/deploy/cortex-tenant.deb.service deleted file mode 100644 index 80c3750..0000000 --- a/deploy/cortex-tenant.deb.service +++ /dev/null @@ -1,18 +0,0 @@ -[Unit] -Description=Cortex-Tenant -Documentation=https://github.com/blind-oracle/cortex-tenant -Wants=network-online.target -After=network-online.target - -[Service] -Restart=always -User=cortex-tenant -EnvironmentFile=/etc/default/cortex-tenant -ExecStart=/usr/sbin/cortex-tenant -config $CONFIG_FILE -ExecReload=/bin/kill -HUP $MAINPID -TimeoutStopSec=30 -SendSIGKILL=no -WorkingDirectory=/var/lib/cortex-tenant - -[Install] -WantedBy=multi-user.target diff --git a/deploy/cortex-tenant.env b/deploy/cortex-tenant.env deleted file mode 100644 index b5e4831..0000000 --- a/deploy/cortex-tenant.env +++ /dev/null @@ -1 +0,0 @@ -CONFIG_FILE="/etc/cortex-tenant.yml" diff --git a/deploy/cortex-tenant.rpm.service b/deploy/cortex-tenant.rpm.service index 99a84c5..902cf9a 100644 --- a/deploy/cortex-tenant.rpm.service +++ b/deploy/cortex-tenant.rpm.service @@ -1,18 +1,16 @@ [Unit] Description=Cortex-Tenant -Documentation=https://github.com/blind-oracle/cortex-tenant +Documentation=https://github.com/mia-platform/cortex-tenant Wants=network-online.target After=network-online.target [Service] -Restart=always -User=cortex-tenant -EnvironmentFile=/etc/sysconfig/cortex-tenant -ExecStart=/usr/sbin/cortex-tenant -config $CONFIG_FILE +Restart=on-failure +User=gitlab-prometheus +Environment=AUTH_USER_PASS=user:password +ExecStart=/usr/bin/cortex-tenant -config /etc/cortex-tenant.yml ExecReload=/bin/kill -HUP $MAINPID -TimeoutStopSec=30 -SendSIGKILL=no -WorkingDirectory=/var/lib/cortex-tenant +TimeoutStopSec=65 [Install] WantedBy=multi-user.target diff --git a/deploy/cortex-tenant.yml b/deploy/cortex-tenant.yml index 4a7a3d1..20204b6 100644 --- a/deploy/cortex-tenant.yml +++ b/deploy/cortex-tenant.yml @@ -1,10 +1,24 @@ -listen: 0.0.0.0:8080 -target: http://127.0.0.1:9091/receive -log_level: warn -timeout: 10s +# Where to listen for incoming write requests from Prometheus +listen: 0.0.0.0:8034 +# Profiling API, remove to disable +listen_pprof: 0.0.0.0:7008 +# Where to send the modified requests (Cortex) +target: https://example.com/api/v1/push +# Log level +log_level: info +# HTTP request timeout +timeout: 60s +# Timeout to wait on shutdown to allow load balancers detect that we're going away. +# During this period after the shutdown command the /alive endpoint will reply with HTTP 503. +# Set to 0s to disable. +timeout_shutdown: 60s tenant: - label: __tenant__ - label_remove: true - header: X-Scope-OrgID - default: default + query_interval: 60 + # To which header to add the tenant ID + header: X-Scope-OrgId + # Which tenant ID to use if the label is missing in any of the timeseries + # If this is not set or empty then the write request with missing tenant label + # will be rejected with HTTP code 400 + default: example + batch_size: 500