mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-02 18:17:11 +09:00
You could not install a database from ServerKit. The tree's four roots were literals, only MySQL and PostgreSQL reported real state, and no install path existed anywhere in the backend. Rather than add one, this makes a database engine an ordinary app template that declares a top-level `engine:` block — family, wire protocol, admin user, which variable holds the password, what it calls a "table". Presence of that block is the only thing that lists a template in the Databases catalog, and installing it is the template pipeline that already existed: same deployment job, same streaming console. The consequence is the point. Adding CockroachDB is adding a YAML file. So is adding something we have never heard of — author it locally or sync a template repo — and the install form still works, because it is generated from the template's own `variables[]` rather than hand-written per engine. There is no engine model, no engine table, no engine install mechanism to keep in step. `test_dropping_a_new_engine_yaml_lists_it` is the design; if it ever needs code to pass, this went wrong. Twelve engines ship: postgresql, mysql, mariadb, mongodb, redis, valkey, cockroachdb, clickhouse, influxdb, neo4j, meilisearch, couchdb. Each pins its image, binds to loopback, names a data volume, and was checked against the upstream image's actual environment contract — a wrong variable name is a container that boots with authentication silently disabled. Two safety notes worth reading. Engines bind 127.0.0.1 unless explicitly exposed, and the flag is applied after caller variables so a handcrafted payload cannot quietly publish one. And CockroachDB single-node runs `--insecure` because password auth needs a certificate-backed cluster: for engines with no credentials at all the loopback bind is the only control, so public exposure is refused outright rather than warned about. A test pins the passwordless list to exactly cockroachdb, so a future template that drops its password variable fails loudly instead of opening a hole. Also surfaced at last: `ManagedDatabase.owner_application_id` has been accepted by the create endpoints for ages with no UI to set it. Creating a database now offers "Attach to application". Deferred deliberately: new-table builder, SQL dump import, engine extensions (pgvector, TimescaleDB) — each a data-mutation surface deserving its own round. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
94 lines
2.7 KiB
YAML
94 lines
2.7 KiB
YAML
id: cockroachdb
|
|
name: CockroachDB
|
|
version: "24.1"
|
|
description: Distributed SQL database that speaks the PostgreSQL wire protocol, with survivable single-node mode for self-hosting
|
|
icon: https://serverkit.ai/imgs/template-icons/cockroachdb.svg
|
|
categories:
|
|
- database
|
|
- sql
|
|
- distributed
|
|
website: https://www.cockroachlabs.com
|
|
documentation: https://www.cockroachlabs.com/docs/
|
|
|
|
engine:
|
|
family: Relational
|
|
# Cockroach speaks pgwire, so a PostgreSQL client can introspect it.
|
|
protocol: postgresql
|
|
default_port: 26257
|
|
admin_user: root
|
|
# Deliberately NO admin_password_var -- see the note on the compose command.
|
|
database_var: DB_NAME
|
|
port_var: PORT
|
|
bind_var: BIND_ADDRESS
|
|
unit: tables
|
|
client: cockroach sql
|
|
data_path: /cockroach/cockroach-data
|
|
version_var: IMAGE_TAG
|
|
versions:
|
|
- "24.1"
|
|
- "23.2"
|
|
|
|
variables:
|
|
- name: IMAGE_TAG
|
|
type: string
|
|
default: "24.1"
|
|
hidden: true
|
|
description: Image tag; constrained to engine.versions by the installer
|
|
- name: PORT
|
|
type: port
|
|
default: "26257"
|
|
hidden: false
|
|
description: Host port to publish the SQL endpoint on
|
|
- name: ADMIN_UI_PORT
|
|
type: port
|
|
default: "26258"
|
|
hidden: false
|
|
description: Host port for the DB Console (web UI)
|
|
- name: BIND_ADDRESS
|
|
type: string
|
|
default: 127.0.0.1
|
|
hidden: true
|
|
description: Address the ports bind to. 127.0.0.1 keeps the engine private.
|
|
- name: DB_NAME
|
|
type: string
|
|
default: defaultdb
|
|
description: Initial database to create
|
|
|
|
compose:
|
|
services:
|
|
app:
|
|
# Cockroach Labs publishes rolling `latest-v<major.minor>` tags.
|
|
image: cockroachdb/cockroach:latest-v${IMAGE_TAG}
|
|
container_name: ${APP_NAME}
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${BIND_ADDRESS}:${PORT}:26257"
|
|
- "${BIND_ADDRESS}:${ADMIN_UI_PORT}:8080"
|
|
environment:
|
|
# Creates the database at first start. COCKROACH_USER/COCKROACH_PASSWORD
|
|
# are intentionally NOT set: password auth requires a secure (TLS)
|
|
# cluster with generated certificates, which single-node self-hosting
|
|
# does not set up. `--insecure` therefore means NO authentication -- the
|
|
# 127.0.0.1 bind above is what keeps this safe, so do not expose this
|
|
# engine publicly without first moving it to a certificate-backed
|
|
# secure cluster.
|
|
COCKROACH_DATABASE: "${DB_NAME}"
|
|
command: start-single-node --insecure
|
|
volumes:
|
|
- cockroachdb-data:/cockroach/cockroach-data
|
|
|
|
volumes:
|
|
cockroachdb-data:
|
|
|
|
ports:
|
|
- port: "${PORT}"
|
|
protocol: postgresql
|
|
description: SQL (PostgreSQL wire protocol)
|
|
- port: "${ADMIN_UI_PORT}"
|
|
protocol: http
|
|
description: DB Console
|
|
|
|
requirements:
|
|
memory: 2GB
|
|
storage: 10GB
|