Skip to content

feat(releases): a nightly channel for self-hosting - #13659

Merged
levivannoort merged 19 commits into
mainfrom
feat/release-channels
Sep 15, 2026
Merged

levivannoort merged 19 commits into
mainfrom
feat/release-channels

Conversation

@levivannoort

@levivannoort levivannoort commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Self-hosters who want to track the active release branch currently have to build it themselves. This adds a nightly channel: one build a day of the newest CI-green commit on the active release branch, published to appwrite/appwrite.

_APP_VERSION=2.0-nightly     # then: docker compose pull && docker compose up -d && docker compose exec appwrite migrate

or --channel nightly on install / upgrade.

What it publishes

Tag Moves
X.Y-nightly.<date> never, the build to pin or roll back to
X.Y-nightly daily, the form to recommend
nightly daily, and jumps minor lines

X.Y comes from the branch name. The tag is a label, not a version the product reads: migrate keys off APP_VERSION_STABLE compiled into the image, and the VERSION build arg only sets _APP_VERSION.

How it stays safe

  • It resolves the newest CI-green commit rather than the branch tip, so a red branch delays the channel instead of shipping through it. That needs CI on push for every release branch, hence '*.x' replacing the hardcoded 1.9.x.
  • It publishes to appwrite/appwrite only, in one hardcoded line. Cloud builds from cl-* tags through publish.yml and is untouched.
  • The branch is rebuilt daily whether or not it moved, so the channel carries base image security fixes.
  • Nightly is unsupported, has no SLA, and never leaves the minor line it was built from. Rolling back to yesterday works because a patch never adds a migration — a rule AGENTS.md now states explicitly.

The workflow is 89 lines and keeps no state: no marker tags, no registry lookups, no write access to the repo.

security-scan.yml is the old nightly.yml (the Trivy scan) renamed, so the name could describe the channel.

Split out

The release gates and the release metadata task moved to #13692 — they are release process, unrelated to this channel, and were most of the original diff.

The Trivy scan owned the nightly.yml file name, which the nightly build
channel needs. Its schedule also moves to 01:30 UTC so it runs after the
build rather than alongside it.
Builds one image a day from the newest CI-green commit on the active
release branch, so a fix can reach self-hosters the night it lands
instead of waiting for the next patch.

Resolves the build rather than trusting the tip: walks back through
recent green CI runs, skips when nothing has moved since the last
nightly, and derives the version from the branch's own
APP_VERSION_STABLE so the tag is a prerelease of the patch it is
heading for. The bare nightly tag only follows the newest line, and a
guard refuses any tag outside appwrite/appwrite -- Cloud's appwrite/ce
pipeline is not part of this channel.
AGENTS.md blocks a release on a fresh install and an upgrade from the
previous stable with realistic data, and CI covered neither -- there was
no migrate step anywhere in the pipeline. That gate was a person's day
per release, which is a direct incentive to batch fixes instead of
shipping them.

Both now run on release branches and on demand. The upgrade job starts
the previous published stable from the compose file and env that version
shipped, seeds through the public API, switches to the candidate on the
same volumes, migrates, and asserts the data survived -- then migrates a
second time to prove idempotency. Seeding covers the shapes a migration
is most likely to mangle: empty strings, 4000-character values, unicode,
relationships, and row permissions that differ from the table's.

The baseline comes from Docker Hub rather than git tags, because an
image nobody can pull is not an upgrade anyone can perform.
A patch bump touches APP_VERSION_STABLE, four install snippets in
README.md, three in README-CN.md, and Migration::$versions, and nothing
checked that they agree. `release X.Y.Z` writes all of them from one
version number, and tests/unit/Release/MetadataTest.php fails when they
drift apart again.

The task also refuses to map a patch to a new migration class: a fix
needing a schema change is a minor, which is what keeps a nightly user
able to roll back to yesterday's build.
Opting into nightly already worked through _APP_VERSION, since every
service resolves its own image tag, but it left self-hosters to work out
that the tag has to stay rolling. --channel=nightly derives X.Y-nightly
from the stable version so the install tracks the minor line instead of
freezing on one build.
Records the tag contract for both channels, the four rules the nightly
channel rests on, the weekly patch train, and how a self-hoster opts in.

Also points the release checklist at the new task and CI gates, and drops
the reference to app/views/install/compose.phtml, which no longer exists.
@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → feat/release-channels (after).

Metric Before After Change
🚀 Requests/sec 225.03 227.09 ⚪ +0.9%
⏱️ Latency P50 77.09 ms 76.44 ms ⚪ -0.8%
⏱️ Latency P95 184.33 ms 176.6 ms ⚪ -4.2%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 76.44 176.6 14,478 227.09 -7.73
Account 146.12 267.31 762 12.64 -16.81
TablesDB 74.46 138.58 7,874 127.53 +4.42
Storage 68.87 147.33 3,810 62.9 -7.91
Functions 111.74 208.19 2,032 34.16 -22.84

Top API waits (after)

API request Max wait (ms)
account.name.update 479.37
functions.variables.create 357.67
functions.variables.update 352.98
functions.create 351.98
account.prefs.update 343.32

Verification was 20-odd hand-written assertions behind an assert helper
and a failure counter. It is now one projected snapshot, taken before
the upgrade and diffed after it -- shorter, and the failure output is a
diff of what changed rather than a list of lines. The projection keeps
only the fields the seed put in, so an upgrade is still free to add
fields to a model.

Writes are behind --write so the read-only comparison can run after
every migrate; previously the second run diffed against rows the first
run had written.

The previous-stable resolver was a 89-line python script and is now four
lines of shell: sort the published tags together with the target and take
what lands before it. Same answers on live Docker Hub data (2.0.0 ->
1.9.6, 2.1.0 -> 2.0.0), and no python in CI.

Also moves the candidate's compose env to the job level instead of
repeating it on seven steps, and renames USER so the scripts stop
shadowing the shell's own variable.

315 lines down from 477.
Adding $channel as the ninth parameter of Install::action() put a string
where Upgrade::action() already had bool $migrate, and an override may
only add optional parameters, not change the type of an existing
position. Every process that boots the platform died on the incompatible
declaration, which is why the whole pipeline went red rather than one
job.

$channel also has to reach performInstallation(), a different method, so
it now travels on $this the way $topology already does instead of being
read out of scope.

Also yields the README data provider, per Rector's YieldDataProviderRector.
tests/unit/Release/MetadataTest.php could not do its job: unit tests run
inside the appwrite container, whose /usr/src/code holds only app, dev,
public, src and vendor. The READMEs are neither copied into the image nor
mounted by the override, so reading them returned false and the test
failed for a reason that had nothing to do with the metadata.

The file-level pins now live in a Check release metadata step in the
Checks job, which runs on the runner where the files are. The one
assertion that is genuinely about code -- no version mapped ahead of
APP_VERSION_STABLE -- moves to MigrationVersionsTest, next to the
existing assertion about that same map.

Also loosens the console pin check: main pins 1.1.78-self-hosted, so a
build suffix is valid where a floating tag is not.
@levivannoort

Copy link
Copy Markdown
Member Author

Simplified the nightly resolve step — the "has this already been published?" logic is now one git check instead of two mechanisms.

  • Dropped the Docker Hub tag lookup (curl + 200/404/other status handling). Whether a build already shipped is answered by the nightly-<branch> marker tag, which the workflow already keeps; the registry was a second source of truth for the same question.
  • Consequence: a second dispatched build on the same day reuses that day's X.Y.Z-nightly.<date> tag instead of taking a .<run> suffix. Older day tags are still stable rollback anchors, so AGENTS.md now says "one a day" rather than "immutable" for that tag.
  • Also dropped: the green-commit walk-back loop (gh run list --status=success already returns the newest green run; release branches are protected, so the force-push ancestry guard was guarding nothing), the branch-name/APP_VERSION_STABLE mismatch warning, the "refuse to publish anywhere but appwrite/appwrite" step (tags are built from the hardcoded IMAGE env in the same file), and the markdown summary table.

nightly.yml: 270 → 187 lines. actionlint clean.

The workflow asked "has this already shipped?" twice: the nightly-<branch>
marker tag answered it for the commit, and a Docker Hub tag lookup answered
it for the day. Keep the marker, drop the registry call and its status-code
handling -- a same-day rebuild now reuses the day's tag instead of taking a
run-number suffix, so that tag is one a day rather than immutable.

Also drops guards that guard nothing: the walk-back loop over green runs
(gh already returns the newest green run, and release branches are not force
pushed), the branch-name mismatch warning, and the step refusing to publish
anywhere but appwrite/appwrite -- the tags are built from the hardcoded IMAGE
env six lines above it.
AGENTS.md rules out preg_* in new code. Version parsing, the migration map
lookup and the console pin all read fine with explode, ctype_digit,
str_contains and strcspn.
The upgrade gate read the previous stable out of Docker Hub's 100 most
recent tags. The nightly channel now pushes a tag a day to that same
repository, so within weeks the stables fall out of that window and the
gate fails to find a baseline it can upgrade from. Git tags carry every
release, sort by semver and are already here from fetch-depth: 0 -- which
also makes the explicit tag fetch redundant.

Also stops the crash-loop check from accepting exited containers. Every
service in the default profile is long-running, so an exited one is a
service that stopped serving.
@levivannoort

Copy link
Copy Markdown
Member Author

Two follow-ups after another read of the gates:

Upgrade baseline resolution would have broken once nightly runs. The gate resolved the previous stable from Docker Hub's 100 most recent tags. Nightly pushes one new tag a day (plus refreshing two rolling ones) to appwrite/appwrite, and stables are ordered by last_updated, so they get pushed out of that window — 54 of the current 100 are X.Y.Z, so it had roughly a month and a half before the gate started failing with "no published stable below ". Now resolved from git tags, which carry every release, sort by semver, and are already present from fetch-depth: 0 (so the explicit tag fetch went too). Verified locally: 2.1.0 → 2.0.0, with both docker-compose.yml and .env readable at that tag.

Crash-loop check accepted exited containers. select(.State != "running" and .State != "exited") let a container that died during the API exercise pass. Every service in the default profile is long-running, so exited means it stopped serving — now running-only.

Also dropped the four preg_* calls the release and install tasks added, which AGENTS.md rules out for new code: version parsing, the migration-map lookup and the console pin read fine with explode/ctype_digit/str_contains/strcspn. Parity checked against the old patterns, including that the console pin still reads 1.1.78-self-hosted.

upgrade-lib.sh existed only to be sourced by the two scripts either side of
it, and both run in the same job. One upgrade.sh with seed and verify
subcommands says the same thing without the indirection, the shellcheck
source directives or the unused-variable suppression the split forced.

Also waits on the signal that means ready. /health/version answers before the
platform schema is initialized -- the e2e jobs already poll /account for a 401
for exactly this reason -- so the gate could start seeding against a database
that was not there yet. That also makes the install gate's separate version
step redundant.
@levivannoort

Copy link
Copy Markdown
Member Author

On whether the gate needs three scripts: the content does, the file split didn't.

upgrade-lib.sh only existed to be sourced by the two scripts either side of it, and both run in the same job. Folded into one .github/scripts/upgrade.sh with seed and verify subcommands — that drops the sourcing indirection, the # shellcheck source= directives and the SC2034 suppression the split forced. Net about the same line count, one less concept; shellcheck clean.

What I did not cut, and why: every seeded shape is one the gate asserts on and one AGENTS.md names — empty string, 4000-char value, unicode, relationship, row permissions differing from the table's, plus a user and a file. The --write pass and the second migrate are what separate "reads work" from "the schema is actually complete and idempotent". Nothing is seeded that the snapshot does not read back.

One bug fixed on the way: wait_for_appwrite polled /health/version, which answers before the platform schema is initialized — the e2e jobs already poll /account for a 401 for exactly this reason. The gate could have started seeding against a database that was not there yet. It now waits on the same signal, which also made the install gate's separate "Report version" step redundant.

The workflow read APP_VERSION_STABLE out of the resolved commit, validated
its shape and bumped the patch, all to name a tag. Nothing reads that name:
migrate keys off the constant compiled into the image and the VERSION build
arg only sets _APP_VERSION, so 2.0.x can simply publish 2.0-nightly.<date>.
That also drops the failure mode where a release candidate on the branch
stopped the channel.

Drops the nightly-<branch> marker tag with it, and the write access and tag
push it needed. Skipping an unchanged branch was the wrong instinct: a daily
rebuild is how the channel picks up base image security fixes, which is most
of what a nightly is for.

nightly.yml is now 148 lines, from 270 when the channel was added.
Everything that was not the build itself is gone: the resolve job and the
outputs plumbing between it and the build, the skip path (a release branch
with no green CI run is an error worth seeing, not a quiet no-op), the
workflow_dispatch branch input and the branch validation it needed, and the
IMAGE indirection -- the one place a tag is written now names the repository
it publishes to.

Dropping the branch input means only the active release branch is built, so
an X.Y-nightly tag stops moving when a newer line opens. That is what the
channel is for.

nightly.yml is 89 lines, from 270 when the channel was added.
The install and upgrade gates, upgrade.sh and the release task are release
process, not the nightly channel: nothing here imports them, and they were
80% of a diff meant to answer "should we publish nightly builds?".

They are unchanged in #13692. What stays is the channel itself -- nightly.yml,
--channel on install and upgrade, and the docs that describe them -- plus the
*.x push trigger, which nightly needs so there are green CI runs on release
branches to resolve.
@levivannoort levivannoort changed the title feat(releases): stable and nightly channels for self-hosting feat(releases): a nightly channel for self-hosting Sep 15, 2026
@levivannoort levivannoort self-assigned this Sep 15, 2026
@levivannoort
levivannoort marked this pull request as ready for review September 15, 2026 08:18
@greptile-apps

greptile-apps Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge because no new actionable failure was introduced after the previous review.

Summary

Adds a nightly release channel for self-hosted Appwrite installations.

  • Builds the latest CI-green commit from the newest release branch and publishes dated, minor-line, and global nightly Docker tags.
  • Moves the existing Trivy workflow to security-scan.yml.
  • Adds stable and nightly channel selection to installation and upgrade commands.
  • Documents the nightly release process and operational constraints in AGENTS.md.

Reviews (3) · Last reviewed commit: "fix(install): only treat this channel's ..."

Comment thread .github/workflows/nightly.yml Resolved
Comment thread src/Appwrite/Platform/Tasks/Install.php Resolved
Comment thread src/Appwrite/Platform/Tasks/Install.php Resolved
…d tag

A nightly image reports _APP_VERSION=X.Y-nightly.<date>, the tag it was
pulled under. Both channels were derived from that value, so an install or
upgrade run from inside a nightly image got the wrong tag either way:
--channel nightly could not read a minor line out of it and fell back to
the bare nightly tag, which jumps minors, and --channel stable wrote the
dated nightly tag straight back, leaving the install on nightly.

Take the release compiled into the image instead whenever the tag names a
channel. Both channels already derive from it, so nightly pins to its own
line and stable returns to the release the image was built from.
Comment thread src/Appwrite/Platform/Tasks/Install.php Resolved
str_contains($version, 'nightly') claimed any tag with the word in it, so a
self-hoster running their own customer-nightly-fix image would have had it
replaced with APP_VERSION_STABLE and persisted to .env, quietly pulling a
different image than the one they asked for.

Match what nightly.yml actually publishes instead: nightly, X.Y-nightly and
X.Y-nightly.<date>.
@levivannoort
levivannoort merged commit 02248f6 into main Sep 15, 2026
90 of 91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants