Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DBLab enables 🖖 database branching and ⚡️ thin cloning for any Postgres database and empowers DB testing in CI/CD. This optimizes database-related costs while improving time-to-market and software quality. Follow to stay updated.

License

NotificationsYou must be signed in to change notification settings

postgres-ai/database-lab-engine

 
 

Repository files navigation

Boost your development process

![Joe Demo](./assets/db-lab.png)

Install

Currently, there are no ready-to-use binaries or a Docker image. The setupis to be done using the source code.

  1. Get the source code:git clone https://gitlab.com/postgres-ai/db-lab.git.
  2. Golang is required.
  3. Install ZFS (Ubuntu:https://gitlab.com/postgres-ai/db-lab/snippets/1918768).

ZFS Store

  1. Create a ZFS store with a clone ofthe production Postgres database (e.g. using WAL-E, WAL-G or Barman archive).
  2. Shutdown Postgres, create a new ZFS snapshot(sudo zfs snapshot -r zpool@db_state_1) and remember its name. It willbe needed for further configuration (initialSnapshot option inconfig/config.yml).
  3. Start Postgres.

Run

Deploy DB Lab instance in your infrastructure. You would need to:

  1. Createconfig/config.yml (see sample inconfig/).
  2. Buildmake all and run DB Lab with some token for REST API authorization./bin/dblab -v some-token (or, with log:./bin/dblab -v some-token 2>&1 | tee -a dblab.log).

REST API

Instance statuses:

  • OK - instance functions well.
  • WARNING - still functional, but have some problems, e.g. disk space shortage, insecure connection (upcoming MRs).

Clone statuses:

  • OK - clone is ready to accept postgres connections.
  • CREATING - clone is being created.
  • DELETING - clone is being deleted.
  • FATAL - fatal error happened (details in status message).

Basic models:

Clone{  id: "xxx",  status: {    code: "OK",    message: "Database is ready"  },  project: "proj1"  snapshot: "" (optional, ID or timestamp)  db: {    username: "postgres"    password: "" (never set on DB Lab side)    host: "xxx",    port: "xxx",    connStr: "xxx"  },  protected: true  deleteAt: "" (timestamp),  name: "",  username: "",  createdAt: ""}Error{  code: "NOT_ENOUGH_DISK_SPACE",  name: "Not enough disk space",  hint: "Stop idle clones, change snapshot policy or increase disk size"}

REST API:

Get DB Lab instance status and list clonesGET /statusResponse:{  status: {    code: "OK",    message: "DB Lab is ready"  },  disk: {    size: 1000.0, (bytes)    free: 1200.0  },  expectedCloningTime: 8.0, (secondss)  numClones: 10,  clones: [{    id: "id"    status: {      code: "OK",      message: "Database is ready"    },    ...  }, ... ], snapshots: [{   id: "xxx",   timestamp: "123" }, ... ]}Create a clonePOST /clone/Request:{  project: "proj1",  snapshot: (optional): "",  db: {    username: "xxx",    password: "xxx"  }  username: "xxx",  name: "xxx"}Response:{  id: "xxx"}Update a clonePATCH /clone/:idReset a clonePOST /clone/:id/resetDelete a cloneDELETE /clone/:idGet status of a cloneGET /clone/:idResponse:{  id: "xxx",  status: {    code: "OK",    message: "Database clone is ready"  },  cloneSize: 1000.0,  cloningTime: 5,  project: "xxx",  snapshot: "xxx",  db: {    username: "xxx",    host: "xxx",    port: "xxx",    connStr: "xxx"  },  protected: true,  deleteAt: "",  name: "xxx",  username: "xxx",  createdAt: "123"}

About

DBLab enables 🖖 database branching and ⚡️ thin cloning for any Postgres database and empowers DB testing in CI/CD. This optimizes database-related costs while improving time-to-market and software quality. Follow to stay updated.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp