[mproxy](https://github.com/basecamp/parachute) is a custom minimal proxy designed specifically for Kamal. It has two big advantages over Traefik: 1. Imperative deployments - we tell it to switch from container A to container B, and it waits for container B to start then switches. No need to poll for health checks ourselves or mess around with forcing health checks to fail. 2. Support for multiple apps - as much as possible, configuration is supplied at runtime by the deploy command, allowing us to have multiple apps share an instance of mproxy without conflicting config.
32 lines
435 B
Ruby
32 lines
435 B
Ruby
class Kamal::Cli::App::Barrier
|
|
def initialize
|
|
@ivar = Concurrent::IVar.new
|
|
end
|
|
|
|
def close
|
|
set(false)
|
|
end
|
|
|
|
def open
|
|
set(true)
|
|
end
|
|
|
|
def wait
|
|
unless opened?
|
|
raise Kamal::Cli::BootError.new("Halted at barrier")
|
|
end
|
|
end
|
|
|
|
private
|
|
def opened?
|
|
@ivar.value
|
|
end
|
|
|
|
def set(value)
|
|
@ivar.set(value)
|
|
true
|
|
rescue Concurrent::MultipleAssignmentError
|
|
false
|
|
end
|
|
end
|