Sign inSign up

gianarb/keepit

By gianarb

Updated almost 6 years ago

A replica set for Equinix Metal Devices. A very simple way to keep your instances well balanced.

Image
0

557

gianarb/keepit repository overview

keepit

This tool acts like a replica set for Equinix Metal Devices.

Very often you need to keep balanced a number of nodes, think about those use case:

  1. You have a fronted and you want 4 replicas of the same Rails application
  2. You have to deploy an ingress gateway with haproxy or nginx and you need a mechanism to keep the number of devices stable

How does it work

The binary is driven by a configuration file that can be located in:

  • The directory where the binary starts
  • In /etc/keepit/

In both cases the configuration has to be named keepit.yaml. You can see an example of it in this repository keepit.yaml.dist

packet_api_key: ""
packet_project_id: ""
replicaset:
  name: "this-has-to-be-unique"
  replicas: 2
  plan: "c3.medium.x86"
  facility: ["ny5"]
  operating_system: "ubuntu_20_04"
  billing_cycle: "hourly"
  userdata: |
    #!/bin/bash
    apt-get update
    apt-get install -y nginx
  tags:
    - "hello"
  healthcheck:
    http:
        path: "/"
        status: 200

The replicaset describes how the device looks like and the number of replicas you want. When the program starts it looks for all the device labeled replicaset.name=this-has-to-be-unique, based on that it tries to match the desired replicas you specified deleting or creating new devices.

Change configuration live

You can change the number of replica you desire editing the configuration file. The program pick up your change automatically.

NOTE: Currently there is not support for rolling update. You can only scale up and down the number of replicas. If you change the operating system, the userdata or the plan nothing will happen.

is it an autoscaler?

No. It keeps the number of desired replica balanced. But if you can automatically change the configuration file with the desired number of replicas you got your autoscaler. I will work with a fully working example at some point I am sure!

Tag summary

Content type

Image

Digest

Size

5.8 MB

Last updated

almost 6 years ago

docker pull gianarb/keepit