Skip to content

overneath/serf

Repository files navigation

Nothin' but Serf

Hashicorp Serf

But Why Though

I needed a minimal installation of hashicorp/serf, downloaded and verified from the official Serf downloads page. This serves as a simple, containerized installation source.

Docker

To install into an image via Dockerfile:

COPY --from=overneath/serf:0.8 /opt/local/ /usr/local/

LinuxKit

To underlay in minimalist LinuxKit composition:

kernel:
  # ...
init:
  - linuxkit/init:v0.6
  # ...
  - overneath/serf:0.8
onboot:
  # ...
services:
  # ...
  - name: serf
    image: alpine:3.7
    binds:
      - /etc/resolv.conf:/etc/resolv.conf
      - /run/config/serf:/etc/serf
      - /opt/local:/usr/local
      - /var/lib/serf:/var/lib/serf
    command: [/usr/local/bin/serf, agent, -config-dir=/etc/serf, -tags-file=/var/lib/serf/tags.json]
    runtime:
      mkdir:
        - /run/config/serf
        - /var/lib/serf

To verify that the LinuxKit build is working, invoke via linuxkit run and then after the OS comes up in the getty console:

nsenter -a -t 1 /opt/local/bin/serf members

E.g. (in the linuxkit run console):

(ns: getty) linuxkit-025000000006:~# nsenter -a -t 1 /opt/local/bin/serf members
linuxkit-025000000006  127.0.0.1:7946  alive
(ns: getty) linuxkit-025000000006:~#
(ns: getty) linuxkit-025000000006:~# poweroff
The system is going down NOW!0006:~# ^[[20;38R
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
[   17.369562] ACPI: Preparing to enter system sleep state S5
[   17.371389] reboot: Power down