How to use Kamal Proxy with accessories

Do you want to deploy an auxiliary service that comes with a dashboard? Then you might want to proxy it with Kamal Proxy.

Table of contents

Proxying dashboards

A lot of services we might want to deploy come with an HTTP interface. As an example you might want to deploy PgHero to help optimize your database, Grafana to see your metrics, or Minio to self host your S3-like service. Originally, Kamal didn't support proxying accessories, but since version 2.4.0 we are in luck.

So, how can we proxy these kind of services? We can use the same proxy: block we already know, just assign it to our accessory part of the configuration:

accessories:
  resque-dashboard:
    image: appwrite/resque-web:1.1.0
    proxy:
      ssl: true
      host: rescue.example.com
      app_port: 5678
      healthcheck:
        path: /
    env:
      clear:
        RESQUE_WEB_HOST: [HOST]
        RESQUE_WEB_PORT: 6379
        RESQUE_WEB_HTTP_BASIC_AUTH_USER: admin
        RESQUE_WEB_HTTP_BASIC_AUTH_PASSWORD: [PASSWORD]

As you can see we can pass ssl: true for a given hostname and things should work out of the box. Let's just not forget that Kamal will still run healthchecks for the service as if it's [SERVICE]-web .

Author
Josef Strzibny
I am a full stack web developer with love for Linux. I made and deployed my first commercial web applications during high school in 2008. I have worked for Red Hat on the platform and developer experience teams as a Linux packager.

© Deploy Linux Blog