Add GrepTimeDB long term storage for Prometheus
Change-Id: Ibfe0191316e8e0f4a910da49ef67b6d0a64c3f51 Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
prometheus_vhost_name: prometheus.opendev.org
|
||||
prometheus_remote_write_url: http://localhost:4000/v1/prometheus/write
|
||||
prometheus_remote_read_url: http://localhost:4000/v1/prometheus/read
|
||||
greptimedb_storage_type: "S3"
|
||||
letsencrypt_certs:
|
||||
prometheus-opendev-org-main:
|
||||
- prometheus.opendev.org
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
greptimedb_storage_type: "File"
|
||||
@@ -0,0 +1 @@
|
||||
Run GrepTimeDB
|
||||
@@ -0,0 +1,8 @@
|
||||
greptimedb_image: greptime/greptimedb:v0.12.0
|
||||
greptimedb_http_addr: "127.0.0.1:4000"
|
||||
greptimedb_data_home: "/var/lib/greptimedb"
|
||||
greptimedb_storage_type: "File"
|
||||
greptimedb_s3_bucket: "greptime-bucket"
|
||||
greptimedb_s3_root: "/greptime-data"
|
||||
greptimedb_s3_endpoint: ""
|
||||
greptimedb_s3_region: ""
|
||||
@@ -0,0 +1,37 @@
|
||||
- name: Ensure docker-compose directory exists
|
||||
file:
|
||||
state: directory
|
||||
path: /etc/greptimedb-docker
|
||||
|
||||
- name: Ensure data directory exists
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ greptimedb_data_home }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
|
||||
- name: Write greptimedb config file
|
||||
template:
|
||||
src: greptimedb.toml.j2
|
||||
dest: /etc/greptimedb-docker/greptimedb.toml
|
||||
mode: '0640'
|
||||
|
||||
- name: Write docker-compose settings file
|
||||
template:
|
||||
src: docker-compose.yaml.j2
|
||||
dest: /etc/greptimedb-docker/docker-compose.yaml
|
||||
|
||||
- name: Run docker-compose pull
|
||||
command:
|
||||
cmd: docker-compose pull
|
||||
chdir: /etc/greptimedb-docker/
|
||||
|
||||
- name: Run docker-compose up
|
||||
command:
|
||||
cmd: docker-compose up -d
|
||||
chdir: /etc/greptimedb-docker/
|
||||
|
||||
- name: Run docker prune to cleanup unneeded images
|
||||
command:
|
||||
cmd: docker image prune -f
|
||||
@@ -0,0 +1,16 @@
|
||||
services:
|
||||
greptimedb:
|
||||
image: {{ greptimedb_image }}
|
||||
network_mode: host
|
||||
restart: always
|
||||
command:
|
||||
- 'standalone'
|
||||
- 'start'
|
||||
- '--config-file=/etc/greptimedb/greptimedb.toml'
|
||||
volumes:
|
||||
- {{ greptimedb_data_home }}:{{ greptimedb_data_home }}
|
||||
- /etc/greptimedb-docker/greptimedb.toml:/etc/greptimedb/greptimedb.toml:ro
|
||||
logging:
|
||||
driver: journald
|
||||
options:
|
||||
tag: "docker-greptimedb"
|
||||
@@ -0,0 +1,16 @@
|
||||
data_home = "{{ greptimedb_data_home }}"
|
||||
enable_telemetry = false
|
||||
|
||||
[http]
|
||||
addr = "{{ greptimedb_http_addr }}"
|
||||
|
||||
[storage]
|
||||
type = "{{ greptimedb_storage_type }}"
|
||||
{% if greptimedb_storage_type == "S3" %}
|
||||
bucket = "{{ greptimedb_s3_bucket }}"
|
||||
root = "{{ greptimedb_s3_root }}"
|
||||
endpoint = "{{ greptimedb_s3_endpoint }}"
|
||||
region = "{{ greptimedb_s3_region }}"
|
||||
access_key_id = "{{ greptimedb_s3_access_key_id }}"
|
||||
secret_access_key = "{{ greptimedb_s3_secret_access_key }}"
|
||||
{% endif %}
|
||||
@@ -2,6 +2,16 @@ global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
|
||||
{% if prometheus_remote_write_url is defined %}
|
||||
remote_write:
|
||||
- url: {{ prometheus_remote_write_url }}
|
||||
|
||||
{% endif %}
|
||||
{% if prometheus_remote_read_url is defined %}
|
||||
remote_read:
|
||||
- url: {{ prometheus_remote_read_url }}
|
||||
|
||||
{% endif %}
|
||||
scrape_configs:
|
||||
- job_name: 'prometheus'
|
||||
static_configs:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
- hosts: "prometheus:!disabled"
|
||||
name: "Base: configure prometheus"
|
||||
name: "Base: configure prometheus and greptimedb"
|
||||
roles:
|
||||
- iptables
|
||||
- install-docker
|
||||
- prometheus
|
||||
- greptimedb
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# Copyright 2026 StackHPC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
testinfra_hosts = ['prometheus99.opendev.org']
|
||||
|
||||
|
||||
def test_greptimedb_container_listening(host):
|
||||
greptimedb = host.socket("tcp://127.0.0.1:4000")
|
||||
assert greptimedb.is_listening
|
||||
|
||||
def test_greptimedb_proxy(host):
|
||||
cmd = host.run('curl --location '
|
||||
'http://localhost:4000/dashboard')
|
||||
assert 'Greptime' in cmd.stdout
|
||||
|
||||
def test_greptimedb_health(host):
|
||||
cmd = host.run('curl -s --location '
|
||||
'http://localhost:4000/health')
|
||||
assert '{}' in cmd.stdout
|
||||
@@ -757,6 +757,8 @@
|
||||
- playbooks/letsencrypt.yaml
|
||||
- playbooks/service-prometheus.yaml
|
||||
- playbooks/service-node-exporter.yaml
|
||||
- playbooks/roles/greptimedb/
|
||||
- playbooks/service-node-exporter.yaml
|
||||
- playbooks/roles/prometheus/
|
||||
- playbooks/roles/prometheus-node-exporter/
|
||||
- playbooks/roles/install-docker/
|
||||
@@ -765,6 +767,7 @@
|
||||
- playbooks/roles/run-selenium/
|
||||
- inventory/service/group_vars/prometheus-node-exporter.yaml
|
||||
- testinfra/util.py
|
||||
- testinfra/test_greptimedb.py
|
||||
- testinfra/test_prometheus.py
|
||||
- testinfra/test_node_exporter.py
|
||||
|
||||
|
||||
Reference in New Issue
Block a user