Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Lightweight configuration management tool based on AWS Autoscaling Group

AirVantage/overlord

Repository files navigation

overlord

overlord is a lightweight configuration management tool focused on:

  • keeping local configuration files up-to-date reagarding AWS Autoscaling Group (ASG).
  • reloading applications to pick up new config file changes

It's heavily inspired by confd.

Getting Started

  1. Download latest release of overlord binaries: here.
  2. Create a configuration file for your application in /etc/overlord/resources/. This toml file (it has to have the .toml extension) describes the ASG to monitor, the configuration file to keep up-to-date and how to restart the application.
  3. Create a template of your application's configuration file in /etc/overlord/temlates/ in golang format.

Here is an example with an HAProxy configuration:

/etc/overlord/resources/haproxy.toml:

[template]
src = "haproxy.cfg.tmpl" #template used to generate configuration file (located in /etc/overseer/temlates/)
dest = "/etc/haproxy/haproxy.cfg" #file to generate from the template
hosts = ["my-asg"] #ASG to monitor
reload_cmd = "touch /var/run/haproxy.pid; haproxy -D -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)" #command to reload the configuration

/etc/overlord/temlates/haproxy.cf.tmpl:

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

listen  my-app
	bind *:80
	bind *:443
	balance roundrobin
	{{range $index, $ip := index . "my-asg"}}server my-backend-{{$index}} {{$ip}}
	{{end}}

Advanced Template Features

Instance Details

In addition to IP addresses, overlord now provides detailed instance information including lifecycle state, health status, and more. This allows for more sophisticated configuration logic.

Template Data Structure

Templates now receive a data structure with two main sections:

  • .ips - Backward compatible IP address lists (same as before)
  • .instances - Detailed instance information

Instance Information Fields

Each instance in the .instances array provides:

Example Template with Instance Details

# Backward compatible IP access
{{range index .ips "my-asg"}}
  IP: {{.}}
{{end}}

# New instance details access
{{range index .instances "my-asg"}}
  Instance: {{.InstanceID}}
  IP: {{.GetIP false}}
  Lifecycle State: {{.LifecycleState}}
  Health Status: {{.HealthStatus}}
  Is Healthy: {{.IsHealthy}}
{{end}}

# Conditional logic based on lifecycle state
{{range index .instances "my-asg"}}
  {{if eq .LifecycleState "InService"}}
    server backend-{{.InstanceID}} {{.GetIP false}} check
  {{else if eq .LifecycleState "Terminating"}}
    # Instance is being terminated, exclude from config
  {{end}}
{{end}}

# Only include healthy instances
{{range index .instances "my-asg"}}
  {{if .IsHealthy}}
    server healthy-backend-{{.InstanceID}} {{.GetIP false}} check
  {{end}}
{{end}}

This enhanced functionality allows for more sophisticated load balancer configurations, health-aware routing, and better monitoring integration.

About

Lightweight configuration management tool based on AWS Autoscaling Group

Topics

Resources

Stars

Watchers

Forks

Contributors 5