百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
oddk

oddk

> 数据库
免费

具有主观观点的数据库部署套件 — 为 PostgreSQL 本地运行的 RDS

199 stars0 点赞5 次浏览
访问官网GitHub

工具介绍

具有主观观点的数据库部署套件 — 为 PostgreSQL 本地运行的 RDS

ODDK — Opinionated Database Deployment Kit

Run PostgreSQL on your own Linux box with the ergonomics of a managed service.

ODDK is a single Go binary that manages PostgreSQL the way a cloud provider's managed database does — create an instance, get a connection string, take scheduled snapshots, ship them offsite to S3, watch health, restore on demand, upgrade major versions — except it all runs locally against Docker, on hardware you control. Think "a small, self-hosted RDS for Postgres."

bash
oddk create --name app --version 17 --port 5432 --cpu 4 --ram 8   # pulls the image if needed
oddk instance get-postgres-password app --conn
# postgresql://postgres:••••••••@10.88.0.1:5432/postgres

What it is

  • A local "managed Postgres" control plane. One daemon + CLI that owns the full lifecycle of PostgreSQL instances running as Docker containers.
  • Opinionated and batteries-included. Sensible defaults for resources, shared memory, networking, and tuning — plus AWS-style parameter groups when you want to override them.
  • Operationally complete. Whole-deployment snapshots — scheduled, shipped to S3, and able to rebuild a single instance or an entire host — plus health monitoring with Email/Slack/Telegram/Webhook alerts, password and user management, minor-version image switches, dump/restore major upgrades, and legacy per-instance backups (still the way to restore a single database).
  • Actually recoverable. A snapshot carries every instance's data and ODDK's own configuration, so a dead host can be rebuilt from one archive plus the master key — not reassembled by hand from per-database dumps.
  • Secure by default for a single host. Secrets encrypted at rest, a loopback-only API behind a bearer token, and Postgres bound to a host-local bridge — not the public internet.
  • Single binary, no runtime dependencies beyond Docker. Pure Go, builds static, installs in seconds.

What it is not

  • Not a high-availability / clustering / replication manager. No failover, no streaming replicas, no quorum. It runs standalone instances well.
  • Not a multi-tenant hosted service. It assumes a single trusted operator on a single host. Anyone with the API token has admin-equivalent control.
  • Not an internet-facing database gateway. The API binds to 127.0.0.1 and Postgres binds to a host-local Docker bridge. Reach them over an SSH tunnel, not by exposing ports.
  • Not a Postgres fork, driver, or connection pooler. It orchestrates the official PostgreSQL images (and compatible ones like pgvector/postgis); it doesn't replace your client library or PgBouncer.
  • Not a Kubernetes operator. It talks to the Docker API directly. If you're on Kubernetes, use an operator instead.
  • Not something you run inside Docker. ODDK manages and monitors Docker from the host — it is the control plane, not a workload. See Run ODDK on the host, not inside a container.
  • Not for Windows or production macOS. Linux is the deployment target; macOS is supported for development only.

Why ODDK

If you've ever wanted RDS-style convenience — "give me a database, back it up, tell me when it's unhealthy, let me restore it" — without the cloud bill, the network exposure, or hand-rolling docker run + pg_dump + cron + a monitoring script, ODDK is that, as one tool with one mental model.

You want… ODDK gives you…
A new database, fast oddk create → ready-to-use Postgres with a connection string
Confidence it's backed up snapshot make, one scheduled snapshot covering everything, S3 offsite with retention
To not lose data snapshot restore-instance (one instance) or snapshot apply (a whole host)
To know when it breaks Health checks + degraded/restored notifications
To tune Postgres safely AWS-style parameter groups with expression evaluation
To move to a new major instance major-upgrade via dump/restore
Secrets handled properly AES-256-GCM-encrypted passwords, tokenized API auth

Requirements

  • Linux (x86_64 or arm64)
  • Docker (running)
  • systemd (for the installed service)

Run ODDK on the host, not inside a container

ODDK is a Docker control plane. Run it on the host, directly on the machine that runs Docker — never inside a container.

The whole point of ODDK is to manage and monitor Docker: it creates and destroys PostgreSQL containers, attaches them to a host bridge network, reads host disk/CPU/memory for health checks, and writes state and snapshot/backup archives to host paths. That is the opposite of being a containerized workload itself. Running ODDK inside Docker inverts the relationship and breaks its assumptions — host-level resource metrics, the 10.88.0.0/16 bridge and 10.88.0.1 gateway binding, data/backup paths, and the systemd service lifecycle all expect a host process. Bind-mounting the Docker socket into a container to work around this is exactly the inversion ODDK is designed to avoid, and is not supported.

If what you actually want is to run a database inside Docker/Compose as part of a containerized stack, that is a different problem with different tools — use Docker Compose, a Kubernetes operator, or your platform's managed database instead. ODDK is for owning the host and treating Docker as the thing it drives.


Installation

On a Linux server with Docker and systemd, install (or update) the latest release:

bash
curl -fsSL https://raw.githubusercontent.com/andrianbdn/oddk/main/install.sh | sh

Pin a specific version:

bash
curl -fsSL https://raw.githubusercontent.com/andrianbdn/oddk/main/install.sh | sh -s -- --version v0.1.39

The installer downloads the release binary from GitHub, verifies it against the published SHA256SUMS, and:

  • installs the binary to /usr/local/bin/oddk
  • creates a dedicated oddk service user (no login shell) with state under /var/lib/oddk (data/, backups/)
  • installs and starts a systemd unit (oddk.service)
  • configures the CLI for the user who ran the installer, writing ~/.config/oddk/cli.json

That last step means the person who runs the installer can use oddk right away — no sudo, no becoming the oddk user.

Installing and updating use the same command. Re-run the curl installer at any time — on an existing install it detects the service, swaps the binary in place, restarts, and keeps the previous binary as oddk.prev for instant rollback. There is no separate update step.

Before updating, skim CHANGELOG.md. Most releases need nothing from you, but the entries marked Action do — a credential to rotate, or a schedule to resume after a disaster-recovery restore.

Configuring the CLI for another user

The CLI authenticates to the daemon with a bearer token. To set up oddk for an additional user, mint a token and install their config in one step:

bash
eval "$(sudo -u oddk /usr/local/bin/oddk auth mint)"

The plaintext token is shown only when created and cannot be read back later. If you lose it, mint a new one with oddk auth mint. Use oddk auth mint --json to print the config instead of eval-able shell, oddk auth list to see existing tokens, and oddk auth delete to revoke one.


First steps

After installation the daemon is running and your CLI is configured. From here:

bash
# 1. Create an instance — 4 CPUs, 8 GB RAM, listening on port 5432.
#    The PostgreSQL image is pulled automatically if it isn't already local.
oddk create --name app --version 17 --port 5432 --cpu 4 --ram 8

# 2. See what you have
oddk list

# 3. Get connection details (password is auto-generated, encrypted at rest)
oddk instance get-postgres-password app --conn        # full connection string
eval "$(oddk instance get-postgres-password app --envs)"  # export PG* env vars

# 4. Open a psql shell
oddk instance psql app

Connecting from the host:

postgresql://postgres:[email protected]:/postgres

Connecting from another Docker container (e.g. your app's docker-compose.yml):

yaml
extra_hosts:
  - "host.docker.internal:host-gateway"
# then: postgresql://postgres:[email protected]:/postgres

Common usage

oddk is organized into subcommands. Everything below has --help (oddk instance --help, oddk snapshot --help, …).

Instances

…

Create/start/switch/reconfigure block until Postgres actually accepts connections before reporting success, so a command never returns "running" while the server is still coming up.

Databases & users

Deploying a new service? One command creates the database and its owner user (rolling back the user if database creation fails), and prints the generated password and a ready-to-paste connection string. The user owns the database, so migrations just work:

bash
oddk instance create-db app --database billing --username billing   # DB + owner user

The pieces are also available separately (read-only and extra users are added with add-db-user once the database exists):

bash
oddk instance create-db app --database analytics
oddk instance list-dbs app

oddk instance add-db-user app --username appuser --database analytics            # read-write
oddk instance add-db-user app --username reader  --database analytics --readonly # read-only
oddk instance add-db-user app --username appuser --database analytics --owner    # owner (runs migrations)
oddk instance reset-db-user-password app --username appuser
oddk instance delete-db-user app --username appuser

add-db-user creates the role, grants access, and applies any requested ownership changes in one transaction. A failed grant or ownership transfer rolls all of them back. Ownership transfer includes public-schema functions and stored procedures.

delete-db-user first reassigns everything the user owns to postgres, then revokes its grants and drops the role. If that reassignment fails the command aborts and leaves the user in place — it will not proceed to a step that would drop the objects instead of the grants. On a very large database the reassign can exhaust the shared lock table (out of shared memory ... increase max_locks_per_transaction); raise max_locks_per_transaction with a parameter group and retry.

Concurrent application DDL is also guarded: if a new object would be deleted during privilege cleanup, the command aborts and rolls back that database's cleanup, preserving the object and the user. Stop the application's DDL and retry. Cleanup already completed in other databases is not rolled back.

Passwords

bash
oddk instance get-postgres-password app                 # structured details
oddk instance get-postgres-password app --plain         # just the password
oddk instance get-postgres-password app --conn          # connection string
NEW_PGPASSWORD=secret oddk instance set-postgres-password app

Snapshots — the recommended way to protect a deployment

A snapshot captures everything: every instance's databases and roles, plus ODDK's own configuration, in one archive. It is what a host migration or a real disaster recovery restores from. A per-instance backup cannot do that — it holds one instance's data and none of the configuration needed to rebuild it.

…

One instance failing does not cost the others their archive. If an instance cannot be captured — its server is unreachable, its stored password no longer authenticates, PostgreSQL is out of WAL senders, its container has vanished — that instance is recorded in the snapshot as configuration-only and everything else is captured normally. The archive is kept, uploaded and catalogued, because it is still the newest restore point for every other instance. But the run reports failure: snapshot make exits non-zero and names the insta

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

backupdevopsdocker

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年9月9日
最后更新2026年9月18日
分类数据库
定价免费

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库