LogicSRC standards surface

OpenInstall

One script every repository carries at bin/install.sh. Run on a server from a checkout, it puts the app into service on that box: the runtime and a local database, the build, a systemd unit, an nginx site with a certificate, a restart and a health check. Run it twice and the second run changes nothing.

Every app on a plain server needs the same dozen steps, and most repositories keep them in a README section that was true once or a script on one laptop. A new box means doing them from memory, and a second run of a half-written script means a duplicate database role or an nginx site with two server blocks. OpenInstall fixes the place, the verbs, the settings file and the exit codes, so a person can run any repository's copy after git clone and a deployer can run it without reading it first.

Status: 0.1. Bare metal or a VPS, systemd and nginx; no Kubernetes, no platform. The reference script is sh1pt's packages/targets/deploy-ssh/bin/install.sh.

git clone https://git.example.com/acme/ledger.git
cd ledger
./bin/install.sh            # setup + build + activate
./bin/install.sh status     # key=value lines

Phases

The first argument. Root, or passwordless sudo, is needed for apt, Postgres, systemd and nginx; the service itself runs as the user who ran the script.

setupSTATE_DIR and an empty app.env, the runtime when it is missing, a local Postgres database and Redis when asked for, with DATABASE_URL and REDIS_URL recorded in db.env.
buildDependencies from the lockfile, then the build, in SRC_DIR, with the secrets in the environment. Nothing outside the checkout.
activaterun.sh and the systemd unit, a restart, the health check, and only then the nginx site, nginx -t, the reload and a certificate.
statuskey=value lines: app, runtime, src, app_dir, state, unit, active, health, domains. Changes nothing.
allNo argument: setup, build, activate, stopping at the first failure.

The rules that make it safe to run again

IdempotentEvery step checks before it acts. A file is written only when its content differs, and systemd and nginx reload only when a file they read changed. The second run changes no file; activate still restarts the service so a fresh build takes effect.
Owns only its own filesEvery unit and site it writes starts with # managed by bin/install.sh. A file already there without that line is never overwritten: the script exits 1 and says so.
No secrets in the repositorybin/install.conf is committed and holds settings only. Secrets live in STATE_DIR/app.env, mode 0600, written by a deployer from a vault or by a person.
Up before it is routed toactivate restarts the service and waits for a 2xx or 3xx from the health path on loopback before it touches nginx. An nginx change that fails nginx -t is put back.
Build, run and state apartSRC_DIR is built, APP_DIR is run, STATE_DIR is kept. A deployer builds in releases/<id>, runs from a current symlink, and rolls back by flipping it.

Settings

bin/install.conf, KEY=value lines, committed. The environment wins. A repository with a lockfile and build and start scripts needs no file at all. A bun app with Postgres and a domain:

# bin/install.conf: committed, no secrets
APP=ledger
PORT=3000
HEALTH_PATH=/healthz
DOMAINS="ledger.example.com www.ledger.example.com"
[email protected]
POSTGRES=1
keydefault
APPthe repository directory's name
RUNTIMEauto, from the lockfiles
INSTALL_CMDauto, the frozen-lockfile install
BUILD_CMD<pm> run build, when there is one
START_CMD<pm> run start
PORT3000
HEALTH_PATH/
HEALTH_TIMEOUT120
DOMAINSempty: no nginx site
TLS1, Let's Encrypt
TLS_EMAILnone
STATIC_DIRdist
SPA0
POSTGRES0
REDIS0
MAX_BODY100m
SRC_DIRthe repository the script is in
APP_DIRSRC_DIR
STATE_DIR~/.local/share/<APP>
UNITAPP

Exit codes

A deployer reads nothing else to decide whether a release went out.

0The phase did what it says. status always exits 0.
1An error: a bad setting, a missing tool, a failed build, no root, a file that is not ours, an nginx config that did not test.
3activate restarted the service and the health check did not pass. nginx was not touched. A deployer rolls back.

Deployers

sh1pt ship --target deploy-ssh takes the source from any git host the box can read (GitHub, GitLab, Codeberg, a self-hosted forge) or pushes it with rsync, writes app.env from the vault, runs the repository's script, or a bundled copy when there is none, and flips current back when activate exits non-zero.

<root>/repo.git                  a mirror of the repository
<root>/releases/<id>             one directory per release
<root>/current -> releases/<id>  what the unit runs (APP_DIR)
<root>/shared/                   STATE_DIR: app.env, db.env, run.sh

Not

Not a provisioner of the box: no users, firewall, ssh or kernel. Not container orchestration: one box, systemd and nginx. Not a package manager: it calls the one the lockfile names. Not a CI system, not a secret store, not a release manager. No .well-known file: the script lives in the repository and is read by whoever has the checkout.

Where everything lives

  • Specification: the phases, the settings and their defaults, the state files, exit codes, twelve conformance rules, what a deployer owes the script, and a worked example
  • OpenStack.md, whose Hosting section can name the script; OpenServer, the box a project buys before the script runs on it