cookbook / postgres
PostgreSQL
A PostgreSQL database with a persistent volume. Optional pgvector.
- database
- sql
Run it
briq_run({
recipe: "postgres",
params: {
"version": "16",
"extensions": [],
"size": "small"
},
wait: true
})briq run postgres
briq ls
briq logs -f <id>
briq rm <id>import { Briq } from '@briq/sdk';
const briq = new Briq(process.env.BRIQ_API_KEY);
const postgres = await briq.run({
recipe: 'postgres',
params: {
"version": "16",
"extensions": [],
"size": "small"
},
});
console.log(postgres.outputs.DATABASE_URL);
// ... when done
await briq.destroy(postgres.id);Parameters
| Name | Type | Options | Default |
|---|---|---|---|
| version | enum | 15, 16, 17 | "16" |
| extensions | enum[] | pgvector | [] |
| size | enum | nano, small, medium, large | "small" |
Outputs
Returned by briq_run once the stack is healthy. Hosts resolve inside your team network; secrets are generated per run.
- DATABASE_URL
- postgres://postgres:<POSTGRES_PASSWORD>@db.<stack>.internal:5432/app
- PGHOST
- db.<stack>.internal
- PGPORT
- 5432
- PGUSER
- postgres
- PGPASSWORD
- <POSTGRES_PASSWORD>
- PGDATABASE
- app
What it runs
| Briq | Image | Ports | Size | Volume |
|---|---|---|---|---|
| db | postgres:16 | 5432 | small | 10 GB at /var/lib/postgresql/data |
When to use it
- Your migrations, seeds or ORM schema need a real database to be verified against.
- An integration test suite expects
DATABASE_URLand you do not want mocks or Docker on the machine running it. - The agent needs vector search: pass
extensions: ["pgvector"]and it gets thepgvector/pgvectorimage for the chosen major version. - You want a scratch database that disappears on its own. The default TTL is 60 minutes.
Pick size: "nano" for schema checks and small fixtures, small (the default) for anything with
real data. The volume is 10 GB and mounted at /var/lib/postgresql/data, so a stopped briq keeps
its data.
Tips
- Wait for the healthcheck.
wait: truereturns only afterpg_isreadysucceeds; without it the first connection may hit a server that is still initialising. - Use the outputs, not the internals.
DATABASE_URLand thePG*variables are generated per run. The password is a write-only secret and is masked everywhere except in the run output. - Seed with a file.
briq_files_puta dump to/seed.sql, thenbriq_execwithpsql -U postgres -d app -f /seed.sql. - Stop instead of destroy while iterating: storage-only billing, and
briq_startbrings the data back. Destroy at the end of the session. - Reach it from another briq in the same stack at
db.<stack>.internal:5432. Postgres is not exposed publicly;briq_exposeis for HTTP services. - Major versions 15, 16 and 17 are supported. Extensions are limited to
pgvectortoday; ask for more in the cookbook issues.