Skip to content

Instantly share code, notes, and snippets.

@code-206
Created November 1, 2023 17:22
Show Gist options
  • Save code-206/b1ac802ce3e8ed910b44ef0f425117aa to your computer and use it in GitHub Desktop.
Save code-206/b1ac802ce3e8ed910b44ef0f425117aa to your computer and use it in GitHub Desktop.
Simple list of kamal commands
<!DOCTYPE html>
<html>
<head>
<title>Kamal commands</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<style>
pre {
margin-left: -8.5rem;
}
code {
color: #111;
}
</style>
</head>
<body>
<div class="container-fluid px-3 px-xl-4">
<div class="row mt-4">
<div class="col">
<code>
<h2 class="text-primary">
Kamal Commands:
</h2>
<pre class="fs-6">
kamal accessory # Manage accessories (db/redis/search)
kamal app # Manage application
kamal audit # Show audit log from servers
kamal build # Build application image
kamal config # Show combined config (including secrets!)
kamal deploy # Deploy app to servers
kamal details # Show details about all containers
kamal env # Manage environment files
kamal envify # Create .env by evaluating .env.erb (or .env.staging.erb -> .env.staging when using -d staging)
kamal healthcheck # Healthcheck application
kamal help [COMMAND] # Describe available commands or one specific command
kamal init # Create config stub in config/deploy.yml and env stub in .env
kamal lock # Manage the deploy lock
kamal prune # Prune old application images and containers
kamal redeploy # Deploy app to servers without bootstrapping servers, starting Traefik, pruning, and registry login
kamal registry # Login and -out of the image registry
kamal remove # Remove Traefik, app, accessories, and registry session from servers
kamal rollback [VERSION] # Rollback app to VERSION
kamal server # Bootstrap servers with curl and Docker
kamal setup # Setup all accessories, push the env, and deploy app to servers
kamal traefik # Manage Traefik load balancer
kamal version # Show Kamal version
</pre>
</code>
<code>
<h3 class="text-primary">
Options:
</h3>
<pre class="fs-6">
-v, [--verbose], [--no-verbose] # Detailed logging
-q, [--quiet], [--no-quiet] # Minimal logging
[--version=VERSION] # Run commands against a specific app version
-p, [--primary], [--no-primary] # Run commands only on primary host instead of all
-h, [--hosts=HOSTS] # Run commands on these hosts instead of all (separate by comma)
-r, [--roles=ROLES] # Run commands on these roles instead of all (separate by comma)
-c, [--config-file=CONFIG_FILE] # Path to config file
# Default: config/deploy.yml
-d, [--destination=DESTINATION] # Specify destination to be used for config file (staging -> deploy.staging.yml)
-H, [--skip-hooks], [--no-skip-hooks] # Don't run hooks
# Default: false
</pre>
</code>
</div>
<div class="col">
<code>
<h3 class="text-primary">
kamal accessory
</h3>
<pre class="fs-6">
kamal accessory boot [NAME] # Boot new accessory service on host (use NAME=all to boot all accessories)
kamal accessory details [NAME] # Show details about accessory on host (use NAME=all to show all accessories)
kamal accessory exec [NAME] [CMD] # Execute a custom command on servers (use --help to show options)
kamal accessory help [COMMAND] # Describe subcommands or one specific subcommand
kamal accessory logs [NAME] # Show log lines from accessory on host (use --help to show options)
kamal accessory reboot [NAME] # Reboot existing accessory on host (stop container, remove container, start new container)
kamal accessory remove [NAME] # Remove accessory container, image and data directory from host (use NAME=all to remove..
kamal accessory restart [NAME] # Restart existing accessory container on host
kamal accessory start [NAME] # Start existing accessory container on host
kamal accessory stop [NAME] # Stop existing accessory container on host
</pre>
<pre class="fs-6">
kamal accessory logs Options:
-s, [--since=SINCE] # Show lines since timestamp (e.g. 2013-01-02T13:23:37Z) / (e.g. 42m for 42 minutes)
-n, [--lines=N] # Number of lines to show from each server
-g, [--grep=GREP] # Show lines with grep match only (use this to fetch specific requests by id)
-f, [--follow=FOLLOW] # Follow log on primary server (or specific host set by --hosts)
</pre>
</code>
<code>
<h3 class="text-primary">
kamal app
</h3>
<pre class="fs-6">
kamal app boot # Boot app on servers (or reboot app if already running)
kamal app containers # Show app containers on servers
kamal app details # Show details about app containers
kamal app exec [CMD] # Execute a custom command on servers (use --help to show options)
kamal app help [COMMAND] # Describe subcommands or one specific subcommand
kamal app images # Show app images on servers
kamal app logs # Show log lines from app on servers (use --help to show options)
kamal app remove # Remove app containers and images from servers
kamal app stale_containers # Detect app stale containers
kamal app start # Start existing app container on servers
kamal app stop # Stop app container on servers
kamal app version # Show app version currently running on servers
</pre>
<pre class="fs-6 text-primary">
kamal app exec -i 'bin/rails console'
kamal app exec -i --reuse bash
kamal app logs -f
kamal env push
kamal accessory logs
</pre>
</code>
</div>
<div class="col">
<code>
<h3 class="text-primary">
kamal env
</h3>
<pre class="fs-6">
kamal env delete # Delete the env file from the remote hosts
kamal env help [COMMAND] # Describe subcommands or one specific subcommand
kamal env push # Push the env file to the remote hosts
</pre>
</code>
<code>
<h3 class="text-primary">
kamal healthcheck
</h3>
<pre class="fs-6">
kamal healthcheck help [COMMAND] # Describe subcommands or one specific subcommand
kamal healthcheck perform # Health check current app version
</pre>
</code>
<code>
<h3 class="text-primary">
kamal lock
</h3>
<pre class="fs-6">
kamal lock acquire -m, --message=MESSAGE # Acquire the deploy lock
kamal lock help [COMMAND] # Describe subcommands or one specific subcommand
kamal lock release # Release the deploy lock
kamal lock status # Report lock status
</pre>
</code>
<code>
<h3 class="text-primary">
kamal traefik
</h3>
<pre class="fs-6">
kamal traefik boot # Boot Traefik on servers
kamal traefik details # Show details about Traefik container from servers
kamal traefik help [COMMAND] # Describe subcommands or one specific subcommand
kamal traefik logs # Show log lines from Traefik on servers
kamal traefik reboot # Reboot Traefik on servers (stop container, remove container, start new container)
kamal traefik remove # Remove Traefik container and image from servers
kamal traefik restart # Restart existing Traefik container on servers
kamal traefik start # Start existing Traefik container on servers
kamal traefik stop # Stop existing Traefik container on servers
</pre>
<pre class="fs-6 text-primary">
kamal traefik reboot --rolling
</pre>
</code>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment