[mproxy](https://github.com/kevinmcconnell/mproxy) 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.
37 lines
582 B
YAML
37 lines
582 B
YAML
# helper aliases
|
|
chicago_hosts: &chicago_hosts
|
|
hosts:
|
|
- 1.1.1.1
|
|
- 1.1.1.2
|
|
tokyo_hosts: &tokyo_hosts
|
|
hosts:
|
|
- 1.1.1.3
|
|
- 1.1.1.4
|
|
web_common: &web_common
|
|
env:
|
|
ROLE: "web"
|
|
proxy: true
|
|
|
|
# actual config
|
|
service: app
|
|
image: dhh/app
|
|
servers:
|
|
web:
|
|
<<: *chicago_hosts
|
|
<<: *web_common
|
|
web_tokyo:
|
|
<<: *tokyo_hosts
|
|
<<: *web_common
|
|
workers:
|
|
cmd: bin/jobs
|
|
<<: *chicago_hosts
|
|
workers_tokyo:
|
|
cmd: bin/jobs
|
|
<<: *tokyo_hosts
|
|
env:
|
|
REDIS_URL: redis://x/y
|
|
registry:
|
|
server: registry.digitalocean.com
|
|
username: user
|
|
password: pw
|