What's Kamal 2.6.0 maintenance mode

Kamal finally came with one its most awaited feature called maintenance mode. The new maintenance mode let's us open a downtime maintenance window for our apps to do any necessary updates and migrations.

Table of contents

Maintenance mode

Kamal splits application deployment into two modes, live and maintenance . Application deployed by Kamal is live by default, but can be now switch into the maintenance mode (which was part of Kamal Proxy for awhile now is now available directly in Kamal).

Two new commands were added to Kamal:

  • kamal app maintenance puts the app to maintenance mode
  • kamal app live puts the app to live mode

In maintenance mode, the Kamal proxy will respond to requests with a 503 status code, indicating that the service is temporarily unavailable. An error page built into the Kamal Proxy will be displayed to users during maintenance.

Here's how the default maintenance page looks like:

By implementing maintenance mode, Kamal now offers users a way to gracefully handle maintenance periods without disrupting the user experience.

Custom error pages

Users can also set their custom error pages by configuring the error_pages_path in the application's configuration. This settings can change any status pages, not just the 503 for the maintenance:

# config/deploy.rb
...
# Error pages
#
# A directory relative to the app root to find error pages for the proxy to serve.
# Any files in the format 4xx.html or 5xx.html will be copied to the hosts.
error_pages_path: public
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