Adds support for maintenance mode to Kamal. There are two new commands: - `kamal app maintenance` - puts the app in maintenance mode - `kamal app live` - puts the app back in live mode In maintenance mode, the kamal proxy will respond to requests with a 503 status code. It will use an error page built into kamal proxy. You can use your own error page by setting `error_pages_path` in the configuration. This will copy any 4xx.html or 5xx.html files from that page to a volume mounted into the proxy container.
29 lines
663 B
Ruby
29 lines
663 B
Ruby
module Kamal::Commands::App::Proxy
|
|
delegate :proxy_container_name, to: :config
|
|
|
|
def deploy(target:)
|
|
proxy_exec :deploy, role.container_prefix, *role.proxy.deploy_command_args(target: target)
|
|
end
|
|
|
|
def remove
|
|
proxy_exec :remove, role.container_prefix
|
|
end
|
|
|
|
def live
|
|
proxy_exec :resume, role.container_prefix
|
|
end
|
|
|
|
def maintenance(**options)
|
|
proxy_exec :stop, role.container_prefix, *role.proxy.stop_command_args(**options)
|
|
end
|
|
|
|
def remove_proxy_app_directory
|
|
remove_directory config.proxy_app_directory
|
|
end
|
|
|
|
private
|
|
def proxy_exec(*command)
|
|
docker :exec, proxy_container_name, "kamal-proxy", *command
|
|
end
|
|
end
|