add dockerfile building for prometheus to jenkinsfile

This commit is contained in:
2018-11-03 20:29:51 -04:00
parent 2e6cb21d22
commit 790f838a91
3 changed files with 28 additions and 20 deletions

View File

@@ -13,10 +13,10 @@ node('docker') {
stage('build') { stage('build') {
dir(workdir) { dir(workdir) {
docker.withRegistry('http://dkregistry.xai-corp.net:5000') { docker.withRegistry('http://dkregistry.xai-corp.net:5000') {
def customImage = docker.build("dkregistry.xai-corp.net:5000/${app_name}:latest", "-f Dockerfile .") def customImage = docker.build("dkregistry.xai-corp.net:5000/xaicorp/${app_name}:latest", "-f Dockerfile .")
customImage.push() customImage.push()
} }
sh "docker-compose -f ${build_file} pull" sh "docker-compose -f ${deployment_file} pull"
} }
} }
@@ -24,7 +24,11 @@ node('docker') {
dir(workdir) { dir(workdir) {
sh """ sh """
docker stack deploy -c ${deployment_file} ${service_name} docker stack deploy -c ${deployment_file} ${service_name}
docker service update -q ${service_name}_${app_name} docker service update -q ${service_name}_prometheus
docker service update -q ${service_name}_statsd_exporter
docker service update -q ${service_name}_fluentd_exporter
docker service update -q ${service_name}_node_exporter
docker service update -q ${service_name}_graphana
""" """
} }
} }

View File

@@ -20,13 +20,12 @@ services:
- 9090:9090 - 9090:9090
volumes: volumes:
- prometheus-storage:/prometheus - prometheus-storage:/prometheus
healthcheck:
# logging: test: ["CMD", "wget", "--spider", "http://localhost:9090/metrics"]
# driver: fluentd interval: 1m30s
# options: timeout: 10s
# fluentd-address: "logs.xai-corp.net:24224" retries: 3
# fluentd-async-connect: 'true' start_period: 3m
# tag: metrics
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
@@ -66,6 +65,12 @@ services:
resources: resources:
limits: limits:
memory: 512M memory: 512M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/metrics"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 3m
postgres_exporter: postgres_exporter:
image: wrouesnel/postgres_exporter image: wrouesnel/postgres_exporter
@@ -75,7 +80,7 @@ services:
DATA_SOURCE_NAME: "postgresql://xaicorp_admin:snqioxni1sw@tasks.postgres:5432/?sslmode=disable" DATA_SOURCE_NAME: "postgresql://xaicorp_admin:snqioxni1sw@tasks.postgres:5432/?sslmode=disable"
deploy: deploy:
mode: replicated mode: replicated
replicas: 0 replicas: 1
restart_policy: restart_policy:
condition: any condition: any
delay: "1s" delay: "1s"

View File

@@ -19,13 +19,13 @@ scrape_configs:
static_configs: static_configs:
- targets: ['prometheus:9090'] - targets: ['prometheus:9090']
- job_name: glusterfs #- job_name: glusterfs
metrics_path: /metrics # metrics_path: /metrics
scrape_interval: 120s # scrape_interval: 120s
scrape_timeout: 14s # scrape_timeout: 14s
static_configs: # static_configs:
- targets: # - targets:
- 'cubox-i.xai-corp.net:9189' # - 'cubox-i.xai-corp.net:9189'
# - 'home.xai-corp.net:9189' # - 'home.xai-corp.net:9189'
- job_name: fluentd - job_name: fluentd
@@ -73,7 +73,6 @@ scrape_configs:
metrics_path: '/metrics' metrics_path: '/metrics'
scrape_interval: 60s scrape_interval: 60s
scrape_timeout: 9s scrape_timeout: 9s
scheme: https
static_configs: static_configs:
- targets: - targets:
- 'metrics.xai-corp.net' - 'metrics_graphana:3000'