Portrait of Christopher

Christopher Bennell

I’m a full-stack web developer specializing in Ruby on Rails and Education Technology. Get in touch.

A Script for Kamal Proxy

Here’s a simple shell for interacting with kamal-proxy on your host. It wraps a call to docker-exec, passing the arguments you provide to the kamal-proxy executable in your kamal-proxy container.

kp.sh
1
2
3
4
#!/bin/bash

#Run the docker exec command with the provided arguments
docker exec kamal-proxy kamal-proxy "$@"

You can now do:

1
2
3
4
5
6
7
8
9
chmod u+x kp.sh

./kp.sh list
Service                   Host                  Target             State    TLS
cbennell_com-web-main     cbennell.com          6db082a60a7f:8043  running  no
cbennell_com-web-staging  staging.cbennell.com  478d9119f70a:8043  running  no

./kp.sh stop cbennell_com-web-staging --message "Offline for maintenance"
./kp.sh resume cbennell_com-web-staging"

When the service is stopped, we get kamal’s nice error page:

Screenshot of kamal error screen showing custom error message