Skip to content
dev-toolingsPublic

About

Audit, harden and deploy Docker apps on a single VPS. Signed releases, native PostgreSQL, Swarm.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Shuttle logo

Shuttle

Deploy one application to one hardened VPS: single-node Docker Swarm, a shared Caddy edge, native PostgreSQL and signed root operations.

CI Security audit Latest release License: Apache-2.0

Installation · Quick start · Commands · Security contracts · Budgets and retention · Development · Documentation


Overview

Shuttle deploys an application to a single Ubuntu 24.04 or Debian 13 VPS. The target is deliberately narrow:

  • single-node Docker Swarm behind a shared Caddy edge;
  • native PostgreSQL (18 by default, 16 and 17 kept for existing hosts);
  • a private Redis per application and an optional RabbitMQ.

Shuttle applies a hardened posture you can verify. It does not claim to make a server "100% secure".

Installation

On Linux or macOS, with curl, jq, OpenSSL with Ed25519 and sha256sum or shasum:

curl -fsSL https://github.com/dev-toolings/shuttle/releases/latest/download/install.sh | sh
~/.local/bin/shuttle --help

The installer verifies the manifest signature and the checksum before installing.

Setting Behavior
Default prefix ~/.local/bin
SHUTTLE_INSTALL_PREFIX=/path sh install.sh installs elsewhere (download the script first)
Newer version already installed kept as is
SHUTTLE_INSTALL_ALLOW_DOWNGRADE=1 allows a downgrade
Unreadable or development version installed does not block the install

Quick start

Prerequisites

  • A dedicated Ubuntu 24.04 or Debian 13 VPS, with rescue console access.
  • A domain whose A/AAAA records point to that VPS, and reachable SSH, HTTP and HTTPS ports.
  • On your workstation: Docker with BuildKit, and an SSH key whose private part is available through ssh-agent or your SSH configuration.
  • Enough capacity: the summed memory of your services available during a promotion, and at least 20% free disk space.

The provider must have reset the VPS and installed your public key for root. Then read the ED25519 host key fingerprint from the provider's console: the key seen on the first SSH contact is not independent proof.

Deploy

shuttle init --app demo --preset nextjs \
  --domain demo.example.com --host 203.0.113.10

# Writes ./config.json next to the application sources.
# Production values stay on the VPS (secrets.backend: host).
# Once per workstation, for every agent harness:
shuttle --install skills

# Before the first deploy, point the domain directly at the VPS IPv4/IPv6
# address. Caddy then handles ACME on its own.

shuttle setup --target root@203.0.113.10 \
  --expected-host-key 'SHA256:...........................................' \
  --public-key "$HOME/.ssh/id_ed25519.pub" \
  --operator-user ops --operator-public-key "$HOME/.ssh/ops_ed25519.pub" --dry-run

# From Linux, the running executable that matches the VPS becomes the helper.
shuttle setup --target root@203.0.113.10 \
  --expected-host-key 'SHA256:...........................................' \
  --public-key "$HOME/.ssh/id_ed25519.pub" \
  --operator-user ops --operator-public-key "$HOME/.ssh/ops_ed25519.pub" --yes

shuttle doctor --strict
# In config.json, leave room for the first certificate issuance:
# for example deploy.promotion_slo_seconds = 120 and total_slo_seconds >= 120.
# That budget leaves 24 s to the direct origin proof; ACME can still fail.
shuttle deploy

Run init from your application sources. In an empty folder, some presets, node-api among them, do not create a Dockerfile: provide your own.

When it creates a Dockerfile, shuttle init resolves the stable base images within their current major and writes their digests. If a registry is unavailable, generation fails and names the image. Use --image repository:tag@sha256:<digest> to give a full identity, one flag per image. For FastAPI, the Python tag must state its major and minor version, and the uv tag must use the same Python minor. An existing Dockerfile is left unchanged without --force; with --force, the images are resolved again.

First certificate

The first ACME issuance depends on DNS and on public validation. The default budget of 30 seconds leaves only 6 seconds to the HTTPS proof, and a valid issuance can take longer. Measure the first deploy and the following ones separately before lowering the budget. Certificate and health checks stay mandatory (budgets).

Hosts you may not modify

On a host you are not allowed to change, deploy.strategy: compose deploys without setup: Shuttle builds on your workstation, sends the images over SSH and runs docker compose with an existing account named in the configuration (server.user, server.host_key). No root helper, no Swarm, no edge, and nobody enforces the hardening rendered in the file: it is the fallback mode, documented as such (strategies).

Stacks with nothing to build

A stack made only of published images, such as a Redis and a RabbitMQ shared by several applications, deploys under deploy.strategy: swarm when every service pins its image by digest. Nothing is built or pushed. See applications with nothing to build.

Administrator account

On a new VPS, a separate administrator account is mandatory: both setup calls above declare ops with its own key. Prepare that key before setup (ssh-keygen -t ed25519 -f ~/.ssh/ops_ed25519 if it does not exist), then load it into ssh-agent or declare it in your SSH configuration. It must differ from the deploy key. Shuttle checks the login and the administrator rights before and after SSH root is closed.

Important

No Linux password is generated. To administer the server, run ssh ops@203.0.113.10, then sudo -i, with no password. The end of setup prints these commands with the exact port. deploy stays the automation account, limited to the signed helper and without access to the Docker socket.

Other accounts on the server

Name other people who have an account on the server with --retain-user alice (repeatable) or setup.retained_users: they keep their SSH access, keys, groups and sudo rules as they are. Every account that is not named loses SSH at the end of setup. An account without a public key is refused before any change (details).

Adopting a host Shuttle never installed

Take over such a host with --adopt --unmanaged, arriving through an existing sudo account: the --dry-run plan describes the steps and their refusals before any --yes. Docker and PostgreSQL already running keep their configuration; the registry and the Shuttle backup and boot-order files are handled separately. The plan also lists the published ports it closes and the container that --cutover-edge stops. If that container belongs to a foreign Swarm service, Shuttle refuses the cutover: remove or scale down that service yourself, then run setup again (details).

An --adopt migration keeps the first administrator when it differs from root and deploy. From root, or with --lock-out-first-contact-user, you must give a replacement operator and its key. The provider's console remains the way back if every key is lost; a known root password does not open SSH root, which stays disabled.

Helper binary and updates

From Linux, setup can install the running executable as the helper. From macOS or Windows, download from your account the signed Linux binary of the same release (shuttle-linux-x64 or shuttle-linux-arm64) for the VPS architecture. Verify it with the distribution procedure, then add --helper-binary /absolute/path/to/linux-binary to both setup commands. No existing dist folder is required. doctor needs a configuration, a server identity already attested and the helper installed by setup; it is not an instant audit.

Once a recent helper is installed, its updates no longer need a root login: shuttle helper status shows its contract, then shuttle helper update --dry-run and shuttle helper update --yes replace the executable through a signed Ed25519 operation. A helper older than this contract must be replaced one last time from the provider's root console.

Commands

The public interface has exactly seventeen commands:

init  infra  setup  deploy  backup  doctor  debug  helper  status  logs
secrets  skills  run  rollback  destroy  update  operations

For an existing platform-owned Swarm, see existing-stack deployments. After a digest-verified upgrade, retention.keep_releases (default 1, minimum 1) removes superseded release tags and registry manifests only from the configured build repositories. Live service and task images stay protected. Cleanup failures warn without failing the upgrade; platform-owned offline registry GC reclaims unreferenced blobs. Rollback completes inside the platform apply command before cleanup runs.

Security contracts

  • The first SSH contact is bound to an ED25519 fingerprint obtained out of band.
  • deploy belongs neither to sudo nor to the docker group and cannot reach the Docker socket.
  • An explicitly configured operator account is separate from deploy, logs in only with its own key and receives general root sudo. This diagnostic convenience is a root delegation, not a read-only mode.
  • shuttle debug covers everyday Docker diagnostics without widening the rights of deploy: the signed helper accepts only reads bounded to the application's resources, and the inspect view exposes no environment, secrets, labels, commands or mounts. Logs stay the opaque text the application produces: no tool can recognize every secret in them.
  • The only accepted root operations are short, typed Ed25519 plans, each limited to what it names: SSH hardening and its rollback, the audit, a declared application operation (migration, task), secret publication, stack apply, its rollback, reclaiming the images of superseded releases and the bounded update of the helper itself. No plan carries a shell.
  • The helper refuses images not pinned by digest, public application ports, privileged containers, the host network, the Docker socket and host mounts.
  • PostgreSQL listens only on loopback and docker_gwbridge, with SCRAM.
  • The PostgreSQL cluster starts after Docker (32-postgres-boot-order): the docker_gwbridge address exists only once the bridge is recreated, otherwise the database answered only on loopback after every reboot.
  • Redis and RabbitMQ publish no port.
  • Public ports are limited to HTTP/HTTPS and the configured SSH port.
  • Updates that can change dependencies (the kernel included) are applied; setup completes the required reboot before closing root access.
  • setup proves the loopback registry, Caddy, PostgreSQL, Fail2ban, UFW and the systemd units before SSH hardening. The previous SSH configuration is restored by a signed operation if the post-hardening audit fails.
  • doctor also checks required reboots, Fail2ban/SSH alignment, failed systemd units and unmanaged SUID/SGID executables.

Budgets and retention

Area Contract
setup Measured budget of 600 seconds by default, configurable from 120 to 7,200 seconds. A safe convergence succeeds even past the budget; the CLI then warns about the overrun.
deploy Measured source-to-production budget, by default per framework: 45 seconds for Laravel and Symfony, 30 seconds for the other presets, configurable from 10 to 600 seconds. A healthy release that exceeds it stays in production and the deploy succeeds with a warning.
Retention Two releases, 5 GiB of registry cache per application, seven local PostgreSQL backups and at least 20% free space. Before measuring that space, deploy asks the helper to reclaim the images of releases the application has moved past: a host full of its own leftovers is cleaned, not blocked.
Memory deploy refuses a promotion when the host's available memory (MemAvailable) is below the sum of the stack's service memory limits. A start-first rolling update needs that margin on top of what runs. The refusal names each service and its limit; lowering services.<name>.resources.memory is the answer. Default 768 MiB per service: three services need 2.25 GiB available.
Cleanup No docker system prune: only artifacts Shuttle owns are removed. The root helper writes each decision to the host journal (journalctl -t shuttle-root).

Warning

Local backups do not protect against losing the whole VPS. Rollback restores the previous application stack, not the data or schema migrations. A migration must stay compatible with the previous version or come with a prepared and tested data restore. A start-first rolling update depends on healthchecks, free capacity and version compatibility; it does not guarantee absolute availability of a single VPS.

Backups, versions and CVEs

Encrypted application backups, the isolated native PostgreSQL restore and the optional AWS S3 or Cloudflare R2 export are described in the backup guide. Installs and deploys use the latest stable versions and their exact digests. Trivy is optional, through doctor --scan-images, and its results do not block these operations; see the version and CVE policy. doctor --outdated lists, without changing anything, newer versions of Shuttle, of the Dockerfile base images and of the VPS infrastructure.

Development

cd app/go-cli
gofmt -l .
go vet ./...
go test ./...
go test -race ./...
go build ./cmd/shuttle

From the repository root, make install installs the CLI built from these sources (never use shuttle update for that). The configuration contract is described in docs/configuration.md, and operations in docs/operations.md. Releases follow docs/releasing.md.

The acceptance test on a freshly reset VPS is automated by sh scripts/e2e-vps.sh, run from the repository root, with the target, domain and binary given explicitly; it keeps its configuration and evidence under tmp/vps-e2e/. The first deploy measures the cold cache; the second checks that the warm-cache deploy fits the budget declared by the generated configuration.

License

Shuttle is released under the Apache License 2.0.

About

Audit, harden and deploy Docker apps on a single VPS. Signed releases, native PostgreSQL, Swarm.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages