diff --git a/deploy/database/rnacos/0.8/compose.yaml b/deploy/database/rnacos/0.8/compose.yaml new file mode 100644 index 000000000..e6bd9bfb4 --- /dev/null +++ b/deploy/database/rnacos/0.8/compose.yaml @@ -0,0 +1,23 @@ +services: + database: + image: docker.cnb.cool/znb/images/rnacos:v0.8.5 + container_name: dbx-rnacos-0.8 + ports: + - "${DB_BIND_ADDRESS:-127.0.0.1}:${DB_PORT:-8849}:8848" + - "${DB_BIND_ADDRESS:-127.0.0.1}:${RNACOS_GRPC_PORT:-9849}:9848" + - "${DB_BIND_ADDRESS:-127.0.0.1}:${RNACOS_CONSOLE_PORT:-10849}:10848" + volumes: + - data:/io + environment: + RNACOS_INIT_ADMIN_USERNAME: admin + RNACOS_INIT_ADMIN_PASSWORD: "${DB_PASSWORD:-123456}" + RNACOS_HTTP_PORT: "8848" + restart: always + healthcheck: + test: ["CMD-SHELL", "bash -ec 'exec 3<>/dev/tcp/127.0.0.1/8848; printf \"GET /health HTTP/1.1\\r\\nHost: localhost\\r\\nConnection: close\\r\\n\\r\\n\" >&3; cat <&3 | grep -q success'"] + interval: 5s + timeout: 5s + retries: 30 + start_period: 10s +volumes: + data: diff --git a/deploy/database/rnacos/0.8/init/README.md b/deploy/database/rnacos/0.8/init/README.md new file mode 100644 index 000000000..c0df4e4e2 --- /dev/null +++ b/deploy/database/rnacos/0.8/init/README.md @@ -0,0 +1,5 @@ +# r-nacos initialization + +The service initializes the `admin` administrator from `RNACOS_INIT_ADMIN_USERNAME` and `RNACOS_INIT_ADMIN_PASSWORD` when its data volume is empty. The DBX recipe defaults the password to `123456`; set `DB_PASSWORD` before the first start to choose another password. + +The named `data` volume preserves the initialized account. Changing `DB_PASSWORD` after the first start does not change the existing administrator password. Run `make db-reset DB=rnacos@0.8 CONFIRM=1` before starting again when a fresh account is required. diff --git a/deploy/database/rnacos/0.8/recipe.json b/deploy/database/rnacos/0.8/recipe.json new file mode 100644 index 000000000..d8ffbce7a --- /dev/null +++ b/deploy/database/rnacos/0.8/recipe.json @@ -0,0 +1,13 @@ +{ + "database": "rnacos", + "name": "r-nacos", + "version": "0.8.5", + "displayVersion": "0.8", + "image": "docker.cnb.cool/znb/images/rnacos:v0.8.5", + "platforms": ["linux/amd64", "linux/arm64"], + "service": "database", + "defaultPort": 8848, + "connection": { "host": "127.0.0.1", "port": 8849, "username": "admin", "password": "123456", "database": "dbx", "namespace": "public", "grpcPort": 9849, "consolePort": 10849 }, + "shell": ["bash"], + "smoke": { "steps": [{ "name": "check the HTTP health endpoint", "command": ["bash", "-ec", "exec 3<>/dev/tcp/127.0.0.1/8848; printf 'GET /health HTTP/1.1\\r\\nHost: localhost\\r\\nConnection: close\\r\\n\\r\\n' >&3; cat <&3"], "expect": "success" }] } +} diff --git a/docs/content/docs/database-lab.cn.mdx b/docs/content/docs/database-lab.cn.mdx index 83b3a21b2..4c29ed569 100644 --- a/docs/content/docs/database-lab.cn.mdx +++ b/docs/content/docs/database-lab.cn.mdx @@ -27,6 +27,7 @@ description: 为 DBX 开发与验证启动可重复创建的本地数据库实 | Qdrant | `qdrant/1.8` | `qdrant/qdrant:v1.8.3` | `docker.cnb.cool/znb/images/qdrant:v1.8.3` | `6334` | `dbx-qdrant-1.8` | | Redis | `redis/3.0.7` | `redis:3.0.7-alpine` | `docker.cnb.cool/znb/images/redis:3.0.7-alpine` | `6380` | `dbx-redis-3.0.7` | | Redis | `redis/7.4` | `redis:7.4.9-alpine` | `docker.cnb.cool/znb/images/redis:7.4.9-alpine` | `6380` | `dbx-redis-7.4` | +| r-nacos | `rnacos/0.8` | `qingpan/rnacos:v0.8.5` | `docker.cnb.cool/znb/images/rnacos:v0.8.5` | `8849` | `dbx-rnacos-0.8` | | ZooKeeper | `zookeeper/3.9` | `zookeeper:3.9.5` | `docker.cnb.cool/znb/images/zookeeper:3.9.5` | `2182` | `dbx-zookeeper-3.9` | 所有网络数据库的默认宿主端口都比标准端口大 `1`,并且该约定由配方校验器强制检查。默认密码统一为 `123456`,默认数据库名为 `dbx`。Redis 不支持命名数据库,因此使用 DB 0,并以 `dbx:` 作为冒烟键前缀。Compose 默认使用 CNB 镜像列;Docker Hub 列保留官方上游地址,便于核对来源或直接拉取。Redis 3.0.7 仅支持 amd64;在 arm64 主机上启动时会单独提醒,Docker 将使用模拟运行。其余配方均支持 amd64 和 arm64。 @@ -37,6 +38,12 @@ Nacos 使用管理员用户名 `nacos`、密码 `123456` 和默认 `public` 命 DB_PORT=8818 NACOS_CONSOLE_PORT=8010 NACOS_GRPC_PORT=9818 NACOS_RAFT_PORT=9819 make db DB=nacos@3.2 ``` +r-nacos 使用管理员账号 `admin` 和密码 `123456`。DBX 配方的 HTTP、gRPC 和 Web 控制台宿主端口默认分别为 `8849`、`9849`、`10849`;上游单机 Compose 使用 `8848:8848`、`9848:9848`、`10848:10848`。若需避开本机端口冲突,可使用以下自定义宿主端口映射(不是上游默认值): + +```bash +DB_PORT=3848 RNACOS_GRPC_PORT=3748 RNACOS_CONSOLE_PORT=3048 make db DB=rnacos@0.8 +``` + etcd 会创建密码为 `123456` 的 `root` 用户、授予 root 角色并开启认证。默认客户端和 peer 主机端口为 `2380`、`2381`。如需使用上游 Docker 命令中的端口,可执行: ```bash @@ -71,6 +78,7 @@ make db make db-list make db DB=postgresql@17.4 make db-verify DB=postgresql@17.4 +make db DB=rnacos@0.8 ``` 不带参数执行 `make db` 会输出当前全部支持的、可直接复制启动的命令,以及可选参数。传入 `DB=product@version` 后,`db` 会等待 Compose 健康检查通过并输出 DBX 连接字段。`db-verify` 还会在数据库容器中执行配方中的冒烟命令,并校验预期输出;提交数据库相关修复前推荐执行此命令。 diff --git a/docs/content/docs/database-lab.mdx b/docs/content/docs/database-lab.mdx index cf30f4746..518ffc535 100644 --- a/docs/content/docs/database-lab.mdx +++ b/docs/content/docs/database-lab.mdx @@ -27,6 +27,7 @@ The Database Test Lab provides small, pinned Docker Compose environments for tes | Qdrant | `qdrant/1.8` | `qdrant/qdrant:v1.8.3` | `docker.cnb.cool/znb/images/qdrant:v1.8.3` | `6334` | `dbx-qdrant-1.8` | | Redis | `redis/3.0.7` | `redis:3.0.7-alpine` | `docker.cnb.cool/znb/images/redis:3.0.7-alpine` | `6380` | `dbx-redis-3.0.7` | | Redis | `redis/7.4` | `redis:7.4.9-alpine` | `docker.cnb.cool/znb/images/redis:7.4.9-alpine` | `6380` | `dbx-redis-7.4` | +| r-nacos | `rnacos/0.8` | `qingpan/rnacos:v0.8.5` | `docker.cnb.cool/znb/images/rnacos:v0.8.5` | `8849` | `dbx-rnacos-0.8` | | ZooKeeper | `zookeeper/3.9` | `zookeeper:3.9.5` | `docker.cnb.cool/znb/images/zookeeper:3.9.5` | `2182` | `dbx-zookeeper-3.9` | Every network recipe uses a host port one greater than the database standard port, and the recipe validator enforces that contract. The default password is `123456`, and the default database is `dbx`. Redis has no named databases, so it uses DB 0 with a `dbx:` smoke-key prefix. Compose uses the CNB image column; the Docker Hub column preserves the official upstream reference for provenance and direct pulls. Redis 3.0.7 is amd64-only; on arm64 hosts the command prints an architecture warning and Docker uses emulation. Every other recipe supports both amd64 and arm64. @@ -37,6 +38,12 @@ Nacos uses the `nacos` administrator, password `123456`, and its default `public DB_PORT=8818 NACOS_CONSOLE_PORT=8010 NACOS_GRPC_PORT=9818 NACOS_RAFT_PORT=9819 make db DB=nacos@3.2 ``` +r-nacos uses the `admin` administrator and password `123456`. The DBX recipe defaults its HTTP, gRPC, and web-console host ports to `8849`, `9849`, and `10849`; the upstream standalone Compose file publishes `8848:8848`, `9848:9848`, and `10848:10848`. To avoid local port conflicts, use this custom host-port mapping (not the upstream defaults): + +```bash +DB_PORT=3848 RNACOS_GRPC_PORT=3748 RNACOS_CONSOLE_PORT=3048 make db DB=rnacos@0.8 +``` + etcd creates the `root` user with password `123456`, grants the root role, then enables authentication. Its default client and peer ports are `2380` and `2381`. To use the upstream Docker command's ports, run: ```bash @@ -71,6 +78,7 @@ make db make db-list make db DB=postgresql@17.4 make db-verify DB=postgresql@17.4 +make db DB=rnacos@0.8 ``` `make db` without parameters prints every currently supported copy-and-paste start command, plus optional parameters. With `DB=product@version`, it waits for the Compose health check and prints the DBX connection fields. `db-verify` also runs the recipe's smoke command inside the database container and checks its expected output. It is the preferred command before reporting a database-specific fix. diff --git a/scripts/database-env.test.mjs b/scripts/database-env.test.mjs index b01598dc6..33b82389c 100644 --- a/scripts/database-env.test.mjs +++ b/scripts/database-env.test.mjs @@ -155,6 +155,7 @@ test('uses the approved CNB mirror images and matching recipe versions', () => { 'qdrant@1.8': { version: '1.8.3', image: 'docker.cnb.cool/znb/images/qdrant:v1.8.3', platforms: ['linux/amd64', 'linux/arm64'] }, 'redis@3.0.7': { version: '3.0.7', image: 'docker.cnb.cool/znb/images/redis:3.0.7-alpine', platforms: ['linux/amd64'] }, 'redis@7.4': { version: '7.4.9', image: 'docker.cnb.cool/znb/images/redis:7.4.9-alpine', platforms: ['linux/amd64', 'linux/arm64'] }, + 'rnacos@0.8': { version: '0.8.5', image: 'docker.cnb.cool/znb/images/rnacos:v0.8.5', platforms: ['linux/amd64', 'linux/arm64'] }, 'zookeeper@3.9': { version: '3.9.5', image: 'docker.cnb.cool/znb/images/zookeeper:3.9.5', platforms: ['linux/amd64', 'linux/arm64'] }, }); assert.equal(discoverRecipes().find((recipe) => recipeSelector(recipe) === 'redis@3.0.7').connection.username, undefined); @@ -176,6 +177,19 @@ test('initializes both Nacos versions with the shared administrator credentials' } }); +test('configures r-nacos with its admin account and console port', () => { + const recipe = discoverRecipes().find((item) => recipeSelector(item) === 'rnacos@0.8'); + assert.equal(recipe.connection.username, 'admin'); + assert.equal(recipe.connection.password, '123456'); + assert.equal(recipe.connection.grpcPort, 9849); + assert.equal(recipe.connection.consolePort, 10849); + + const compose = readFileSync(join(recipe.directory, 'compose.yaml'), 'utf8'); + assert.match(compose, /RNACOS_CONSOLE_PORT/); + assert.doesNotMatch(compose, /curl/); + assert.deepEqual(validateRecipe(recipe), []); +}); + test('configures Qdrant with the shared API key', () => { const recipe = discoverRecipes().find((item) => recipeSelector(item) === 'qdrant@1.8'); assert.equal(recipe.connection.username, '');