Skip to content

Commit

Permalink
Adding some notes to README and a commented example to haproxy template.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Martinez committed May 6, 2016
1 parent d825591 commit 8b0f970
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,32 @@ The default template shipped with Bamboo is aware of `BAMBOO_TCP_PORT`. When thi

In this example, both `BAMBOO_TCP_PORT` and `MY_CUSTOM_ENV` can be accessed in HAProxy template. This enables flexible template customization depending on your preferences.

#### Default Haproxy Template ACL

The default acl rule in the `haproxy_template.cfg` uses the full
marathon app id, which may include slash-separated groups.

```
# This is the default proxy criteria
acl {{ $app.EscapedId }}-aclrule path_beg -i {{ $app.Id }}
```

For example if your app is named "/mygroup/appname", your default acl
will be `path_beg -i /mygroup/appname`. This can always be changed
using the bamboo web UI.

There is also a DNS friendly version of your marathon app Id which can
be used instead of the slash-separated one. `MesosDnsId` includes the
groups as hyphenated suffixes. For example, if your appname is
"/another/group/app" then the `MesosDnsId` will be "app-group-another".

You can edit the `haproxy_template.cfg` and use the DNS friendly name
for your default ACL instead.

```
acl {{ $app.EscapedId }}-aclrule hdr_dom(host) -i {{ $app.MesosDnsId }}
```

### Environment Variables

Configuration in the `production.json` file can be overridden with environment variables below. This is generally useful when you are building a Docker image for Bamboo and HAProxy. If they are not specified then the values from the configuration file will be used.
Expand Down
2 changes: 2 additions & 0 deletions config/haproxy_template.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ frontend http-in

# This is the default proxy criteria
acl {{ $app.EscapedId }}-aclrule path_beg -i {{ $app.Id }}
# another possible default using DNS-friendly MesosDnsId:
#acl {{ $app.EscapedId }}-aclrule hdr_dom(host) -i {{ $app.MesosDnsId }}
use_backend {{ $app.EscapedId }}-cluster if {{ $app.EscapedId }}-aclrule
{{ end }} {{ end }}

Expand Down

0 comments on commit 8b0f970

Please sign in to comment.