mirror of
https://github.com/kellymichels/zscripts-token-savers
synced 2026-10-07 07:18:18 +00:00
* fix(ps): zbackup explicit target + robust DATABASE_URL parsing; ssh-stderr deploy fix Restores parked, previously-uncommitted PowerShell improvements: - zbackup / zbackup_and_sync require an explicit target: bare invocation now prints usage instead of quietly backing up everything; 'all' does what bare used to (matching zdeploy). setup_backup_schedule.ps1 passes 'all' to the scheduled task; both tolerate switch-style args. - zbackup parses more DATABASE_URL styles: strips surrounding quotes (Prisma convention), accepts postgres:// and postgresql+driver:// schemes, and treats the port as optional (defaults to 5432). - Invoke-Ec2Step survives ssh stderr warnings: under ErrorActionPreference 'Stop', PS 5.1 turns any native stderr line (e.g. Docker's COMPOSE_BAKE deprecation notice) into a terminating NativeCommandError, aborting a deploy that actually succeeded. Drop to Continue locally and flatten stderr so only the real exit code decides success. * fix(ps): zbackup reports the real pg_dump failure, not "No DATABASE_URL" Mirror of the bash fix. Invoke-LocalPgDump now owns all its messaging (caller just captures success) and distinguishes the cases: - no .env / no DATABASE_URL -> calm "No local DATABASE_URL". - database not reachable (connection refused / could not connect / DNS / timeout) -> calm "Local database not running at host:port" - a stopped dev DB is a normal state. - any other failure (version mismatch, auth, missing db) -> the loud, full pg_dump error plus the host:port/db it tried, instead of a bare "pg_dump failed (exit N)" followed by a misleading "No DATABASE_URL". Captures pg_dump stderr (was 2>$null); drops ErrorActionPreference to Continue locally so PS 5.1 doesn't turn that stderr into a terminating NativeCommandError under the script's 'Stop' setting.
4.1 KiB
4.1 KiB
Changelog
Notable changes to the Evomedia.net Token Savers.
Unreleased
Fixed
zdeployno longer deletes operator-managed files on deploy (#2) — the project-directory replacement preserved only./.env, silently destroying every other server-side file (.env.db, staged signing keys, certs) on every deploy. All.env*files at the project root are now preserved by default, plus anything listed in the newdeploy.preservearray (files or directories); the vite kind, which previously preserved nothing, gets the same protection. Found the hard way: a first production deploy of an auth service wiped its staged DB credentials and RSA signing keys.
Added
zkill all—zkillnow acceptsall, stopping the dev server of every project that has aports.dev(edge/docker stacks with no local dev server are skipped). Brings it in line withzdeploy all/zbackup all; the one-shot "stop everything I've got running locally". Ported to both the PowerShell and bash versions.zdeployserver-side health verification (verifyblock) — projects not published through the edge proxy can declare"verify": { "port": ..., "path": "/health", "expect": "..." }and the deploy is checked from the server itself (curl localhost:<port><path>over SSH) instead of hitting the public IP. Fixes a false PASS where the proxy's default vhost answered for apps that never started; projects with neitherdomainnorverifyare now reported as NOT verified.zdeployoptionaldeploy.gitPull—git pull --ff-onlyin the project root before zipping.zdeployzips the working tree and doesn't otherwise pull, so a checkout left behindoriginafter a merged PR would deploy stale code while still bumping the build number — success that changes nothing. A failed pull aborts the deploy instead.- Per-project
startconfig block —zstarthonors optional pre-start steps fromzconfig.json:"gitPull": truerunsgit pull --ff-onlyin the project root before starting (never boot a stale checkout), and"env": { ... }sets environment variables for the dev-server process. Example added tozconfig.example.json. - Switch-style argument tolerance — a leading dash on a project key is
ignored everywhere (
zdeploy -myapp==zdeploy myapp), for hands that grew up on per-project switches.
Changed
zbackup/zbackup_and_syncrequire an explicit target — running them bare now shows usage instead of quietly backing up every project;alldoes what bare invocation used to (matchingzdeploy). The scheduled task created bysetup_backup_schedule.ps1passesall— re-run it if your task was registered before this change.zbackupparses moreDATABASE_URLstyles — double/single-quoted values (Prisma convention),postgres://andpostgresql+driver://schemes, and URLs without an explicit port (defaults to 5432) all work; previously these skipped the Postgres dump with "Could not parse DATABASE_URL".zkill/ port cleanup kills the whole process tree — listeners on a project's port are now terminated children-first. Auto-reloading servers (uvicorn/watchfiles, nodemon) spawn workers that inherit the listening socket; killing only the parent left orphans serving stale code.zbackupfindsDATABASE_URLinbackend\.envtoo — projects with a frontend/backend split get their Postgres dump bundled without needing a root-level.env.
1.0.0
Initial public release: zstart / zkill / zrestart (local dev servers),
zdeploy (zip → upload → compose build → live build-version verification,
with handlers for python / vite / nextjs / edge / docker project kinds),
zec2 / zec2online / zrepair (health checks and recovery), zbackup /
zbackup_ec2 / zsync (local, server-side, and offsite backups), all driven
by a single gitignored zconfig.json.