Repository navigation
Conversation
Contributor
Contributor
|
Your Vercel team Vercel Solutions is not permitted to deploy from this git repository. Contact an administrator to add github organization vercel as a Protected Git Scope in Vercel Solutions on Vercel. Once added, commit again to see your changes. Learn more: https://vercel.com/docs/security/protected-git-scopes |
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
container-images/pgrust-playground: a self-contained example that runs pgrust, a Rust rewrite of Postgres (wire and SQL compatible with PostgreSQL 18), together with the pgweb web SQL client on Vercel Functions as a container image.Why
pgrust ships self-contained Linux release binaries, so it is a good showcase for the container runtime: no compiler toolchain, no fork, a build that finishes in under a minute. Pairing it with pgweb gives a password-protected SQL playground in the browser, preloaded with sample data, that fits the stateless Functions model because the database is baked into the image.
Approach
The example ships no pgrust or pgweb code.
Dockerfile.verceldownloads the pinnedv0.4-betapgrust release and pgwebv0.17.0, verifies both SHA-256 checksums, runs pgrust's owninitdb, and loadsseed.sqlat build time. At boot,start.shcopies the seeded database to/tmp, starts pgrust as an unprivileged user on a private Unix socket (no TCP listener), then starts pgweb on$PORT(80 by default).AUTH_USER/AUTH_PASSare required for HTTP basic auth, andPGWEB_READONLY=1turns on read-only mode.vercel.jsonis a singlecontainerservice with a catch-all rewrite.Validation
Built this exact
Dockerfile.vercellocally with Docker 29 (image about 296 MB, build about 13 s) and ran./local-test/smoke-test.sh:Also checked: with
PORT=3000the container answers authenticated requests about 450 ms afterdocker run, and without credentials it exits with code 1 and a clear message.Also tried PostgREST v16.5 in front of pgrust instead of pgweb; pgrust refused PostgREST's schema-cache query (
0A000 gravity: refused), so this example uses pgweb.Not verified
ulimit -s 65520(pgrust's documented setting) is allowed in the Functions runtime, and cold-start time there.demoUrluntil someone deploys it.The database is per instance and ephemeral by design; the README says so and points to Marketplace Postgres for durable data.