Repository navigation
feat: build the utopia PHP extension into the image - #28
ArnabChatterjee20k wants to merge 4 commits into
Conversation
utopia-php/auth 0.13 gets its password hashes from the utopia extension (ext-utopia), a Rust extension built from appwrite/appwrite's crates, and services on utopia-base can't load it today. A new stage builds it at a commit pinned in versions/*.env, like the other extensions; rustup takes the toolchain from the checkout's rust-toolchain.toml. The final image already has libheif and libwebp, which it links against. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code review
Adds a pinned Rust build stage for the Utopia PHP extension on PHP 8.5 and installs the shared library with its INI configuration in the final image. PHP 8.3 and 8.4 remain unchanged, while CI and the Makefile run extension checks on PHP 8.5. The checks verify the module loads and Argon2 can hash a password and verify both matching and non-matching passwords. Latest changes: The new commits use Git's blobless fetch for the sparse Appwrite checkout and replace the Argon2 class-presence check with a hash-and-verification test. Walkthrough (7)
Fixed since the last review (2)
Reviewed the commits since Tip Comment |
The extension's crate needs PHP 8.4 (it calls ext-php-rs's is_lazy, which exists only for 8.4+), so the PHP 8.3 build failed. 8.3 now leaves PHP_UTOPIA_VERSION empty and the stage builds nothing; the 8.3 image stays as before. The utopia checks move to tests-utopia.yaml, which CI and `make test` run on 8.4+. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On PHP 8.4 the extension builds but doesn't load: it calls zend_undefined_method, which only PHP 8.5's engine exports. Build and test it on 8.5 only; the 8.3 and 8.4 images stay as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@appwrite review |
The sparse checkout still fetched every file of the appwrite commit; --filter=blob:none fetches only the checked-out ones (483 MB to 6 MB, same files). The structure test now hashes a password and verifies the right and a wrong one, instead of only checking that the class exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Issue
utopia-php/auth0.13 gets its password hashes (Argon2, Bcrypt, Scrypt, …) from theutopiaPHP extension (ext-utopia), a Rust extension built from the crates in appwrite/appwrite. Services built onutopia-basecan't load it: no image ships it. That blocks reusing auth's password checking in those services, starting with the password challenge inutopia-php/abusethat Appwrite Edge will use.Appwrite and Appwrite Cloud each build the extension in their own Dockerfile. Building it here gives every
utopia-baseservice the same extension from one place.Solution
utopiastage: fetches only the Rust parts of appwrite/appwrite (Cargo.*,rust-toolchain.toml,.cargo,crates) at a pinned commit, with a sparse checkout and--filter=blob:none(about 6 MB instead of 483 MB), runscargo build --release --locked -p utopia-extension, and copiesutopia.sointo the image. rustup takes the toolchain version from the checkout'srust-toolchain.toml, so there's no Rust version to keep in sync here.PHP_UTOPIA_VERSIONinversions/*.envis93cadfb0, the commitutopia-php/auth0.13.0 was released from. Bump it with auth.ext-php-rs'sis_lazy, 8.4+), and on 8.4 it compiles but doesn't load (it callszend_undefined_method, which only PHP 8.5's engine exports). Soversions/8.3.envand8.4.envleavePHP_UTOPIA_VERSIONempty, the stage builds nothing, and those images are unchanged. auth itself still declares PHP 8.3 support; filed as Packages requiring ext-utopia allow PHP < 8.5, but the extension only loads on PHP 8.5 appwrite/appwrite#15948.conf.d/utopia.ini. The final image already installslibheifandlibwebp, which the extension links against, so no runtime packages are added.Tests
The
utopiachecks live intests-utopia.yaml; CI andmake testrun it on 8.5 only. It checks that the ini enablesutopia.so, thatphp -mlistsutopia, and that auth'sArgon2hashes a password, verifies it and rejects a wrong one (checked to fail when given the wrong password).tests.yamlis unchanged.Built locally for PHP 8.5 (arm64):
tests.yaml23/23 andtests-utopia.yaml3/3 pass. CI builds and tests every PHP version and architecture.🤖 Generated with Claude Code