Add haproxy-statsd to haproxy server
Build a container image with the haproxy-statsd script, and run that along with the haproxy container. Change-Id: I18be70d339df613bf9a72e115e80a6da876111e0
This commit is contained in:
parent
1330ed82c8
commit
5faf89f566
37
.zuul.yaml
37
.zuul.yaml
@ -131,6 +131,33 @@
|
|||||||
vars: *gitea_vars
|
vars: *gitea_vars
|
||||||
files: *gitea_files
|
files: *gitea_files
|
||||||
|
|
||||||
|
# Haproxy-statsd jobs
|
||||||
|
- job:
|
||||||
|
name: system-config-build-image-haproxy-statsd
|
||||||
|
description: Build a haproxy-statsd image.
|
||||||
|
parent: system-config-build-image
|
||||||
|
vars: &haproxy-statsd_vars
|
||||||
|
docker_images:
|
||||||
|
- context: docker/haproxy-statsd
|
||||||
|
repository: opendevorg/haproxy-statsd
|
||||||
|
# Duplicate in the run-gitea job
|
||||||
|
files: &haproxy-statsd_files
|
||||||
|
- docker/haproxy-statsd/.*
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: system-config-upload-image-haproxy-statsd
|
||||||
|
description: Build and upload a haproxy-statsd image.
|
||||||
|
parent: system-config-upload-image
|
||||||
|
vars: *haproxy-statsd_vars
|
||||||
|
files: *haproxy-statsd_files
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: system-config-promote-image-haproxy-statsd
|
||||||
|
description: Promote a previously published haproxy-statsd image to latest.
|
||||||
|
parent: system-config-promote-image
|
||||||
|
vars: *haproxy-statsd_vars
|
||||||
|
files: *haproxy-statsd_files
|
||||||
|
|
||||||
# Gerrit jobs
|
# Gerrit jobs
|
||||||
- job:
|
- job:
|
||||||
name: system-config-build-image-gerrit
|
name: system-config-build-image-gerrit
|
||||||
@ -580,6 +607,9 @@
|
|||||||
# From gitea_files -- If we rebuild the image, we want to run
|
# From gitea_files -- If we rebuild the image, we want to run
|
||||||
# this job as well.
|
# this job as well.
|
||||||
- docker/gitea/.*
|
- docker/gitea/.*
|
||||||
|
# From haproxy-statsd_files -- If we rebuild the image, we want
|
||||||
|
# to run this job as well.
|
||||||
|
- docker/haproxy-statsd/.*
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: system-config-run-zuul-preview
|
name: system-config-run-zuul-preview
|
||||||
@ -651,12 +681,15 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
- name: system-config-build-image-gitea
|
- name: system-config-build-image-gitea
|
||||||
soft: true
|
soft: true
|
||||||
|
- name: system-config-build-image-haproxy-statsd
|
||||||
|
soft: true
|
||||||
- system-config-run-zuul-preview
|
- system-config-run-zuul-preview
|
||||||
- system-config-run-letsencrypt
|
- system-config-run-letsencrypt
|
||||||
- system-config-build-image-jinja-init
|
- system-config-build-image-jinja-init
|
||||||
- system-config-build-image-gitea-init
|
- system-config-build-image-gitea-init
|
||||||
- system-config-build-image-gitea
|
- system-config-build-image-gitea
|
||||||
- system-config-build-image-gerrit
|
- system-config-build-image-gerrit
|
||||||
|
- system-config-build-image-haproxy-statsd
|
||||||
- system-config-build-image-python-base
|
- system-config-build-image-python-base
|
||||||
- system-config-build-image-python-builder
|
- system-config-build-image-python-builder
|
||||||
gate:
|
gate:
|
||||||
@ -674,12 +707,15 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
- name: system-config-upload-image-gitea
|
- name: system-config-upload-image-gitea
|
||||||
soft: true
|
soft: true
|
||||||
|
- name: system-config-upload-image-haproxy-statsd
|
||||||
|
soft: true
|
||||||
- system-config-run-zuul-preview
|
- system-config-run-zuul-preview
|
||||||
- system-config-run-letsencrypt
|
- system-config-run-letsencrypt
|
||||||
- system-config-upload-image-jinja-init
|
- system-config-upload-image-jinja-init
|
||||||
- system-config-upload-image-gitea-init
|
- system-config-upload-image-gitea-init
|
||||||
- system-config-upload-image-gitea
|
- system-config-upload-image-gitea
|
||||||
- system-config-upload-image-gerrit
|
- system-config-upload-image-gerrit
|
||||||
|
- system-config-upload-image-haproxy-statsd
|
||||||
- system-config-upload-image-python-base
|
- system-config-upload-image-python-base
|
||||||
- system-config-upload-image-python-builder
|
- system-config-upload-image-python-builder
|
||||||
promote:
|
promote:
|
||||||
@ -688,5 +724,6 @@
|
|||||||
- system-config-promote-image-gitea-init
|
- system-config-promote-image-gitea-init
|
||||||
- system-config-promote-image-gitea
|
- system-config-promote-image-gitea
|
||||||
- system-config-promote-image-gerrit
|
- system-config-promote-image-gerrit
|
||||||
|
- system-config-promote-image-haproxy-statsd
|
||||||
- system-config-promote-image-python-base
|
- system-config-promote-image-python-base
|
||||||
- system-config-promote-image-python-builder
|
- system-config-promote-image-python-builder
|
||||||
|
20
docker/haproxy-statsd/Dockerfile
Normal file
20
docker/haproxy-statsd/Dockerfile
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Copyright (c) 2019 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
FROM opendevorg/python-base
|
||||||
|
|
||||||
|
COPY haproxy-statsd.py /usr/local/bin
|
||||||
|
RUN pip install statsd
|
||||||
|
CMD ["/usr/local/bin/haproxy-statsd.py"]
|
2
modules/openstack_project/files/git/haproxy-statsd.py → docker/haproxy-statsd/haproxy-statsd.py
Normal file → Executable file
2
modules/openstack_project/files/git/haproxy-statsd.py → docker/haproxy-statsd/haproxy-statsd.py
Normal file → Executable file
@ -179,5 +179,5 @@ class HAProxy(object):
|
|||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
p = HAProxy('/var/lib/haproxy/stats')
|
p = HAProxy('/var/haproxy/run/stats')
|
||||||
p.run()
|
p.run()
|
@ -1,2 +0,0 @@
|
|||||||
STATSD_HOST=graphite.opendev.org
|
|
||||||
STATSD_PORT=8125
|
|
@ -1,10 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=haproxy-statsd
|
|
||||||
After=haproxy.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/local/bin/haproxy-statsd.py
|
|
||||||
EnvironmentFile=/etc/default/haproxy-statsd
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -2,7 +2,7 @@ iptables_extra_allowed_hosts:
|
|||||||
- hostname: bridge.openstack.org
|
- hostname: bridge.openstack.org
|
||||||
port: 8125
|
port: 8125
|
||||||
protocol: udp
|
protocol: udp
|
||||||
- hostname: git.openstack.org
|
- hostname: opendev.org
|
||||||
port: 8125
|
port: 8125
|
||||||
protocol: udp
|
protocol: udp
|
||||||
- hostname: firehose01.openstack.org
|
- hostname: firehose01.openstack.org
|
||||||
|
@ -10,3 +10,12 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /var/haproxy/etc:/usr/local/etc/haproxy
|
- /var/haproxy/etc:/usr/local/etc/haproxy
|
||||||
- /var/haproxy/run:/var/haproxy/run
|
- /var/haproxy/run:/var/haproxy/run
|
||||||
|
haproxy-statsd:
|
||||||
|
restart: always
|
||||||
|
image: opendevorg/haproxy-statsd:latest
|
||||||
|
network_mode: host
|
||||||
|
volumes:
|
||||||
|
- /var/haproxy/run:/var/haproxy/run
|
||||||
|
environment:
|
||||||
|
STATSD_HOST: graphite.opendev.org
|
||||||
|
STATSD_PORT: 8125
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
testinfra_hosts = ['gitea-lb01.opendev.org']
|
testinfra_hosts = ['gitea-lb01.opendev.org']
|
||||||
|
|
||||||
@ -21,3 +23,9 @@ def test_gitea_listening(host):
|
|||||||
assert gitea_https.is_listening
|
assert gitea_https.is_listening
|
||||||
gitea_http = host.socket("tcp://0.0.0.0:80")
|
gitea_http = host.socket("tcp://0.0.0.0:80")
|
||||||
assert gitea_http.is_listening
|
assert gitea_http.is_listening
|
||||||
|
|
||||||
|
def test_haproxy_statsd_running(host):
|
||||||
|
cmd = host.run("docker inspect haproxydocker_haproxy-statsd_1")
|
||||||
|
out = json.loads(cmd.stdout)
|
||||||
|
assert out[0]["State"]["Status"] == "running"
|
||||||
|
assert out[0]["RestartCount"] == 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user