Skip to content

Commit

Permalink
Merge branch 'main' into dt_session-timer-customization
Browse files Browse the repository at this point in the history
  • Loading branch information
dishanktiwari2501 committed Sep 1, 2021
2 parents 456cd0d + 0da89d2 commit 9b801a3
Show file tree
Hide file tree
Showing 25 changed files with 1,029 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .bldr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,24 @@ plan_path = "components/automate-backend-elasticsearch"
paths = [
"components/automate-backend-elasticsearch/*"
]

[automate-backend-metricbeat]
plan_path = "components/automate-backend-metricbeat"
paths = [
"components/automate-backend-metricbeat/*"
]

[automate-backend-journalbeat]
plan_path = "components/automate-backend-journalbeat"
paths = [
"components/automate-backend-journalbeat/*"
]

[automate-backend-haproxy]
plan_path = "components/automate-backend-haproxy"
paths = [
"components/automate-backend-haproxy/*"
]
# GENERATED_HAB_PACKAGE_CONFIG_END

[automate-workflow-ctl]
Expand Down
3 changes: 3 additions & 0 deletions HABITAT_PACKAGES
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ automate-builder-api-proxy components/automate-builder-api-proxy
sample-data-service components/sample-data-service
user-settings-service components/user-settings-service
automate-backend-elasticsearch components/automate-backend-elasticsearch
automate-backend-metricbeat components/automate-backend-metricbeat
automate-backend-journalbeat components/automate-backend-journalbeat
automate-backend-haproxy components/automate-backend-haproxy
41 changes: 41 additions & 0 deletions components/automate-backend-haproxy/habitat/config/haproxy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
global
stats socket {{pkg.svc_var_path}}/run/haproxy.sock mode 600 level admin
stats timeout 2m
maxconn {{cfg.maxconn}}

defaults
log global
retries 2
mode {{cfg.front-end.mode}}
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
timeout check 5000ms

listen postgresql
bind {{cfg.front-end.listen}}:{{cfg.front-end.port}}
{{#if cfg.httpchk}}
option httpchk {{cfg.httpchk}}
{{~/if}}
default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
{{~#if bind.database}}
{{~#eachAlive bind.database.members as |dbmember|}}
server {{dbmember.sys.ip}} {{dbmember.sys.ip}}:{{dbmember.cfg.port}} maxconn {{cfg.server.maxconn}} check port "${PGLEADERCHK_PORT}"
{{~/eachAlive}}
{{~else}}
server {{sys.ip}} {{sys.ip}}:{{cfg.pg.port}} maxconn {{cfg.server.maxconn}} check port "${PGLEADERCHK_PORT}"
{{~/if}}

{{#if cfg.status.enabled}}
listen stats
bind {{cfg.status.listen}}:{{cfg.status.port}}
mode http
log global
maxconn 10
stats enable
stats hide-version
stats refresh 30s
stats show-node
stats auth {{cfg.status.user}}:{{cfg.status.password}}
stats uri {{cfg.status.uri}}
{{~/if}}
24 changes: 24 additions & 0 deletions components/automate-backend-haproxy/habitat/default.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
maxconn = 500
httpchk = "GET /"

[server]
maxconn = 350

[front-end]
listen = "*"
port = 7432
mode = "tcp"

[status]
enabled = false
listen = "*"
port = 9000
user = "admin"
password = "password"
uri = "/haproxy-stats"

[pg]
port = 5432

[pgleaderchk]
port = 6432
14 changes: 14 additions & 0 deletions components/automate-backend-haproxy/habitat/hooks/health-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!{{pkgPathFor "core/bash"}}/bin/bash

rc=0

echo "show info" | {{pkgPathFor "core/netcat-openbsd"}}/bin/nc -U {{pkg.svc_var_path}}/run/haproxy.sock | grep -q Pid

case $? in
0)
rc=0 ;; # Golden
*)
rc=2 ;; # Critical
esac

exit $rc
5 changes: 5 additions & 0 deletions components/automate-backend-haproxy/habitat/hooks/init
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!{{pkgPathFor "core/bash"}}/bin/bash

exec 2>&1

mkdir -p {{pkg.svc_var_path}}/run
19 changes: 19 additions & 0 deletions components/automate-backend-haproxy/habitat/hooks/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!{{pkgPathFor "core/bash"}}/bin/bash

exec 2>&1

export PGLEADERCHK_PORT

{{~#if bind.pgleaderchk}}
{{~#eachAlive bind.pgleaderchk.members as |pgchkmember|}}
{{~#if @last}}
# this variable is defined here then used in haproxy.conf where
# haproxy interpolates it at load time.
PGLEADERCHK_PORT={{pgchkmember.cfg.port}}
{{~/if}}
{{~/eachAlive}}
{{~else}}
PGLEADERCHK_PORT={{cfg.pgleaderchk.port}}
{{~/if}}

exec {{pkgPathFor "core/haproxy"}}/bin/haproxy -f {{pkg.svc_config_path}}/haproxy.conf -db
45 changes: 45 additions & 0 deletions components/automate-backend-haproxy/habitat/plan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# shellcheck disable=SC2148
UPSTREAM_PKG_IDENT="core/haproxy"
pkg_name="automate-backend-haproxy"
pkg_description="Wrapper package for core/haproxy"
vendor_origin="chef"
pkg_maintainer="Chef Software Inc. <[email protected]>"
pkg_license=("Chef-MLSA")
pkg_upstream_url="https://www.chef.io/automate"
pkg_version="1.0.28"
pkg_build_deps=("${UPSTREAM_PKG_IDENT}")
pkg_deps=(
chef/mlsa
core/bash
core/netcat-openbsd
"${UPSTREAM_PKG_IDENT}"
)


pkg_exports=(
[port]=front-end.port
[status-port]=status.port
)

pkg_exposes=(port status-port)

pkg_binds_optional=(
[database]="port superuser_name"
[pgleaderchk]="port"
)

do_before() {
update_pkg_version
}

do_download() {
return 0
}

do_build() {
return 0
}

do_install() {
return 0
}
11 changes: 11 additions & 0 deletions components/automate-backend-journalbeat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Automate-Backend-Journalbeat

This is a wrapper package of core/journalbeat for Chef Automate Backend.

## Maintainers

The Habitat Maintainers [email protected]

## Type of Package

This is a service package.
Loading

0 comments on commit 9b801a3

Please sign in to comment.