haztakki-yritys / guppi
Guppi is a friendly command line for deploying applications with Kamal. It runs on your own machine and talks to your servers over SSH.
Requires
- php: ^8.5
- aws/aws-sdk-php: ^3.408
- guzzlehttp/guzzle: ^7.17
- illuminate/http: ^13.0
- laravel-zero/foundation: ^13.23
- laravel-zero/framework: ^13.0
- symfony/yaml: ^8.1
- vlucas/phpdotenv: ^5.8
Requires (Dev)
- laravel/pint: ^1.32
- mockery/mockery: ^1.6.12
- pestphp/pest: ^4.7.8 || ^5.0.3
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-29 20:31:41 UTC
README
Guppi is a friendly command line for deploying applications with Kamal. It runs on your own machine and talks to your servers over SSH.
The name
Guppi is named after GUPPI, the ship's interface in Dennis E. Taylor's Bobiverse books, which start with We Are Legion (We Are Bob). Bob tells GUPPI what he wants, and GUPPI gets on with it. This Guppi does the same for your servers. You say what you want, and it deals with Kamal, SSH, Docker, Hetzner and Cloudflare.
Requirements
- PHP 8.5
- Kamal 2.12 or newer, the version Guppi is tested with, plus git and SSH
- The GitHub CLI,
gh, signed in to an account that can read the repository, for installing and updating ageandzstdfor restoring backups, and Docker forguppi backup:verify
Installing and updating
Releases are published on GitHub as a single file. Download the latest one with the GitHub CLI.
gh release download --repo haztakki-yritys/guppi --pattern guppi --dir ~/.local/bin --clobber && chmod +x ~/.local/bin/guppi
Make sure ~/.local/bin is on your PATH, which macOS doesn't do for you.
guppi update downloads the latest release, checks it against its published checksum and swaps it in, so a failed download never breaks Guppi. When Guppi runs from a git checkout instead, guppi update pulls the latest code and runs composer install. Guppi's versions are MAJOR.MINOR, such as v1.2. The major number goes up when an upgrade needs a change to guppi.yml or to how a command is run, and the minor number for everything else. Pushing a version tag builds and publishes a release.
Setting up a project
Run guppi init in the project's folder. It creates a guppi.yml with one protected production environment, deployed from the branch the repository is on. When the project has no config/deploy.yml, it writes one that uses a registry on your own machine, so no registry account is needed. A folder with an index.html and no Dockerfile also gets a Dockerfile that serves it with nginx. It starts a git repository when there isn't one, because Kamal labels each release with a commit, and keeps .env.guppi out of git. Then shape guppi.yml to fit, such as this.
timezone: Europe/Helsinki default: qa environments: production: protected: true branch: master qa: destination: qa branch: [qa, release/*] laravel: role: web queues: [default, images]
environmentslists each environment.destinationis the Kamal destination, soqausesconfig/deploy.qa.yml. Leave it out forconfig/deploy.yml.protectedmakes Guppi ask you to type the environment's name before it changes anything there.branchlists the branches that deploy to the environment when pushed. Wildcards such asrelease/*work. When two environments match a branch, the first one listed wins.defaultis the environment Guppi uses when you don't choose one.laravel.roleis the Kamal role that Artisan runs in. It defaults toweb.laravel.queueslists the queues to report on. It defaults todefault.timezoneis the time zone Guppi shows times in. It defaults to UTC. You can set your own in~/.config/guppi/config.yml, which wins over the project's. Guppi uses$XDG_CONFIG_HOME/guppiinstead of~/.config/guppiwhen that variable is set.namenames the project in Cloudflare Access and in backup key files. It defaults to the project's folder name.
guppi environment:add adds another environment, such as qa, without editing YAML. It asks for its name, the branches that deploy to it and whether it's protected, or takes --branch, --protected and --domain. Then it writes config/deploy.qa.yml with its own service name, volumes and accessory hosts, so it gets its own containers, files and database on the shared server. It copies .kamal/secrets to .kamal/secrets.qa, because Kamal reads only that file and .kamal/secrets-common for a destination, so change anything QA shouldn't share with production. Last, it runs guppi domain:add for its domain. When deploy.yml has accessories, such as MySQL, it reminds you to give the new environment's copies their own ports.
Guppi connects to the primary host that Kamal reports, with Kamal's SSH user and port. Anything else, such as a proxy command for Cloudflare Tunnel, goes in your ~/.ssh/config. Guppi doesn't read Kamal's ssh.proxy setting, so put a bastion in ~/.ssh/config too.
guppi ssh:alias adds an environment's server to ~/.ssh/config, so ssh example signs in with Kamal's address, user and port. The default environment's alias is the project's name, and other environments add their own, such as example-qa. Pass a name to choose another. The alias checks the server against .guppi/known_hosts, and goes above any Host * block so its settings win. --proxy-command adds a ProxyCommand, such as cloudflared access ssh --hostname %h for Cloudflare Tunnel, and --remove removes the alias again. Guppi only changes aliases it added, keeps a linked ~/.ssh/config a link, and leaves the rest of the file as it was.
Guppi keeps each server's SSH host key in .guppi/known_hosts, and gives Kamal the same key. Commit it, so every machine and every GitHub runner checks it is talking to the real server. Before Kamal runs, Guppi checks every host in Kamal's config this way and gives Kamal the same keys, because Kamal trusts the first key it sees for a host it doesn't know. When the CI variable is set, as it is in GitHub Actions, Guppi only trusts the committed key. If a new server gets an old server's address, run guppi server:provision --new-server to forget the old key.
guppi server:create makes the new server's host key itself and hands it to the server through cloud-init, so even the first connection checks it. Hetzner keeps cloud-init's settings where any program on the server can read them, so guppi server:provision replaces that key with a new one the server makes, over the connection the first key protected.
Hetzner and Cloudflare tokens belong to accounts, which Guppi keeps on your machine in ~/.config/guppi/accounts, readable only by you. The first command that needs a token asks which saved account the project uses, or lets you add and name a new one, such as the company it belongs to. It saves the choice in guppi.yml under accounts, so every machine knows which account to use, while the tokens never enter the repository. guppi doctor shows the account each provider uses. If a provider refuses a token, Guppi says which file holds it.
guppi account:listshows the accounts saved on this machine and which one this project uses, without showing the tokens.guppi account:addsaves another account, andguppi account:useswitches this project to a different one. Without a terminal,account:addandaccount:tokenread each token from the environment variable of the same name, such asHCLOUD_TOKEN, so a script can set a machine up.guppi account:tokenreplaces an account's tokens,guppi account:renamerenames it, andguppi account:forgetdeletes it from this machine, asking first unless you pass--force. Forgetting an account doesn't revoke its tokens, so delete them in Hetzner or Cloudflare as well.
Guppi keeps your comments and layout when it changes guppi.yml, and only rewrites the settings that changed. When a change is too unusual to make that way, such as one inside an anchor, it writes the whole file again and says so.
A token in the project's .env.guppi wins over its account. Other secrets, such as backup keys, go in .env.guppi too. Guppi adds it to .gitignore whenever it saves a secret there. Your shell is only used for a secret that neither file has.
Servers
server: name: app type: cx33 location: fsn1 image: ubuntu-24.04 ssh_keys: [laptop] user: guppi swap: 4G reboot_time: '04:00' firewall: app ssh_from: []
guppi server:createcreates the server in Hetzner Cloud. It asks for a Hetzner Cloud API token the first time. Whenguppi.ymlleaves out the name, location, type or SSH keys, it asks for them. When the Hetzner project has no SSH keys, it offers to add yours from~/.sshor your SSH agent. The server starts behind a Hetzner Cloud Firewall that lets only your machine's addresses reach SSH, its IPv4 address and its IPv6 network, or the addresses inssh_from, while the web ports stay open so Let's Encrypt can issue certificates. It lists only the server types Hetzner sells in that location, with their price, then saves your choices and the server's address inguppi.yml. It points Kamal's deploy files at the new server, previews included, replacing the placeholder fromguppi initor the old server's address, and matches the build architecture to the server.guppi server:provisioninstalls Docker with log rotation and a current rclone, adds swap, turns on automatic security updates and creates theuser, which can't be root. It offers to connect the server to Cloudflare Tunnel, and saves the tunnel token asCLOUDFLARE_TUNNEL_TOKEN. Last, it turns off root and password sign-in, but only once the new user can sign in and Kamal signs in as that user. Any Docker settings already on the server are kept. It waits for cloud-init and the first package updates to finish. Use--hostand--user=rootfor a brand new server.guppi server:destroydeletes the server in Hetzner Cloud after you type its name. Then it lists the Cloudflare DNS records that point at it and asks which to delete. Kamal keeps its address, so the nextguppi server:createmoves it to the new server.guppi server:firewallupdates that firewall so only Cloudflare can reach ports 80 and 443. Run it once Cloudflare proxies the domains. SSH stays closed unlessssh_fromlists addresses, so check that SSH through the tunnel works first.--allow-this-machineadds your machine's addresses tossh_fromfirst. Guppi only changes firewalls it made, and asks before it uses a server it didn't make.
Backups
backups: environment: production database: accessory: mysql schedule: hourly files: volumes: [app-storage] schedule: '*-*-* 03:00:00' retention: hourly: 2 daily: 14 monthly: 365 keep_on_server: 3 alerts: [ops@example.com] verify_tables: [users, orders] destinations: germany: endpoint: https://fsn1.your-objectstorage.com region: fsn1 bucket: app-backups hetzner_project: 1234567
The server dumps the database hourly and archives the volumes daily. It compresses and encrypts each backup with age and uploads it to every destination. The server only holds the public key, so it can't read its own backups.
The database's first backup each day is also kept as a daily copy, and the first each month as a monthly one. Each copy is locked in compliance mode for as long as it is kept, so nobody can delete it early, not even you. A bucket has to be created with object lock, so Guppi refuses a bucket without it. Lifecycle rules on each bucket remove it once its time is up. Changing the retention only affects new backups.
Each destination uses two keys. The admin key stays in your .env.guppi and manages the bucket. The upload key goes to the server. For Hetzner, Guppi adds a bucket policy that stops the upload key deleting backups or changing the bucket's rules, and then checks that the policy works. The policy also stops the upload key locking a backup for longer than the longest retention, so a leaked key can't lock backups for years. Changing the retention moves that limit. When you shorten it, the limit stays at the old length until the server uses the new retention, because it keeps its old locks until guppi backup:install. Keys you replace stay limited, but delete them in the Hetzner Console too. It needs hetzner_project, the ID in the Hetzner Console address of the project that holds the upload key. Restores always read the first version of a backup, so a file written over it later can't take its place, and they ignore any file not named like a backup. A restore keeps a copy of the target database on the server in /var/lib/guppi/before-restore, then empties it and imports the backup. Without a terminal, a restore into a protected environment needs --backup, because anyone with the upload key could add a backup that looks real. The upload key also can't put legal holds on backups. For other S3 providers, pass --path-style to guppi backup:destination if they need path-style addresses.
When a backup fails, or only reaches some destinations, everyone in alerts gets an email. Set ALERT_FROM, ALERT_SMTP_URL, ALERT_SMTP_USERNAME and ALERT_SMTP_PASSWORD for that. Add BACKUP_HEARTBEAT_URL for database backups and BACKUP_FILES_HEARTBEAT_URL for files backups to hear about backups that don't run at all.
| Command | What it does |
|---|---|
guppi backup:key |
Creates the encryption key, and keeps older keys so older backups still restore. Store a copy of each private key somewhere safe |
guppi backup:destination <name> |
Adds or changes a destination and its keys, creates the bucket with object lock, and limits the upload key |
guppi backup:retention |
Changes how long backups are kept, and applies it to every bucket |
guppi backup:alerts <emails> |
Chooses who gets an email when a backup fails, and asks for the SMTP server to send it through the first time. --none turns the emails off |
guppi backup:install |
Installs the backup script, its settings and its timers on the server. It asks which environment to back up the first time, and keeps the upload key's lock limit long enough for what the server uploads |
guppi backup:run [files] |
Backs up the database, or the files, now |
guppi backup:status |
Shows how the latest backups went and when the next ones run |
guppi backup:list |
Lists the backups in a destination |
guppi backup:restore -e qa |
Checks a backup is whole, then restores it into an environment. Protected environments also need --into-protected |
guppi backup:verify |
Restores the latest backup into a throwaway MySQL on your machine that keeps its tables in memory, and counts the rows in verify_tables |
Files backups work the same way. Name what you want after the command, such as guppi backup:verify files, or leave it out and Guppi asks, or uses the database when it can't ask. guppi backup:verify files downloads the newest files backup, decrypts it and reads it to its end, then says how many files it holds and from which volumes. guppi backup:restore files -e qa stops the app, saves each volume to /var/lib/guppi/before-restore on the server, replaces its files and starts the app again, even when the restore fails. An environment other than the backups environment gets the volume guppi environment:add made for it, such as app-storage-qa, and Guppi never guesses its way into production's volume, so name another with --into-volume and choose volumes with --volume. Restoring files into a protected environment follows the database rules, so it needs --into-protected, and --backup when there's no terminal.
Previews
previews: base: qa host: '{name}-preview.example.com' reverb_host: '{name}-preview-reverb.example.com' seeder: DevelopmentSeeder
A preview runs on the base environment's server and uses its MySQL and Redis, so the base can't be a protected environment. Each preview has a database and Redis prefix of its own. Guppi passes the preview's settings to Kamal as GUPPI_PREVIEW_NAME, GUPPI_PREVIEW_HOST, GUPPI_PREVIEW_REVERB_HOST, GUPPI_PREVIEW_DATABASE, GUPPI_PREVIEW_REDIS_PREFIX and GUPPI_PREVIEW_VOLUME, which the project's config/deploy.preview.yml reads. Label its containers with guppi-preview so Guppi can find them.
| Command | What it does |
|---|---|
guppi preview:deploy <name> |
Creates or updates a preview, including changes you have not committed. A new preview runs the seeder |
guppi preview:list |
Lists the previews on the server |
guppi preview:destroy <name> |
Removes a preview with its containers, database and files |
guppi preview:prune |
Removes previews that have not been deployed for 14 days |
Other commands work on a preview with -e preview:<name>, such as guppi logs -e preview:pr-12.
Domains
guppi domain:add puts one or more domains on an environment, such as guppi domain:add sample.example.com. Without a domain, it asks, and offers www. alongside a bare domain. Then it does four things.
- It points each domain at the server in Cloudflare DNS, with IPv6 too when Guppi can find the server in Hetzner. Any other A, AAAA or CNAME record at the name is listed, and replaced only once you agree.
- It adds the domains to the proxy in the environment's Kamal deploy file with
ssl: true, keeping the file's comments. When the file uses ERB, Guppi shows what to add instead. It warns when another environment would inherit these domains fromdeploy.yml. - It offers to deploy, then visits the site so Kamal's proxy gets a Let's Encrypt certificate.
- It offers to send visitors through Cloudflare's proxy. If the domain's SSL/TLS mode would loop, it asks before changing it to Full (strict), since that applies to every site on the domain.
It asks for a Cloudflare API token the first time. Give the token Zone Read, DNS Edit and Zone Settings Edit, plus Access: Apps and Policies Edit if you use Cloudflare Access.
Cloudflare Access
access: emails: [] email_domains: [example.com] applications: Admin: example.com/admin Previews: '*-preview.example.com' SSH: domain: ssh.example.com service_tokens: true
guppi access:add, access:remove and access:people change these settings, and guppi access:apply makes Cloudflare match them. access:people asks who may sign in, or takes --email, --domain, --remove-email and --remove-domain. access:apply asks for the Cloudflare API token and account ID the first time, and only updates an application when its address or policies changed. Guppi names everything it creates “Guppi · ·”, and only touches its own project's applications.
service_tokens: true, which guppi access:add --service-tokens sets, also lets any Cloudflare Access service token in, which is how GitHub Actions reaches SSH through the tunnel. In a GitHub workflow, pass the token to cloudflared access ssh through TUNNEL_SERVICE_TOKEN_ID and TUNNEL_SERVICE_TOKEN_SECRET, so it stays out of the process list.
What Guppi can deploy
Guppi works with plain HTML sites served by nginx, and with Laravel apps. A project counts as Laravel when guppi.yml has a laravel section, which guppi init adds when it finds artisan. The commands that need Artisan, console, artisan, queue, down and up, are hidden in other projects, and status and schedule leave out the Laravel parts.
Everyday commands
Every command that works on an environment takes --environment or -e. Without it, Guppi asks when there are several environments, or uses the default when it can't ask. On a protected environment, commands that change something take --force to skip typing its name. For guppi artisan, only options before the Artisan command are Guppi's, so guppi artisan migrate --force --env=testing passes both on to Artisan. Outside a project, guppi list shows only the commands that work there, such as init, doctor, update and the account commands.
| Command | What it does |
|---|---|
guppi status |
Shows each role, the server's disk, memory and load, and the queues |
guppi deploy |
Deploys the current commit |
guppi rollback [version] |
Goes back to an earlier release, chosen from a list, even when the current one has crashed |
guppi logs [role] |
Reads the logs, with --follow, --lines, --since and --grep |
guppi console |
Opens Tinker |
guppi artisan … |
Runs any Artisan command, such as guppi artisan -e qa migrate:status. Guppi's options go before the Artisan command |
guppi shell [role] |
Opens a shell in a container |
guppi queue |
Shows each queue and the latest failed jobs |
guppi schedule |
Lists the Laravel tasks and server timers, and when they next run |
guppi down |
Puts the app into maintenance mode and prints a link that still lets you in |
guppi up |
Brings the app out of maintenance mode |
guppi access |
Lists the addresses behind Cloudflare Access and who may open them |
guppi ci:environment <branch> |
Prints the environment a branch deploys to, for GitHub Actions |
guppi doctor |
Checks that your machine and the project are ready, whether Guppi is up to date, and which accounts the project uses |
down only takes every container offline when the app uses Laravel's cache maintenance driver, so set APP_MAINTENANCE_DRIVER=cache and APP_MAINTENANCE_STORE=redis.
Development
composer install
composer test
composer format
To use a checkout as your guppi, link it onto your PATH with ln -s "$PWD/guppi" ~/.local/bin/guppi.
License
The MIT License (MIT). Please see the license file for more information.