Permalink
Browse files

Added load balancer

Signed-off-by: Graham Weldon <graham@grahamweldon.com>
  • Loading branch information...
predominant committed Sep 7, 2018
1 parent bdc1710 commit 839ca2fb3d61a8c4464783f7b4118e08c2b9376f
@@ -0,0 +1,2 @@
results/
.DS_Store
@@ -0,0 +1,13 @@
# Habitat package: site-loadbalancer

## Description

Front end load balancer for all my websites.

## Usage

```
hab svc load grahamweldon/site-loadbalancer \
--bind grahamweldon:site-grahamweldon.default \
--strategy at-once
```
@@ -0,0 +1,23 @@
# ------------------------------
# Common Settings
# ------------------------------
(common) {
gzip
tls graham@grahamweldon.com

header / {
Strict-Transport-Security "max-age=15768000"
X-XSS-Protection "1; mode=block"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
}
}

# ------------------------------
grahamweldon.com {
import common
proxy / {{#eachAlive bind.grahamweldon.members as |member| ~}}{{member.sys.ip}}:{{member.cfg.http-port}} {{/eachAlive ~}}{
transparent
policy round_robin
}
}
@@ -0,0 +1,9 @@
[http]
port = 80

[https]
enabled = true
port = 443

[gzip]
enabled = true
@@ -0,0 +1,3 @@
#!/bin/sh

kill -USR1 "$(cat {{pkg.svc_pid_file}})"
@@ -0,0 +1,30 @@
pkg_name=site-loadbalancer
pkg_origin=grahamweldon
pkg_version="1.0.0"
pkg_maintainer="Graham Weldon <graham@grahamweldon.com>"
pkg_license=("Apache-2.0")
pkg_description="Front load balancer for all my sites"
pkg_deps=(
core/caddy
)
pkg_svc_run="caddy -conf ${pkg_svc_config_path}/Caddyfile"
pkg_exports=(
[http-port]=http.port
[https-port]=https.port
)
pkg_exposes=(http-port https-port)
pkg_binds=(
[grahamweldon]="http-port"
)

# Require root for port < 1024 binding.
pkg_svc_user="root"
pkg_svc_group="${pkg_svc_user}"

do_build() {
return 0
}

do_install() {
return 0
}

0 comments on commit 839ca2f

Please sign in to comment.