influx/telegraf bootstrap
This commit is contained in:
parent
56c6594b95
commit
b489fee464
|
@ -0,0 +1,50 @@
|
|||
pipeline {
|
||||
agent {
|
||||
label 'pi501.in.thelinuxpro.net'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage("verify tooling") {
|
||||
steps {
|
||||
sh '''
|
||||
docker version
|
||||
docker info
|
||||
docker compose version
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage("Build Containers and push to registry") {
|
||||
steps {
|
||||
script {
|
||||
sh 'docker compose build --push'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Create contexts') {
|
||||
steps {
|
||||
sh 'docker context ls | grep pi502 || docker context create pi502 --docker "host=ssh://pi502.in.thelinuxpro.net"'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Start container') {
|
||||
steps {
|
||||
script {
|
||||
def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi502 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml')
|
||||
|
||||
if (status_s != 0) {
|
||||
sh 'docker --context pi502 compose up -d'
|
||||
sh 'docker --context pi502 compose ps'
|
||||
} else {
|
||||
sh 'docker --context pi502 compose down
|
||||
sh 'docker --context pi502 compose up -d'
|
||||
sh 'docker --context pi502 compose ps'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
|
||||
networks:
|
||||
infra_dev_net:
|
||||
esternal: true
|
||||
|
||||
volumes:
|
||||
influxdbv2:
|
||||
driver: local
|
||||
|
||||
services:
|
||||
influxdb:
|
||||
image: influxdb:2.6-alpine
|
||||
env_file:
|
||||
- influxv2.env
|
||||
volumes:
|
||||
# Mount for influxdb data directory and configuration
|
||||
- influxdbv2:/var/lib/influxdb2:rw
|
||||
networks:
|
||||
infra_dev_net:
|
||||
ipv4_address:10.99.23.41
|
||||
ports:
|
||||
- "8086:8086"
|
||||
|
||||
telegraf:
|
||||
image: telegraf:1.25-alpine
|
||||
depends_on:
|
||||
- influxdb
|
||||
volumes:
|
||||
# Mount for telegraf config
|
||||
- ./telegraf/mytelegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||
networks:
|
||||
infra_dev_net:
|
||||
ipv4_address:10.99.23.42
|
||||
env_file:
|
||||
- influxv2.env
|
|
@ -0,0 +1,6 @@
|
|||
DOCKER_INFLUXDB_INIT_MODE=setup
|
||||
DOCKER_INFLUXDB_INIT_USERNAME=flux
|
||||
DOCKER_INFLUXDB_INIT_PASSWORD=forty6and2
|
||||
DOCKER_INFLUXDB_INIT_ORG=darkstar
|
||||
DOCKER_INFLUXDB_INIT_BUCKET=default_bucket
|
||||
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=admintoken
|
|
@ -0,0 +1,19 @@
|
|||
# Output Configuration for telegraf agent
|
||||
[[outputs.influxdb_v2]]
|
||||
## The URLs of the InfluxDB cluster nodes.
|
||||
##
|
||||
## Multiple URLs can be specified for a single cluster, only ONE of the
|
||||
## urls will be written to each interval.
|
||||
## urls exp: http://127.0.0.1:8086
|
||||
urls = ["http://influxdb.in.thelinuxpro.net:8086"]
|
||||
|
||||
## Token for authentication.
|
||||
token = "$DOCKER_INFLUXDB_INIT_ADMIN_TOKEN"
|
||||
|
||||
## Organization is the name of the organization you wish to write to; must exist.
|
||||
organization = "$DOCKER_INFLUXDB_INIT_ORG"
|
||||
|
||||
## Destination bucket to write into.
|
||||
bucket = "$DOCKER_INFLUXDB_INIT_BUCKET"
|
||||
|
||||
insecure_skip_verify = true
|
Loading…
Reference in New Issue