[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.
56 lines
1.5 KiB
Ruby
56 lines
1.5 KiB
Ruby
require_relative "integration_test"
|
|
|
|
class IntegrationAppTest < IntegrationTest
|
|
test "stop, start, boot, logs, images, containers, exec, remove" do
|
|
kamal :envify
|
|
|
|
kamal :deploy
|
|
|
|
assert_app_is_up
|
|
|
|
kamal :app, :stop
|
|
|
|
assert_app_is_down
|
|
|
|
kamal :app, :start
|
|
|
|
# kamal app start does not wait
|
|
wait_for_app_to_be_up
|
|
|
|
kamal :app, :boot
|
|
|
|
wait_for_app_to_be_up
|
|
|
|
logs = kamal :app, :logs, capture: true
|
|
assert_match /App Host: vm1/, logs
|
|
assert_match /App Host: vm2/, logs
|
|
assert_match /GET \/ HTTP\/1.1/, logs
|
|
|
|
images = kamal :app, :images, capture: true
|
|
assert_match /App Host: vm1/, images
|
|
assert_match /App Host: vm2/, images
|
|
assert_match /registry:4443\/app\s+#{latest_app_version}/, images
|
|
assert_match /registry:4443\/app\s+latest/, images
|
|
|
|
containers = kamal :app, :containers, capture: true
|
|
assert_match /App Host: vm1/, containers
|
|
assert_match /App Host: vm2/, containers
|
|
assert_match /registry:4443\/app:#{latest_app_version}/, containers
|
|
assert_match /registry:4443\/app:latest/, containers
|
|
|
|
exec_output = kamal :app, :exec, :ps, capture: true
|
|
assert_match /App Host: vm1/, exec_output
|
|
assert_match /App Host: vm2/, exec_output
|
|
assert_match /1 root 0:\d\d ps/, exec_output
|
|
|
|
exec_output = kamal :app, :exec, "--reuse", :ps, capture: true
|
|
assert_match /App Host: vm1/, exec_output
|
|
assert_match /App Host: vm2/, exec_output
|
|
assert_match /1 root 0:\d\d nginx/, exec_output
|
|
|
|
kamal :app, :remove
|
|
|
|
assert_app_is_down
|
|
end
|
|
end
|