#!/usr/bin/env bash

_ensure_swarm() {
  if [ "$(docker info | grep Swarm | sed 's/Swarm: //g' | tr -d ' ')" == "inactive" ]; then
    run docker swarm init
    assert_success
  fi

  if ! $(docker network ls | grep -q 'proxy'); then
    run docker network create -d overlay proxy
    assert_success
  fi
}
