Docs / Operations
Upgrades
Beta builds carry no upgrade promise. An upgrade is a coordinated stop, or a new deployment and a restore.
Available View Markdown
# Upgrades
> Status: Available. Beta builds carry no upgrade promise. An upgrade is a coordinated stop, or a new deployment and a restore.
Two rules:
1. **Never run two builds against one bucket prefix.** There is no rolling upgrade.
2. **Read the new build's notes first.** They say whether the storage format changed.
## Same storage format: stop everything, then start everything
1. Back up every database. Keep the old binary and its build record.
2. Stop every node. Check that no `gauntlet` process of the old build is left on any host, including `backup` and `restore-database` runs.
3. Install the new binary on every node, after `sha256sum --check`.
4. Start every node. On each, check `gauntlet probe ready` and that `gauntlet admin status` shows the new build.
This costs one outage, from the last old process stopping to the new ones being ready. To roll back, stop every node and start the old build.
## Changed storage format: a new deployment
The new build runs as a separate deployment on a **new bucket prefix**, and each database moves by backup and restore. The old deployment stays untouched until you have verified the copy.
## From the beta to v1
There will be no in-place upgrade. Data moves by backup and restore, or by export.
## Coming
Rolling upgrades are deferred and not near-term. A dump-and-load export path (P10.6) is a v1 item and is also the beta-to-v1 route.
---
Source: https://gauntlet-db.stavros.xyz/docs/operations/upgrades
Connect this project to my existing Gauntlet database.
Context:
- Documentation index for agents: https://gauntlet-db.stavros.xyz/llms.txt
- Quickstart: https://gauntlet-db.stavros.xyz/docs/quickstart.md
- SQL compatibility and error codes: https://gauntlet-db.stavros.xyz/docs/sql/compatibility.md
- Database: the one already configured for this project
- Protocol: PostgreSQL wire or the native HTTP JSON API, whichever this project already uses
- Connection values are in environment variables: GAUNTLET_DATABASE_URL (PostgreSQL wire),
GAUNTLET_HTTP_URL (HTTP base URL) and GAUNTLET_DATABASE_TOKEN (the database token).
These names are a convention, not a shipped SDK setting. Keep this project's own names if it has them.
Before editing, read the Gauntlet documentation above and inspect how this project
already talks to its database. Gauntlet is pre-beta software; where the documentation
and my deployment disagree, tell me instead of guessing.
What Gauntlet is:
- A distributed SQL database. SQL is the SQLite family, run by the Turso engine.
- The PostgreSQL wire protocol is a transport only. There is no PostgreSQL SQL dialect,
no pg_catalog or information_schema, no extensions, and no ORM is certified yet.
- libSQL client compatibility is not available yet. Do not assume it.
Connecting:
- PostgreSQL wire: dbname is the database name, the user name is ignored, and the
password is the database token. Authentication is SCRAM-SHA-256. Keep TLS
verification on (sslmode=verify-full with the deployment's CA certificate).
- HTTP: POST <GAUNTLET_HTTP_URL>/db/<name>/sql with a JSON body
{"sql": "...", "params": [...]} and the header "Authorization: Bearer <token>".
POST /db/<name>/tx runs a list of statements atomically.
SQL rules that differ from PostgreSQL:
- Every table needs an explicit primary key, and INSERT supplies the key value.
- CREATE TABLE is a standalone statement outside a transaction. There is no ALTER TABLE,
DROP TABLE or CREATE INDEX; an index comes only from a UNIQUE constraint at creation.
- Parameters are $1, ?1 or ?. Names are single-part (no schema.table).
- Column types follow SQLite affinity. In prepared statements ordinary columns are
described as text; CAST(x AS INTEGER) when the driver needs a number.
Errors you must handle (SQLSTATE):
- 40001: conflict. Roll back and retry the whole transaction. Locking is no-wait, so
this is normal under contention.
- 40003: commit outcome unknown. Do NOT retry. Look the transaction up with
GET /db/<name>/txn/<txid> and replay only if the status is `aborted`.
- 57P03: cannot serve right now. Roll back, then retry the whole transaction with backoff.
- 53300: too many connections. Back off; keep the pool below the node's limit.
Credentials and scope:
- Use only the database token for this one database. Keep it server-side and out of
source, logs, browser bundles and this conversation.
- Never use or ask for a deployment admin token, a client token or bucket credentials.
- Do not create, drop, back up, restore or branch databases, and do not rotate credentials.
Task:
1. Add the smallest connection integration that fits this project.
2. Run one explicit `SELECT 1` connectivity check. It may activate this database if it
is idle; do not probe or wake any other database.
3. Do not change the schema or write application data unless I ask for it.
Report the files changed, the protocol and client used, the result of the check, and
anything this project needs that Gauntlet does not support.Two rules:
- Never run two builds against one bucket prefix. There is no rolling upgrade.
- Read the new build's notes first. They say whether the storage format changed.
#Same storage format: stop everything, then start everything
- Back up every database. Keep the old binary and its build record.
- Stop every node. Check that no
gauntletprocess of the old build is left on any host, includingbackupandrestore-databaseruns. - Install the new binary on every node, after
sha256sum --check. - Start every node. On each, check
gauntlet probe readyand thatgauntlet admin statusshows the new build.
This costs one outage, from the last old process stopping to the new ones being ready. To roll back, stop every node and start the old build.
#Changed storage format: a new deployment
The new build runs as a separate deployment on a new bucket prefix, and each database moves by backup and restore. The old deployment stays untouched until you have verified the copy.
#From the beta to v1
There will be no in-place upgrade. Data moves by backup and restore, or by export.
#Coming
Rolling upgrades are deferred and not near-term. A dump-and-load export path (P10.6) is a v1 item and is also the beta-to-v1 route.