Simple remote server management system, based on bash scripts, and works with anything.
  • C++ 75.1%
  • Shell 11.1%
  • Python 8.1%
  • Go 5.2%
  • CMake 0.4%
Find a file
j 474fc472b7
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 3m33s
Build-Test-Publish / build (linux/arm64) (push) Successful in 15m34s
validate-template: warn when an UPSTREAM_IMAGES entry is never pulled
check-updates compares the host's own copy of each UPSTREAM_IMAGES entry
with its registry, and only a docker pull refreshes that copy. A build
reuses it, `docker build --pull` gives BuildKit the new base without
re-tagging it, and _ensure_image keeps it. So a template that lists a base
and never pulls it is reported as out of date after every install, while
its builds stay on the old base. skclubcapture did this with alpine:latest
and kept being rebuilt on an Alpine 3.22 image from July 2025.

The new check passes an image when a script that runs docker pull expands
$UPSTREAM_IMAGES or names the image, in any docker.io/library spelling. A
different tag, a longer name, a comment, --pull and _ensure_image do not
count. Digest-pinned entries are skipped, as check-updates skips them.

TEMPLATES.md now says a template has to pull what it lists, and no longer
claims that install.sh always pulls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 20:05:25 +13:00
.example dropshell release 2025.0524.1149 2025-05-24 11:49:24 +12:00
.gitea/workflows Update CI registry from gitea.jde.nz to forge.jde.nz 2026-04-05 14:59:32 +12:00
.vscode Major refactor 2025-12-30 08:43:06 +13:00
source validate-template: warn when an UPSTREAM_IMAGES entry is never pulled 2026-11-26 20:05:25 +13:00
.gitignore Untrack agent worktrees and ignore them 2026-08-27 22:43:18 +12:00
.gitmodules tidying 2025-04-22 20:35:09 +12:00
BACKUPS.md Show each service's last backup in backup-destinations 2026-10-25 13:55:29 +13:00
Brewfile Add native macOS build support; untrack generated agent sources 2026-06-15 14:59:07 +12:00
build.sh fix: ensure reproducible builds and extract dsagent binaries from cont 2026-09-13 18:55:58 +12:00
CLAUDE.md Reach a server at several addresses by the one each host can use 2026-10-19 19:38:30 +13:00
Dockerfile.dropshell-build fix: ensure reproducible builds and extract dsagent binaries from cont 2026-09-13 18:55:58 +12:00
dropshell-install.sh Add native macOS build support; untrack generated agent sources 2026-06-15 14:59:07 +12:00
dropshell-server-autosetup.sh Add Docker stale socket restarts, idempotent change reporting, and fix 2026-10-24 12:10:35 +13:00
LICENSE . 2025-04-21 09:58:37 +12:00
publish.sh publish: replace UPX packing with strip-only on Linux to fix aarch64 S 2026-09-09 08:27:28 +12:00
README.md Pull cloudflared image afresh on install to ensure tunnel sidecar is u 2026-11-01 23:13:31 +13:00
TEMPLATES.md validate-template: warn when an UPSTREAM_IMAGES entry is never pulled 2026-11-26 20:05:25 +13:00
test.sh test: Add 1 and update 2 files 2025-08-17 21:12:13 +12:00

Dropshell

A system management tool for server operations, written in C++.

Installation

curl -fsSL https://getbin.xyz/dropshell-install | bash

This installs as dropshell for the local user, with a symbolic link ds. You'll need to run:

~/.local/bin/dropshell edit
~/.local/bin/dropshell install
source ~/.bashrc

to configure dropshell and install the local components.

Remote server setup

Initial setup

Auto setup script which creates a dropshell user, and includes installing docker if not already present. As root:

curl -fsSL https://getbin.xyz/dropshell-server-autosetup | bash

It is idempotent: re-run on a server that is already set up, it changes nothing, and its last line says so (Changed: nothing). Anything it does change is listed there instead. dus setup re-runs it, as root, on every machine in the mesh that has been set up for dropshell, for the users each was set up for.

Besides the dropshell user, it turns on Docker's live-restore and sets up the restart of containers left on a replaced Docker socket. With live-restore a docker-ce upgrade no longer restarts every container, but a container that bind-mounts /var/run/docker.sock then keeps the socket file the upgrade deleted, and every Docker call it makes is refused. A drop-in for docker.service (/etc/systemd/system/docker.service.d/dropshell-stale-socket-mounts.conf) runs /usr/local/libexec/dropshell/restart-stale-socket-mounts each time dockerd starts, which restarts each running container whose socket mount the kernel marks //deleted. The setup also runs it once itself, for any an earlier upgrade left.

Manual steps:

  1. apt install curl wget jq
  2. curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh && rm get-docker.sh
  3. useradd -m dropshell && usermod -aG docker dropshell && chsh -s /bin/bash dropshell
  4. Put appropriate ssh keys in /home/dropshell/.ssh/authorized_keys
  5. Test ssh'ing into the server.

Configure and use a remote server

Add to local dropshell configuration, and install remote agent

Back on the dropshell host:

  1. dropshell create-server SERVERNAME
  2. dropshell edit SERVERNAME
  3. dropshell install-server SERVERNAME

install-server installs the agent and then brings the host in line with its fleet's settings (see Fleet settings): the image mirror, the nightly backup job and the backup credentials. Run it again whenever you like; a host that already matches is left alone.

For a server with no GPUs, add this optional setting to its server.json:

"SKIP_GPU_CHECKS": true

This skips the server in ds gpu and disables GPU discovery and service GPU binding checks in hardware and status reports. CPU, memory, storage and service health checks still run. Omit the setting or set it to false to enable GPU checks. Update the remote agent with ds install-server SERVER after upgrading Dropshell so its hardware and service probes recognise the setting.

Install services

Create and install a service

  1. ds scan-templates -- see what templates are available to install.
  2. ds create SERVICENAME SERVERNAME -- from the template of the same name; add a TEMPLATE to use another.
  3. ds edit SERVICENAME SERVERNAME
  4. Edit other config files if needed.
  5. ds install SERVICENAME SERVERNAME
  6. ds list

The service should now be seen to be running.

Checking for updates

ds check-updates    # or: ds outdated

This pulls every template repo (in parallel), checks each server's agent and service hashes against the local templates, and presents a summary of what's outdated.

It also spots a host that no longer matches its fleet: a changed mirror, model store, backup destination, schedule or password shows as a Host row, and is fixed by running install-server on that server. And it names every overdue backup (see Overdue backups), which no update fixes but which is worth knowing.

You can then choose to update agents and hosts only, or everything. Updates run in a specific order to maintain infrastructure availability:

  1. wm-registry first (VPN registry must be up before gateways can re-register)
  2. wm-gateway(s) next (VPN gateways may provide SSH connectivity to other servers)
  3. magicssh-registry (the relays SSH_JUMP servers are reached through)
  4. The fleet's infrastructure (the services definition.json names as image mirror, model store, backup destinations and hwspecs), so nothing pulls through a mirror while it is being replaced
  5. Everything else in parallel

Each template repo is pulled at most once per run, so parallel service installs never trigger redundant git pulls.

Backups

Dropshell uses restic for encrypted, deduplicated backups stored on a central backup server.

Setup

  1. Deploy ds-backup-server on a server the others can reach, with its master password in the secret store:

    openssl rand -hex 32 | ds secrets set ds-backup-password
    ds create ds-backup-server myhost
    ds edit ds-backup-server myhost   # BACKUP_PASSWORD="${secret:ds-backup-password}"
    ds install ds-backup-server myhost
    
  2. Name it as a destination in the server definition's definition.json, and say when the nightly backup runs:

    {
        "name": "j_dropshell",
        "backup_destinations": {
            "unraid": "unraid.home/ds-backup-server",
            "june": "pve.june/ds-backup-server"
        },
        "backup_destination": "unraid",
        "backup_schedule": "02:00"
    }
    

    Everything a client needs is read from that service's own service.env: the repository URL from the server's address and RESTIC_PORT, the dashboard from WEBUI_PORT, and the passwords from BACKUP_PASSWORD and WEBUI_PASSWORD. So each is written down once. Dropshell derives a unique per-server password from the master one via HMAC-SHA256, so one compromised server's key opens only that server's own repos.

    backup_destination names the default and can be left out when there is only one destination.

  3. ds install-server all. Each server gets a cron job for its nightly backup, and each backup-capable service the restic credentials it needs for it.

Commands

ds backup SERVICE SERVER                  # Manual backup to restic server
ds backup all     SERVER                  # Backup all services on a server
ds restore SERVICE SERVER                 # Restore from latest snapshot (confirms first)
ds restore SERVICE SERVER <snapshot>      # Restore from specific snapshot ID
ds snapshots SERVICE                      # Snapshots for a service (or a template) on every server
ds backup-destinations                    # Which destination each service backs up to, and when it last did
ds backup-destinations --check            # ...and whether each remote agrees

Each server/service combination gets its own restic repository (deduplication is within a single repo only, not across services or servers). The backup server's web dashboard shows all repositories, snapshot counts, and disk usage. Backup data is encrypted at rest; the REST server runs without auth and relies on the mesh for network isolation.

Template authors: implement backup.sh and restore.sh in your template to make a service backupable. See TEMPLATES.md for the contract.

Choosing where each server backs up to

A server backs up to BACKUP_DESTINATION in its server.json, else to its definition's backup_destination. Its nightly backup runs at BACKUP_SCHEDULE in its server.json ("HH:MM", or "none" for no nightly backup), else at the definition's backup_schedule. ds backup-destinations shows what each service resolved to and why, and the date of its newest backup there.

A change reaches the servers with ds install-server, which ds check-updates offers for every server whose credentials no longer match, and ds backup-destinations --check lists the services whose deployed destination disagrees with the configuration.

Overdue backups

A nightly backup that fails says so only in the host's backup_cron.log, so ds list, ds list SERVER, ds backup-destinations and ds check-updates look for the result instead. A service on a server that backs up nightly is overdue when its newest snapshot is more than 36 hours old, or when it has none: a night that fails shows by the middle of the next day. Its Last backup is marked, and each one is named after the table:

[WRN] Backups overdue: these services back up nightly, but their newest backup is more than 36 hours old.
[WRN]   voyager.clabula.com/wm-registry: newest 20261016, 3 days ago (nightly at 05:00)

ds backup SERVICE SERVER runs one there and then, and shows any error. A server with no schedule (backed up by hand, if at all) is not judged.

See BACKUPS.md for the full picture: how backups work, setting up a destination, restoring, scheduling, retention, and giving a template backups.

Fleet settings (definition.json)

~/.dropshell/dropshell.json describes the machine you run dropshell on: where the server definitions and templates are, the log level, and the keys that open each definition's secret store. Everything about the fleet is in the server definition itself, in definition.json, which is committed:

{
    "name": "j_dropshell",
    "image_mirror": "unraid.home/zot-registry",
    "model_store": "unraid.home/llm-model-cache",
    "hwspecs": "epyc.home/hwspecs",
    "backup_destinations": {
        "unraid": "unraid.home/ds-backup-server",
        "june": "pve.june/ds-backup-server"
    },
    "backup_destination": "unraid",
    "backup_schedule": "02:00",
    "cf_tunnels": {
        "clabtree.com": "${secret:cf-tunnel-clabtree-com}"
    }
}

Each role names a service as SERVER/SERVICE. How to reach it comes from that service's own configuration, so a port or password is written down once:

Role Read from the service Each server gets
image_mirror REGISTRY_PORT IMAGE_MIRROR=ADDRESS:REGISTRY_PORT (127.0.0.1:… on the mirror's own host)
model_store PORT MODEL_STORE_URL=http://ADDRESS:PORT
backup_destinations RESTIC_PORT, WEBUI_PORT, BACKUP_PASSWORD, WEBUI_PASSWORD rest:http://ADDRESS:RESTIC_PORT and its credentials
hwspecs HWSPECS_PORT, HWSPECS_TOKEN used by ds gpu on this machine

ADDRESS is how the other hosts reach a server: ADDRESS in its server.json, else its SSH_HOST. Set it where the two differ, such as a server reached through a jump host (whose SSH_HOST is the tunnel's end) or one whose name is public DNS.

It can be a list, in order of preference, for a server that different hosts reach different ways: a LAN IP for the hosts beside it and a mesh IP for the rest, say.

"ADDRESS": ["10.1.2.1", "172.29.2.2"]

For each such server a host uses, ds install-server asks the host which of the addresses answer and records the first that does in the host's routes.json, beside its server.json:

{ "tower.work": "172.29.2.2" }

From then on that host uses that address, and so does dropshell whenever it runs restic there. Commit the file with the rest of the definition. Running install-server again asks again; a host where none answers keeps the address it had, with a warning. This machine, for the backup dashboards and hwspecs, tries the addresses in order.

A server can override a role in its server.json: IMAGE_MIRROR or MODEL_STORE ("SERVER/SERVICE" or "none"), BACKUP_DESTINATION (a destination name) and BACKUP_SCHEDULE ("HH:MM" or "none").

ds install-server writes what a server resolves to into its server_info.env, which every service script sees, and then runs the agent's host-setup.sh:

  • dockerd: live-restore on, and plain HTTP allowed to the image mirror. A host that already matches needs nothing; changing one needs root, as an SSH user or by root SSH, and is a SIGHUP reload, so no container restarts.
  • backups: each SSH user's cron job and its services' restic credentials.
  • mirror login: when the image mirror's service names PUSH_USER and PUSH_PASSWORD (a ${secret:...} reference), each SSH user's docker login to it, so what the host builds can be pushed to the mirror's local/ namespace. The password goes to docker login and nowhere else on the host.
  • checks: whether the host reaches the mirror, the model store and its backup destination. An unreachable one is a warning, never a failure.

After every install, ds install keeps the image of each of the service's containers in the image mirror: a pulled image by asking the mirror for its exact digest, a local build by pushing it. ds rootscript SERVER archive-images does the same for every container already on a host.

A template must not set IMAGE_MIRROR, MODEL_STORE_URL, BACKUP_DESTINATION, BACKUP_URL or BACKUP_SCHEDULE: on the server, service.env is loaded after server_info.env, so it would override the fleet's value. ds install refuses a service whose template or service.env sets one, and ds validate-template reports it.

A malformed definition.json (an unknown key, a reference that is not SERVER/SERVICE, a default destination that does not exist) stops every command except ds edit and ds secrets, saying what is wrong. Whether a named service exists, and has the port it needs, is checked when it is used.

Credentials stay in the secret store. The ds-backup-server's BACKUP_PASSWORD and WEBUI_PASSWORD are ${secret:...} references in its service.env, and cf_tunnels tokens are references in definition.json. A missing or malformed reference stops the command, naming the file, the setting and the secret; resolved values never appear in that error.

A CF_DOMAIN service's tunnel credentials (cloudflared/config.yml and creds.json) are generated from its zone's cf_tunnels token on every ds install, into the copy that is synced, never into the server definition. An install that cannot reach the Cloudflare API keeps the credentials already deployed, and a config-only sync (reload-config, validate-config) always does. Each ds install of a service that runs the _cf_start_container sidecar also pulls cloudflare/cloudflared:latest afresh before the old service stops, so a tunnel is as current as its service's last install; ds start runs the copy already on the host.

Command reference

Where a command takes SERVICE [SERVER], the server can be left out when the service exists on only one. Where it takes a server or a service (health, data, ssh, edit), one name is enough: a server, or a service on the server that has it. The older names — backupdata, restoredata, list-backups, destinations, create-service, edit-server, info-json, log — still work, and so does create-service's old argument order.

General

Command Description
ds help [COMMAND] Show help, or detailed help for a specific command
ds version Show dropshell version
ds edit Edit dropshell global configuration
ds edit override Edit local overrides
ds edit definition Edit definition.json (fleet name, image mirror, model store, backups, cf_tunnels) and check it
ds list [SERVER] List servers, or one server's services, and their status
ds search [--json] [--status] STRING Search for services matching a pattern across all servers

Server management

Command Description
ds create-server SERVER Create a new server entry
ds edit SERVER Edit server configuration (server.json)
ds install-server SERVER|all Install the agent and bring the host in line with its fleet (or every server, several at once, then a summary)
ds enable SERVER Re-enable a previously disabled server
ds disable SERVER Disable a server while keeping all data intact
ds ssh SERVER SSH into a server
ds hostinfo SERVER Display hardware and system info for a server
ds hostinfo [SERVER] --json Hardware info as JSON, for every server or just one
ds health SERVER Check health of all services on a server
ds health SERVICE [SERVER] Check health of one service

Service lifecycle

Service-related commands always take SERVICE first, then SERVER. This lets you tab-complete the service name first and discover which server it lives on without remembering. Server-only operations remain <command> SERVER.

Commands that destroy data (destroy, phoenix, migrate-destroy, restore) say what they are about to do and ask first. --yes (-y) answers for you, and is required when stdin is not a terminal.

Command Description
ds create SERVICE SERVER [TEMPLATE] Create a new service from a template (by default the one named like the service)
ds edit SERVICE [SERVER] Edit service configuration
ds install SERVICE|all SERVER Install or update a service
ds uninstall SERVICE|all SERVER Uninstall a service (keeps config and data)
ds destroy SERVICE|all [SERVER] [--yes] Destroy a service, erasing everything local and remote
ds phoenix SERVICE [SERVER] [--yes] Destroy and recreate a service, preserving configuration

Service operations

Command Description
ds start SERVICE|all SERVER Start a service
ds stop SERVICE|all SERVER Stop a service
ds logs SERVICE [SERVER] View logs for a service
ds ssh SERVICE [SERVER] SSH into a service's docker container
ds run SERVICE SERVER SCRIPT [ARGS...] Run a template script for a service
ds reload-config SERVICE SERVER Sync config and hot-reload on the remote server
ds validate-config SERVICE SERVER Sync config and validate it on the remote server
ds migrate SERVICE SOURCE_SERVER DEST_SERVER Migrate a service between servers (uninstalls the old one)
ds migrate-destroy SERVICE SOURCE_SERVER DEST_SERVER [--yes] Migrate a service, destroying the old one

Templates

Templates are found by scanning, not by registration. Set template_search_paths in ~/.dropshell/dropshell.json to the directory holding your code:

"template_search_paths": ["~/code"]

Every directory below that containing a template_info.env is a template. Depth doesn't matter, one repo can hold as many as you like, and the git repo each template belongs to is worked out from the directory tree. There is nothing to register and no list to refresh — every command rescans, which takes a few tens of milliseconds.

Template names come from the directory name and must be unique across all search paths. A clash is an error: those templates can't be used until you rename or remove all but one. Run ds scan-templates to see them.

Command Description
ds scan-templates Show every template found, which repo it's in, and any name clashes
ds create-template TEMPLATE [DIR] Create a new template in DIR/TEMPLATE
ds validate-template TEMPLATE Validate a template's structure and syntax
ds pull git pull --ff-only every repo holding templates

Backups

Command Description
ds backup SERVICE|all SERVER Backup service data to restic server
ds restore SERVICE [SERVER] [SNAPSHOT|latest] Restore from a backup snapshot (shows it and confirms first)
ds snapshots TEMPLATE|SERVICE List backup snapshots for a template or a service across all servers
ds explore-backup SERVICE [SERVER] Browse backups and export files from them
ds backup-destinations [--check] Show each backup destination, which services back up to it, and when they last did

Updates

Command Description
ds check-updates [SERVER] [--agents|--all] Check for outdated agents, hosts, services and images, and offer to update (or update without asking)

Remote scripts

Command Description
ds rootscript SERVER|all SCRIPT [ARGS...] Run a script on a remote server as root (falls back to dropshell user)

Built-in scripts: safe-update (safely update system packages), sysinfo (gather system info).

Utilities

Command Description
ds hash [FILE|DIRECTORY] Hash a file or directory

GPU support

Templates can select a GPU by model name rather than device index. The _gpu_docker_flags helper is available in all template scripts via common.sh and resolves the correct docker flags at deploy time:

  • GPU_MODEL=nvidia → first NVIDIA card (--gpus device=UUID via nvidia-smi)
  • GPU_MODEL=amd → first AMD/Radeon card (--device /dev/dri/renderDN --group-add GID via lspci)
  • GPU_MODEL=intel → first Intel GPU (same as AMD)
  • GPU_MODEL=4080 → specific model substring, tried against nvidia-smi (name and uuid) then lspci
  • GPU_MODEL=a750 → model alias, mapped to an exact PCI vendor:device id
  • GPU_MODEL=8086:56a1 → explicit PCI vendor:device id
  • GPU_MODEL=0000:03:00.0 → PCI bus address (domain optional: 03:00.0) — the exact slot. Use this (or an NVIDIA uuid fragment) to pin a service to one of several identical cards; a name substring or vendor:device id always picks the first match.

ds hostinfo SERVER lists every GPU on a host with all of the accepted selector strings (name, uuid, vendor:device id, PCI bus address), so you never need to ssh in to find them.

Usage in a template's start.sh:

GPU_FLAGS=$(_gpu_docker_flags "$GPU_MODEL")
docker run ${GPU_FLAGS} ...

Fail-fast check in install-pre.sh (runs while the old service is still live):

_gpu_docker_flags "$GPU_MODEL" > /dev/null

For docker-compose templates, resolve to an index first:

export GPU_DEVICE_INDEX=$( ... )  # resolved from GPU_MODEL
docker compose up -d
# compose YAML: device_ids: ['${GPU_DEVICE_INDEX}']

Tailscale per-service isolation

When multiple services run on the same host, each can get its own Tailscale node identity and ACL tags — without LXC or VMs — using a lightweight sidecar pattern built into common.sh.

Set in service.env (all blank = disabled, no overhead):

TAILSCALE_AUTH_KEY=          # pre-authorized key from Tailscale admin console
TAILSCALE_HOSTNAME=          # tailnet hostname (defaults to CONTAINER_NAME)
TAILSCALE_TAGS=tag:my-svc   # must match the key's allowed tags
TAILSCALE_USERSPACE=false    # true if /dev/net/tun unavailable

In start.sh (docker run templates):

docker run $(_ts_network_args) ...

In start.sh + compose YAML (docker-compose templates):

export TS_NETWORK_MODE=$(_ts_compose_network_mode)
docker compose up -d
network_mode: ${TS_NETWORK_MODE:-host}

In uninstall.sh:

_ts_remove_sidecar

When disabled, _ts_network_args returns --network host (or a custom fallback) with no sidecar started. When enabled, a tailscale/tailscale:stable container named ${CONTAINER_NAME}_ts is started automatically, the service container joins its network namespace, and it appears as a separate node on the tailnet with its own IP and ACL tags — independent of the host's Tailscale node.