Class: Mrsk::Cli::Server

Inherits:
Base
  • Object
show all
Defined in:
lib/mrsk/cli/server.rb

Instance Method Summary collapse

Methods inherited from Base

exit_on_failure?, #initialize

Constructor Details

This class inherits a constructor from Mrsk::Cli::Base

Instance Method Details

#bootstrapObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mrsk/cli/server.rb', line 3

def bootstrap
  missing = []

  on(MRSK.hosts | MRSK.accessory_hosts) do |host|
    unless execute(*MRSK.docker.installed?, raise_on_non_zero_exit: false)
      if execute(*MRSK.docker.superuser?, raise_on_non_zero_exit: false)
        info "Missing Docker on #{host}. Installing…"
        execute *MRSK.docker.install
      else
        missing << host
      end
    end
  end

  if missing.any?
    raise "Docker is not installed on #{missing.join(", ")} and can't be automatically installed without having root access and the `curl` command available. Install Docker manually: https://docs.docker.com/engine/install/"
  end
end