From ffe024fe92cc62fd3bd5eb1ef6cee79d1b5aecf7 Mon Sep 17 00:00:00 2001 From: Deepthi Mohan Date: Fri, 27 Nov 2026 12:34:07 -0800 Subject: [PATCH 1/3] docs(readme): lead with a first request, move WebAssembly to its own page The README opened with an adapter description, put install at line 68 behind the default PostgreSQL build, whose init needs a running PostgreSQL server, and ended its quick start with five placeholders and no request that returned data. Its operation list left out the backup and PartiQL operations the engine dispatches, and it called the wire protocol coverage full. 416 of its 774 lines described the experimental WebAssembly build. The page now names ExtendDB as a server, shows a get-item answer from a local server, and leads install with the SQLite build, which needs no database server. "Make your first request" takes a reader from init to an item in five steps with no placeholders, and says that a new table is CREATING until it is ACTIVE, that the server accepts requests signed for its own region only, and what stop and destroy leave behind, including the pre-migration copies and the Cassandra keyspaces. The operation list matches the engine dispatch, with backups, PartiQL and the refused point-in-time recovery, and says that any other operation answers UnknownOperationException. "Run it under a supervisor" replaces Running in Containers and Monitoring. It keeps the health, metrics and log commands, with the metrics command prompting for the password and a macOS log show line added. A new "Your data" section says where data lives (including that the default encryption key sits in the catalog). "What ExtendDB is not" replaces the Scope list and adds what an unlisted operation answers and why one server runs per catalog. The README drops the Use Cases, Prerequisites, Authentication Modes and Management Console sections, the project tree and the Python setup, replaces the CLI listing with a sentence that names the commands, and links the documents that cover them. The TLS settings move under Configuration, and Install links the container images. The storage backend section keeps its heading and table, apart from "Supported operations" in lowercase in two cells; the paragraph after the table links the versioning policy, and the dev-mode paragraph moves to Install. Documentation becomes a paragraph that adds the WebAssembly page, and Contributing lists the RFC triggers that docs/rfcs/README.md lists, including backend contracts and schema or migration semantics. The description of the WebAssembly build moves to docs/webassembly.md: what it does not do, the requests it refuses, the HTTP server checks it does not make, and how to build it. The moved text keeps its wording apart from a title, an opening paragraph, its subsection headings one level up, its link to the versioning policy made relative to docs/, six em dashes in four list items that became colons and parentheses, bare placeholders such as escaped so GitHub renders them, the control-plane cases indented so the docs build nests them, "with no server and no network" made "with no ExtendDB server", "The command above" made "The `wasm-pack build` command above", "checks no checksum of it" made "does not verify its checksum", and the module size given as the Linux figure. "Building it" adds where wasm-pack writes the module and its loader, how to get a wasm32 clang on Ubuntu and on macOS, the wasm32 target, the wasm-pack release to install, and the module size on macOS. A new section, "Using it from JavaScript", holds the loading steps, the snippet with a real answer, and the calling contract of submit: it takes and resolves with strings, an error resolves it with an error document (shown with a real one), a trap before submit returns its promise throws, and a later trap leaves the request's promise pending. The License section comes last. The README keeps a section under the same heading, so README.md#experimental-webassembly-build still resolves. It says what the build is, what not to use it for and its status, and links to the page's sections. The feature list and the install routes link to the page too. Comments and docs that cite the WebAssembly section now name docs/webassembly.md: the wasm workflow, devtools/run-wasm-step, the SigV4 signing-key and crypto comments, the adapter's module docs and the Architecture Guide. The versioning policy, the WebAssembly Build section of AGENTS.md and the Run Tests section of CONTRIBUTING.md still cite the README section, which keeps what the build is and its status. The page is added to docs/build-docs.py and to the documentation table in AGENTS.md. docs/local-mongodb-setup.md now writes extenddb.toml, readable by its owner only, before init and runs init with --overwrite, says why the Docker node needs directConnection=true and puts it in the connection string it writes, with port 27017 in place of 27018, has the reader run the first request's steps 3 and 4 before the connection check, creates an account for the first request, and uses port 18443. A MongoDB init in a fresh folder fails reading the config file, and the default account it writes has no 12-digit ID, so these steps keep the guide working at this release. docs/getting-started.md and the developer test guide pointed at #python-environment-setup, an anchor the README never had; they now point at the developer test guide's Python setup, and the agents' venv reference names that guide. docs/getting-started.md also says that init reads EXTENDDB_PG_PASSWORD when --pg-pass is absent. ADR-0023 cites a README heading instead of a line number. RFC-0000 replaces two README line citations and one deployment guide line citation with a heading or a paragraph position; its other line citations stay. Apart from the new docs/build-docs.py entry, source files change only in comments. Verified with release builds: the first-request steps ran as written against SQLite, PostgreSQL 16, Cassandra 4.1 and, with the guide's steps, MongoDB 7, each returning the item shown on the page. Those runs came before the SQLite build command gained -p extenddb and the MongoDB guide's config-file command gained umask 077; the five steps' own commands are unchanged since. On Linux, wasm-pack build --target web --release crates/wasm-adapter with wasm-pack 0.15.1 wrote a 5,291,620 byte module, the snippet on a page in crates/wasm-adapter/ served over HTTP printed {"TableNames":[]} in headless Chromium, and DescribeTable on a missing table resolved with the error document the page shows. On macOS 26.7.3 with Apple clang 21.0.0, rustc 1.94.0 and wasm-pack 0.15.1, the same build wrote a 4,002,318 byte module. --- .../references/samples/01-venv-setup.md | 2 +- .github/workflows/wasm.yml | 16 +- AGENTS.md | 1 + README.md | 858 ++++-------------- crates/auth/src/sigv4/signing_key.rs | 2 +- crates/core/src/crypto.rs | 11 +- crates/wasm-adapter/src/lib.rs | 8 +- crates/wasm-adapter/src/runtime.rs | 10 +- devtools/run-wasm-step | 18 +- docs/adr/0023-catalog-migrations.md | 2 +- docs/build-docs.py | 2 + docs/getting-started.md | 4 +- docs/local-mongodb-setup.md | 46 +- docs/manuals/01-architecture-guide.md | 4 +- docs/manuals/06-developer-test-guide.md | 2 +- docs/rfcs/0000-credential-encryption-key.md | 4 +- docs/webassembly.md | 503 ++++++++++ 17 files changed, 765 insertions(+), 728 deletions(-) create mode 100644 docs/webassembly.md diff --git a/.agents/skills/extenddb/references/samples/01-venv-setup.md b/.agents/skills/extenddb/references/samples/01-venv-setup.md index 58e429b4b..e9191867f 100644 --- a/.agents/skills/extenddb/references/samples/01-venv-setup.md +++ b/.agents/skills/extenddb/references/samples/01-venv-setup.md @@ -14,7 +14,7 @@ test -d ~/venvs/extenddb-venv && echo "found extenddb-venv in ~/venvs/" || true Two standard locations: - `.venv/` at the repo root, created by `scripts/install-linux.sh` and `scripts/install-macos.sh` (recommended). -- `~/venvs/extenddb-venv/`, created by the README instructions. +- `~/venvs/extenddb-venv/`, created by the Python Environment Setup instructions in `docs/manuals/06-developer-test-guide.md`. Either works. If both exist, prefer `.venv/` since the install scripts maintain it. diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index 04fd3a1e6..b7f9501c5 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -47,9 +47,9 @@ jobs: timeout-minutes: 30 env: # The wasm-pack release to install; the comment on the wasm tooling - # steps below says why. README.md's "Building it" describes what one - # named wasm-pack release does, so a change of this value needs that - # section checked against the new release, and the release it names + # steps below says why. docs/webassembly.md's "Building it" describes + # what one named wasm-pack release does, so a change of this value needs + # that section checked against the new release, and the release it names # changed to match. WASM_PACK_VERSION: "0.15.1" steps: @@ -87,11 +87,11 @@ jobs: # below, read the description the crate's macros put into the module, # and both stop with a "different bindgen format" error when that # description's schema version is not their own; the corpus step's - # wasm-pack needs a wasm-bindgen of that version too (README.md's - # "Building it" says where it looks for one). The cache key holds both - # versions, so a cache hit restores tools of those versions and a miss - # installs them; both land in ~/.cargo/bin, and a hit skips their - # multi-minute compile. + # wasm-pack needs a wasm-bindgen of that version too + # (docs/webassembly.md's "Building it" says where it looks for one). The + # cache key holds both versions, so a cache hit restores tools of those + # versions and a miss installs them; both land in ~/.cargo/bin, and a hit + # skips their multi-minute compile. - name: Read the wasm-bindgen version from Cargo.lock id: wasm-bindgen run: | diff --git a/AGENTS.md b/AGENTS.md index cc882d31e..f457ed588 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -428,6 +428,7 @@ Expression parsing lives in `crates/core/src/expression/`. This is pure sync Rus | Cassandra Setup | `docs/cassandra-setup.md` | Cassandra install, config, and deployment (experimental) | | Testing Design | `docs/design/09-testing.md` | Test strategy and infrastructure | | Extending Storage | `docs/manuals/12-extending-extenddb-storage.md` | Guide to implementing storage backends | +| Experimental: WebAssembly Build | `docs/webassembly.md` | What the browser build does, refuses and skips; how to build it | Build PDFs: diff --git a/README.md b/README.md index f8b606a5b..fefb86a9c 100755 --- a/README.md +++ b/README.md @@ -5,166 +5,196 @@ > a clean-room implementation that speaks the DynamoDB wire protocol. Behavioral differences from the real service are > documented in [Differences from DynamoDB](docs/differences-from-dynamodb.md). -A DynamoDB-compatible API adapter, ExtendDB speaks the DynamoDB wire protocol — any AWS SDK, CLI, or tool that works -with DynamoDB works with ExtendDB, unchanged. - -## Use Cases - -- **Local development** — run DynamoDB workloads on your laptop with zero cloud dependency -- **CI/CD pipelines** — deterministic integration tests against a DynamoDB-compatible backend -- **Self-hosted deployments** — run DynamoDB workloads on your own infrastructure (on-premises, private cloud, edge) -- **Multi-cloud** — use DynamoDB semantics on any cloud that runs an ExtendDB-supported database backend -- **Air-gapped environments** — DynamoDB functionality with no internet connectivity - -## Scope - -ExtendDB is a server that implements the Amazon DynamoDB API on a database that you provide: PostgreSQL, SQLite, MongoDB or Cassandra. An application connects to it through the endpoint setting of an AWS SDK or the AWS CLI. The application signs each request with an access key stored in ExtendDB. +ExtendDB is a server that speaks the Amazon DynamoDB API and stores your tables in PostgreSQL, SQLite, MongoDB or Cassandra. Point an AWS SDK or the AWS CLI at its endpoint, sign requests with an access key stored in ExtendDB, and your DynamoDB code runs against a database you operate: on a laptop, in CI, on premises or on a network with no internet access. + +[Install](#install) · [First request](#make-your-first-request) · [Storage backends](#storage-backends) · [Differences from DynamoDB](docs/differences-from-dynamodb.md) + +The AWS CLI reading back an item it wrote to a local ExtendDB server (the commands are in [Make your first request](#make-your-first-request)): + +```text +$ aws dynamodb get-item --endpoint-url https://127.0.0.1:18443 \ + --table-name Music \ + --key '{"Artist": {"S": "No One You Know"}, + "SongTitle": {"S": "Call Me Today"}}' +{ + "Item": { + "Artist": { + "S": "No One You Know" + }, + "SongTitle": { + "S": "Call Me Today" + }, + "Year": { + "N": "2025" + } + } +} +``` -ExtendDB 1.0 is for: +## Features -- Local development and continuous integration (CI) test runs. -- Self-hosted deployments: on premises, in a private or public cloud, at the edge, or on a network with no internet access. +- **DynamoDB clients work with an endpoint change.** Tables, items, Query and Scan, secondary indexes, batches, transactions and streams use the DynamoDB wire protocol. An application sets the ExtendDB endpoint and region, trusts its certificate and signs with an ExtendDB key, and needs no other code change for the [operations ExtendDB serves](#supported-operations). +- **Your choice of database.** Build for PostgreSQL, SQLite, MongoDB or Cassandra. Each binary serves one backend, and each backend has a [support tier](#storage-backends). The SQLite build needs no database server. +- **IAM built in.** Every DynamoDB API request must be SigV4-signed, and the server checks it against IAM policies (the dev-mode build for local development skips that check). Manage users, groups, roles, policies and permissions boundaries with `extenddb manage`, and all but permissions boundaries in the web console at `https://127.0.0.1:18443/console/`. +- **Backup and restore.** `CreateBackup` and `RestoreTableFromBackup` back up a table and restore it, to and from a filesystem or S3 backup store that you configure, or the catalog ([Your data](#your-data) says which). +- **Streams, TTL and PartiQL.** Read changes with `GetRecords`, expire items with Time to Live, and run PartiQL statements with `ExecuteStatement`. +- **Vector search.** Find the nearest items to a vector with `SearchVectors`, on PostgreSQL and SQLite. +- **Runs under a supervisor.** `serve --foreground` logs to stderr, `extenddb healthcheck` is a liveness probe that needs no shell, and `/metrics` returns metrics as JSON to a request with admin credentials. +- **Runs in a web page (experimental).** The [WebAssembly build](docs/webassembly.md) answers DynamoDB requests from JavaScript inside the browser, over an in-memory SQLite database, with no ExtendDB server, no IAM and no persistence. -ExtendDB 1.0 is not: +## Install -- Amazon DynamoDB: ExtendDB is a separate implementation of the API. [Differences from DynamoDB](docs/differences-from-dynamodb.md) lists the known differences and the operations that ExtendDB does not implement, for example global tables. -- A managed service: you provide the database, and the database's own tools handle replication, failover and database backups. -- A multi-server deployment: run one ExtendDB server for each catalog. In 1.0, more than one server on one catalog is not supported. +Building from source needs git, Rust 1.94.0 or later ([rustup](https://rustup.rs)) and a C toolchain (compiler, linker and C library headers). The first request below also needs the AWS CLI version 2. The SQLite backend runs inside the server process, so this route needs no database server: -[Storage backends](#storage-backends) says what 1.0 promises for each backend. The [versioning policy](docs/versioning.md) says what a release can change. +```sh +git clone https://github.com/ExtendDB/extenddb.git +cd extenddb +cargo build --release -p extenddb --no-default-features --features sqlite +``` -## Features +The binary is `target/release/extenddb`. Continue with [Make your first request](#make-your-first-request). -- Full DynamoDB wire protocol: CRUD, Query, Scan, Batch, Transactions, Streams, TTL, Import/Export -- Pluggable storage: PostgreSQL (default), SQLite, MongoDB, and Cassandra -- SigV4 authentication with IAM compatibility: users, groups, roles, policies, permissions boundaries -- Web management console for account and credential administration -- TLS with automatic self-signed certificate generation (replaceable with CA-signed certs) -- CSRF protection, security headers, session management -- JSON metrics endpoint with DynamoDB CloudWatch-style metric names and dimensions -- Daemon mode with syslog logging, plus `--foreground` for container and supervisor environments +Other routes: -## Storage backends +- **PostgreSQL** (the default build): `cargo build --release`, and a PostgreSQL 14 or later server. `init` connects to the server you name with `--pg-host` and `--pg-port`, as the admin role you name with `--pg-user`, and reads that role's password from `EXTENDDB_PG_PASSWORD` ([remote PostgreSQL](docs/getting-started.md#remote-postgresql--aurora), [local setup](docs/local-postgres-setup.md)). +- **MongoDB** or **Cassandra**: `cargo build --release --no-default-features --features mongodb` (or `cassandra`). Initialize with the [MongoDB](docs/local-mongodb-setup.md#initializing-extenddb-with-mongodb) or [Cassandra](docs/cassandra-setup.md) setup guide. On MongoDB, `init` needs an `extenddb.toml` that already holds the connection string, and the first request needs an account that you create; the MongoDB guide gives both steps. +- **Container images** that hold the server only and connect to a database you run: [PostgreSQL](docker/README.md), [MongoDB](docker/README-mongodb.md), [Cassandra](docker/README-cassandra.md). The SQLite backend has no production image. +- **For local development and CI**, the [`@extenddb/dev`](packaging/npm/README.md) npm package and the [`extenddb/extenddb-dev`](docs/dev-image.md) image run a dev-mode SQLite build. Dev mode uses plain HTTP and seeds an example key that can do everything, so keep a dev-mode server on loopback. At startup it migrates a catalog that is behind it, after it copies the database file. +- **Installer scripts** that check for Rust, PostgreSQL and Python 3, then install the Python requirements into `.venv` (from the network), build the PostgreSQL binary and build the PDF manuals: `scripts/install-linux.sh` and `scripts/install-macos.sh` ([Linux](docs/manuals/08-install-linux.md), [macOS](docs/manuals/09-install-macos.md)). +- **In a web browser**: the [experimental WebAssembly build](#experimental-webassembly-build) answers DynamoDB requests from JavaScript, with no ExtendDB server. You build it with `wasm-pack`, as [Building it](docs/webassembly.md#building-it) describes. -An ExtendDB binary contains one storage backend, which the build selects. The tier of a backend says what the 1.x releases promise for it: +To update, stop the server, run `git pull` and the same `cargo build`, run `./target/release/extenddb migrate` to list pending migrations and `./target/release/extenddb migrate --yes` to apply them, then start the server again. -- Stable: for production. The [versioning policy](docs/versioning.md) applies in full. The ExtendDB CI is reliably green for the backend. -- Beta: for production within the known limits in the table. The ExtendDB CI is reliably green for the backend. The versioning policy applies with one exception. To remove a known limit, a minor release can change the behavior that the table lists, and its release notes name the change. -- Experimental: for evaluation. The backend is not for production use. The versioning policy does not apply. A release can change the backend's behavior or configuration with no deprecation period. +## Make your first request -A backend moves up one tier in a minor release. Before that release, the maintainers agree in an issue that the ExtendDB CI has been reliably green for the backend. They also agree that its known limits fit the higher tier. The release notes name the move. A backend moves down a tier only through the [deprecation steps](docs/versioning.md#deprecation) of the versioning policy. +Run these from the `extenddb` folder after the SQLite build. On PostgreSQL, add the connection flags above to `init`. On Cassandra, run `init` as its setup guide gives it. The steps after `init` are the same on these three builds. On MongoDB, run `init` as its setup guide gives it, and in step 3 set `ACCOUNT_ID` with the guide's `create-account` line in place of the `list-accounts` one. The commands use bash or zsh (Linux, macOS, or WSL on Windows). -| Backend | Tier | Topology | Data across upgrades | API coverage | CI | Known limits | -|---|---|---|---|---|---|---| -| PostgreSQL | Stable | PostgreSQL 14 or later, on the same host, on another host or as a managed service. | `extenddb migrate --yes` migrates the catalog in place. CI upgrades catalogs that 0.1.14 and earlier releases created. | The operations in [Supported Operations](#supported-operations). Vector search needs the pgvector extension. | `integration`, required, on PostgreSQL 16 | Time to Live (TTL) removes about 100 expired items per table per minute. | -| SQLite | Stable (single node) | SQLite runs in the server process. A lock file allows one server for each database file. There is no production image, so build from source. | As PostgreSQL. `migrate --yes` copies the database file before its first change. | The operations in Supported Operations. | `integration`, required | One write transaction at a time. TTL as PostgreSQL. | -| MongoDB | Beta | MongoDB 7.0 or later, as a replica set, also for one node. | As PostgreSQL. | No vector search. On a global secondary index (GSI) with more than one RANGE attribute, `Query` takes a key condition on the first one only. | `mongodb-integration`, required, on MongoDB 7 | A number in a key attribute has at most 34 significant digits. The database names are fixed, so one replica set holds one catalog. TTL as PostgreSQL. | -| Cassandra | Experimental | Cassandra 4.1 or later, with `PasswordAuthenticator`. Each table takes its writes in one datacenter. | `migrate --yes` migrates the catalog. No rollback procedure is tested. | No vector search. CreateBackup keeps each backup in the catalog, with or without a backup store. The `Query` limit of MongoDB on a GSI with more than one RANGE attribute. | `cassandra-integration`, required, on Cassandra 4.1 | Some management operations are not atomic. A few known race conditions are open. TTL removes about 1,000 expired items per table per minute. See [Known Limitations](docs/cassandra-setup.md#known-limitations). | +**1. Initialize.** `init` creates the catalog (the database that holds table definitions, accounts, users, policies, access keys and settings; see [Catalog Model](docs/manuals/01-architecture-guide.md#catalog-model)), an `admin` user, a TLS certificate in `~/.extenddb/tls/` and `extenddb.toml`. On SQLite the catalog and the tables share one file, `extenddb.sqlite`. `init` prints the admin password once; save it. -On every backend, run one ExtendDB server for each catalog. Only SQLite enforces this. [Differences from DynamoDB](docs/differences-from-dynamodb.md) lists the differences of each backend from the service. +```sh +./target/release/extenddb init +``` -The `@extenddb/dev` npm package and the `extenddb/extenddb-dev` image run a dev-mode SQLite build, for local development and CI. Dev mode uses plain HTTP and seeds an example key that can do everything, so keep a dev-mode server on loopback. At startup it migrates a catalog that is behind it, after it copies the database file. +**2. Start the server.** It listens on `https://127.0.0.1:18443` and runs in the background. -## Quick Start +```sh +./target/release/extenddb serve +``` -```bash -# Build -cargo build --release +**3. Create an access key.** These commands create a user named `dev`, allow it every DynamoDB action, and print its key. First run this line on its own, type or paste the admin password (it is not echoed) and press Enter; `manage` reads it from `EXTENDDB_PASSWORD`: -# Initialize (creates databases, admin credentials, TLS cert, config file) -./target/release/extenddb init +```sh +read -rs EXTENDDB_PASSWORD && export EXTENDDB_PASSWORD +``` -# Start -./target/release/extenddb serve --config extenddb.toml - -# Use with any AWS SDK (TLS with self-signed cert — trust via AWS_CA_BUNDLE) -export AWS_CA_BUNDLE=~/.extenddb/tls/cert.pem - -# Requests must be signed with an access key this server issued. Create an IAM -# user, attach a policy that allows DynamoDB, and create an access key for the -# user, with the admin password that init printed. manage reads the password -# from EXTENDDB_PASSWORD, which keeps it out of the shell history and the -# process list. list-accounts prints the account_id of the default account -# that init created. -read -rs EXTENDDB_PASSWORD && export EXTENDDB_PASSWORD # the admin password, not echoed -./target/release/extenddb manage --user admin list-accounts -./target/release/extenddb manage --user admin \ - create-user --account-id --user-name quickstart -./target/release/extenddb manage --user admin \ - put-user-policy --account-id --user-name quickstart \ - --policy-name FullAccess \ - --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"dynamodb:*","Resource":"*"}]}' -./target/release/extenddb manage --user admin \ - create-access-key --account-id --user-name quickstart +Then run the rest: + +```sh +ACCOUNT_ID=$(./target/release/extenddb manage --user admin \ + list-accounts | grep -o '[0-9]\{12\}' | head -n 1) +./target/release/extenddb manage --user admin create-user \ + --account-id "$ACCOUNT_ID" --user-name dev +./target/release/extenddb manage --user admin put-user-policy \ + --account-id "$ACCOUNT_ID" --user-name dev \ + --policy-name DynamoDBAll \ + --policy-document '{"Version":"2012-10-17","Statement":[ + {"Effect":"Allow","Action":"dynamodb:*","Resource":"*"}]}' +./target/release/extenddb manage --user admin create-access-key \ + --account-id "$ACCOUNT_ID" --user-name dev unset EXTENDDB_PASSWORD +``` -# Set the access_key_id and secret_access_key that create-access-key printed -export AWS_ACCESS_KEY_ID= -export AWS_SECRET_ACCESS_KEY= -aws dynamodb list-tables --endpoint-url https://127.0.0.1:18443 --region us-east-1 +**4. Point the AWS CLI at it.** Run this line on its own. `aws configure` asks for the `access_key_id` and `secret_access_key` that `create-access-key` printed; answer `us-east-1` for the region, and press Enter at the output format. + +```sh +aws configure --profile extenddb ``` -See [Getting Started](docs/getting-started.md) for the full walkthrough, or use the platform installer scripts: +Then run the rest. AWS keys set in the shell override the profile, so the first line clears them. The server accepts only requests signed for its region, `us-east-1` unless `extenddb.toml` sets another, so the second line pins it. The last line trusts the self-signed certificate and turns off the CLI pager. -```bash -scripts/install-linux.sh # Linux -scripts/install-macos.sh # macOS +```sh +unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN +export AWS_PROFILE=extenddb AWS_REGION=us-east-1 +export AWS_CA_BUNDLE=~/.extenddb/tls/cert.pem AWS_PAGER="" ``` -## Prerequisites +**5. Create a table and use it.** A new table starts in `CREATING`, and a write before it is `ACTIVE` gets `ResourceNotFoundException`, so wait for it first. + +```sh +aws dynamodb create-table --endpoint-url https://127.0.0.1:18443 \ + --table-name Music \ + --attribute-definitions AttributeName=Artist,AttributeType=S \ + AttributeName=SongTitle,AttributeType=S \ + --key-schema AttributeName=Artist,KeyType=HASH \ + AttributeName=SongTitle,KeyType=RANGE \ + --billing-mode PAY_PER_REQUEST +aws dynamodb wait table-exists --endpoint-url https://127.0.0.1:18443 \ + --table-name Music +aws dynamodb put-item --endpoint-url https://127.0.0.1:18443 \ + --table-name Music \ + --item '{"Artist": {"S": "No One You Know"}, + "SongTitle": {"S": "Call Me Today"}, + "Year": {"N": "2025"}}' +aws dynamodb get-item --endpoint-url https://127.0.0.1:18443 \ + --table-name Music \ + --key '{"Artist": {"S": "No One You Know"}, + "SongTitle": {"S": "Call Me Today"}}' +``` -- Rust 1.94.0+ (`rustup update`) -- Python 3.10+ (for test suites and documentation) -- A storage backend: - - PostgreSQL 14+ (see `docs/local-postgres-setup.md`) - - SQLite (embedded) - - MongoDB 7+ (see `docs/local-mongodb-setup.md`) - - Cassandra 4.1+ (see `docs/cassandra-setup.md`) +`get-item` prints the item shown at the top of this page. An AWS SDK takes the same endpoint, region, key and certificate. [Getting Started](docs/getting-started.md) covers the other backends and the web console, and [`samples/`](samples/) has Python examples. -### Python Environment +Stop the server with `./target/release/extenddb stop`. To undo step 4, run `unset AWS_PROFILE AWS_REGION AWS_CA_BUNDLE AWS_PAGER`; the `extenddb` profile stays in `~/.aws/` until you delete it. -```bash -python3 -m venv ~/venvs/extenddb-venv -source ~/venvs/extenddb-venv/bin/activate -pip install -r requirements.txt -``` +On SQLite, PostgreSQL and MongoDB, `./target/release/extenddb destroy --yes` deletes the databases. It leaves `extenddb.toml`, the backup store and `~/.extenddb/`. -## Authentication Modes +- **SQLite:** `destroy` deletes `extenddb.sqlite` and its `-wal` and `-shm` files. It leaves the `.lock` file and the copies that `migrate --yes` makes, one for each run that applies a migration, named `extenddb.sqlite.pre-migration--to--