Skip to content

Moorage 0.2.0

Choose a tag to compare

@github-actions github-actions released this 04 Nov 02:12
· 147 commits to main since this release
063992c

Moorage 0.2.0 is for teams. git push deploys an app, over SSH or HTTPS, with no git or sshd needed on the server, and shows the build in your terminal. Accounts, sign-in from any machine and scoped API tokens say who did what. Apps with a Containerfile, or an image from a registry, run in containers under Podman or Docker, released and rolled back like any other app. moor trust makes browsers accept the certificates of a server's own CA, moor server doctor checks a server and says how to fix what it finds, and moor server proxy-config nginx writes the configuration for running behind nginx. The documentation has moved up to docs/, with complete examples. The web console comes in 0.3.0.

Upgrading from 0.1.0 needs no steps of its own: replace moor and restart the server, and running apps are taken over without a restart (see Upgrading). Upgrade moor on other machines too: the API's lists now come in pages, which an older moor cannot read.

Added

  • Deploys by git push (wave 2, slice 2). Every app has a git repository on the server, served over SSH (port 2222, listen.ssh) and HTTPS (/git/<app>.git on the console's hostname) by Moorage itself: no git or sshd is needed on the server. moor keys add registers an SSH key (Ed25519, ECDSA, or RSA of 3072 bits or more); moor git remote adds the app's remote to a repository, and git push moorage main deploys, with the build streamed back as remote: lines. The production branch is the repository's default branch (main, or the first branch pushed); other branches and tags are kept, not deployed. A failed deploy fails the push and leaves the branch where it was; Ctrl-C leaves the deploy running. The first push creates the app. [skip deploy] in a commit's message, or git push -o skip-deploy, keeps a commit without deploying it; -o detach accepts the push at once; -o env=production deploys any branch. Over HTTPS, moor git remote --http sets up moor git credential, which gives git the API token for the server's own git URL only. Repositories can be cloned back. moor deployments shows the branch and commit each push deployed, and other commands find the app from the moorage remote. See Deploying with git push.
  • Accounts (wave 2, slice 3). Users with email and password (Argon2id, at least 12 characters, common passwords refused) and a role: admins manage users, and until projects arrive members may do everything with apps. moor server init prints a one-time setup link to create the first account, so that nobody can race to claim a new server. moor login URL signs in from any machine by approving it in a browser (or --with-token), saving a context; moor logout, moor whoami and moor context go with it. moor server users creates users, who choose a password with a one-time link, and changes roles, disables and enables them. moor tokens makes API tokens with a scope (read, deploy, admin), an optional app and an expiry, stored only as hashes. SSH keys belong to their user. Git follows suit: pushes are recorded as their user's, tokens need the right scope, and a disabled user's keys and tokens stop working. Failed sign-ins and SSH handshakes slow down per address and account, and are logged as security events. Minimal pages on the console's hostname serve the claim, signing in, choosing a password and approving a sign-in; the session cookie is host-only, and forms and cookie-authenticated API requests need a CSRF token. See Accounts and access.
  • Containers (wave 2, slice 4). An app with a Containerfile or Dockerfile, or runtime = "dockerfile", is built into an image by Podman or Docker; runtime = "image", or moor deploy --image REF, runs one that is built already, pinned to its digest, so that restarts and rollbacks run exactly that image. Each runs like any other app: zero-downtime releases, health checks, rollbacks, logs, release commands, workers, variables and secrets. Containers publish only on the loopback interface, run with no-new-privileges and an init process, and get the environment's data directory at /data ([storage].mount). [container] sets the port, the user and the build, and [resources] memory, CPU and process limits. Moorage owns restarts: a container that exits is restarted by the process's restart policy, more slowly when it keeps exiting, and a kill for running out of memory is reported where the engine says so. Containers outlive the server, which finds them again by their labels, with no output lost or recorded twice; a server manages only its own. moor registry login keeps a private registry's credentials encrypted on the server. [containers].engine in server.toml chooses the engine: Podman if it is installed, or else Docker. CI runs all of it on both. See Running apps in containers and the new Guestbook example.
  • TLS and operations (wave 2, slice 5). moor trust puts a server's CA into the system's list and, on Linux, the browsers' own, and --remove takes it back. From the server's own machine it asks nothing; from elsewhere nothing vouches for the answer, so it shows the CA's fingerprint and what it may sign for, and asks, or takes --fingerprint. It refuses a server whose certificate does not come from the CA it offers. moor server status and the server's log show the fingerprint. moor server proxy-config nginx writes a configuration for nginx, which CI runs for real, deploying and pushing through it. moor server doctor checks a server, running or not, and says how to fix what it finds: its listeners, DNS, certificates, the container engine, the data directory and its keys, disk space, the clock, kernel features, and apps that can be reached without the router. --public-url checks the whole path through a proxy: forwarded headers, an app's hostname, WebSockets, streaming and large uploads, and with --timeouts, long silences. moor server resolver install makes *.localhost resolve for everything on macOS, with a rule in /etc/resolver and a small DNS responder in the server (listen.dns) that answers on loopback only. See TLS and trusting the server, Behind a TLS proxy and When something is wrong.
  • The API's contract. Every route declares the permission it requires, and a test enumerates them. docs/openapi.json, an OpenAPI 3.1 document generated from the routes and types and checked against them, is served at /api/v1/openapi.json. Errors can say what is wrong field by field. See The API.
  • Examples (wave 2, slice 1). examples/ has four complete apps, each ready to deploy with moor deploy and with a README of its own: Tasks, a FastAPI app run by uvicorn with a web page, SQLite in the app's data directory and migrations as the release command; Links, a link shortener with only Go's standard library and a graceful stop; Poll, an Express API with a Vite front end built at deploy time; and Handbook, a static site with clean URLs, a 404 page, headers and redirects. CI deploys each one on Linux and macOS and checks its pages and its API.
  • A reference for moorage.toml. docs/manifest.md describes every setting as this release implements it, the variables Moorage sets, how apps are detected, and which settings are accepted but have no effect yet.
  • The logo. Moorage's logo and icon, as SVG files in docs/assets, in the README; the pages the server shows itself (for an unknown app, an app not deployed yet, an unavailable one) carry the icon and use it as their favicon.

Changed

  • The server's admin token is local once the server has accounts. It keeps working on the server's own machine, so sudo moor … needs no sign-in, but from any other machine it stops working once the server has been claimed. A server that is not claimed behaves as in 0.1.0.
  • The API's lists come in pages. GET /apps, /deployments and /releases answer with {"items": […], "next_cursor": "…"} instead of an array, and take ?limit and ?cursor. This is a change for API clients of 0.1.0.
  • The documentation's layout. docs/ is the documentation for people who run Moorage and deploy apps to it — the guide, formerly docs/guide/, with an index; the design documents, the roadmap and the decisions moved to spec/. The README says what Moorage is and what works today, with a quick start. A test checks that every link in the README, the changelog, docs/, spec/ and examples/ leads to a file and a heading that exist.
  • moor manifest validate no longer says that [vars] arrives in the next release; declared variables come in a later one.
  • server.toml gains a [containers] section. A file without it keeps working.
  • moor server stop stops a server started with moor server run too, and no longer needs a service. --all also stops apps in containers, whether or not a server is running. It leaves alone a service that runs another configuration.