docs: 部署手册镜像地址改为单仓库格式 iotlcm/iotlcm:<服务名>-<版本>

官方仓库把全部镜像放在同一个镜像仓库 iotlcm/iotlcm 下,靠 tag 区分服务:

  .../iotlcm/iotlcm:mysql-8.0
  .../iotlcm/iotlcm:iotlcm-admin-svr-v1.0.4
  .../iotlcm/iotlcm:iotlcm-app-server-v1.0.2

改动页面:
- prerequisites:镜像仓库章节重写,补充命名空间/镜像仓库/tag 三层结构说明,
  不再提 library/ 命名空间
- configuration:镜像地址示例与 tag 规则表
- build-image:构建命令、命名规则表、基础组件同步脚本、验证命令同步改
- offline:离线镜像清单
- split:分离部署示例

已构建通过,6 个相关页面均可访问。
This commit is contained in:
MiFaZhan
2026-10-30 09:15:42 +08:00
parent 3ab3682d14
commit b4944d7c21
5 changed files with 78 additions and 58 deletions
+45 -36
View File
@@ -79,7 +79,7 @@ docker build \
--build-arg BuildVersion=$VERSION \
--build-arg CommitID=$COMMIT \
--build-arg BuildTime=$BUILD_TIME \
-t your-registry/iotlcm/iotlcm-openapi:$VERSION \
-t your-registry/iotlcm/iotlcm:iotlcm-openapi-$VERSION \
.
```
@@ -91,7 +91,7 @@ docker build \
--build-arg BuildVersion=$VERSION \
--build-arg CommitID=$COMMIT \
--build-arg BuildTime=$BUILD_TIME \
-t your-registry/iotlcm/iotlcm-admin-svr:$VERSION \
-t your-registry/iotlcm/iotlcm:iotlcm-admin-svr-$VERSION \
-f server/build/Dockerfile server/
```
@@ -99,12 +99,12 @@ docker build \
```bash
cd iotlcm-admin-ui/vue
docker build -t your-registry/iotlcm/iotlcm-admin-ui:$VERSION -f build/Dockerfile .
docker build -t your-registry/iotlcm/iotlcm:iotlcm-admin-ui-$VERSION -f build/Dockerfile .
```
```bash
cd iotlcm-app/app
docker build -t your-registry/iotlcm/iotlcm-app-web:$VERSION .
docker build -t your-registry/iotlcm/iotlcm:iotlcm-app-web-$VERSION .
```
### 构建参数说明
@@ -123,24 +123,32 @@ docker build --build-arg GOPROXY=https://goproxy.cn,direct -t ... .
## 镜像命名规则
部署编排按以下名称拉取镜像,自建时需保持一致。`<镜像仓库>` 即官方仓库前缀 `crpi-qflrqrxoohlkkvgc.cn-chengdu.personal.cr.aliyuncs.com`:
官方仓库把**所有镜像放在同一个镜像仓库** `iotlcm/iotlcm` 下,靠 tag 区分服务与版本:
| 服务 | 镜像名 |
| --- | --- |
| admin-svr | `<镜像仓库>/iotlcm/iotlcm-admin-svr:<TAG>` |
| admin-ui | `<镜像仓库>/iotlcm/iotlcm-admin-ui:<TAG>` |
| openapi | `<镜像仓库>/iotlcm/iotlcm-openapi:<TAG>` |
| app-server | `<镜像仓库>/iotlcm/iotlcm-app-server:<TAG>` |
| app-web | `<镜像仓库>/iotlcm/iotlcm-app-web:<TAG>` |
| upstream-chan | `<镜像仓库>/iotlcm/iotlcm-upstream-chan:<TAG>` |
| upstream-proxy | `<镜像仓库>/iotlcm/iotlcm-upstream-proxy:<TAG>` |
| worker-svr | `<镜像仓库>/iotlcm/iotlcm-worker-svr:<TAG>` |
| sms | `<镜像仓库>/iotlcm/iotlcm-sms:<TAG>` |
| bot | `<镜像仓库>/iotlcm/iotlcm-bot:<TAG>` |
| docs | `<镜像仓库>/iotlcm/iotlcm-docs:<TAG>` |
| onelink-mock | `<镜像仓库>/iotlcm/iotlcm-onelink-mock:<TAG>` |
```text
<Registry>/iotlcm/iotlcm:<服务名>-<版本>
```
基础组件(`mysql`、`redis`、`rabbitmq`、`consul`、`nginx`)不需要构建,只需从上游同步到 `<镜像仓库>/library/`,见下节。
| 服务 | tag | 完整示例 |
| --- | --- | --- |
| admin-svr | `iotlcm-admin-svr-<TAG>` | `.../iotlcm/iotlcm:iotlcm-admin-svr-v1.0.4` |
| admin-ui | `iotlcm-admin-ui-<TAG>` | `.../iotlcm/iotlcm:iotlcm-admin-ui-v1.0.4` |
| openapi | `iotlcm-openapi-<TAG>` | `.../iotlcm/iotlcm:iotlcm-openapi-v1.0.4` |
| app-server | `iotlcm-app-server-<TAG>` | `.../iotlcm/iotlcm:iotlcm-app-server-v1.0.2` |
| app-web | `iotlcm-app-web-<TAG>` | `.../iotlcm/iotlcm:iotlcm-app-web-v1.0.2` |
| upstream-chan | `iotlcm-upstream-chan-<TAG>` | `.../iotlcm/iotlcm:iotlcm-upstream-chan-v1.0.4` |
| upstream-proxy | `iotlcm-upstream-proxy-<TAG>` | `.../iotlcm/iotlcm:iotlcm-upstream-proxy-v1.0.4` |
| worker-svr | `iotlcm-worker-svr-<TAG>` | `.../iotlcm/iotlcm:iotlcm-worker-svr-v1.0.4` |
| sms | `iotlcm-sms-<TAG>` | `.../iotlcm/iotlcm:iotlcm-sms-v1.0.4` |
| bot | `iotlcm-bot-<TAG>` | `.../iotlcm/iotlcm:iotlcm-bot-v1.0.4` |
| docs | `iotlcm-docs-<TAG>` | `.../iotlcm/iotlcm:iotlcm-docs-v1.0.4` |
| onelink-mock | `iotlcm-onelink-mock-<TAG>` | `.../iotlcm/iotlcm:iotlcm-onelink-mock-v1.0.4` |
基础组件(`mysql`、`redis`、`rabbitmq`、`consul`、`nginx`)不需要构建,从上游同步到同一仓库即可,tag 为 `<组件>-<版本>`,见下节。
::: warning tag 必须带上服务名
同一个仓库里 tag 不能重复。只用版本号(如 `v1.0.4`)会让 12 个服务互相覆盖,因此 tag 固定为 `<服务名>-<版本>`。
:::
## 同步基础组件
@@ -155,27 +163,28 @@ docker login --username=sdqmx $REPO
sync_image() {
local src=$1 dst=$2
docker pull "$src"
docker tag "$src" "$REPO/library/$dst"
docker push "$REPO/library/$dst"
docker tag "$src" "$REPO/iotlcm/iotlcm:$dst"
docker push "$REPO/iotlcm/iotlcm:$dst"
}
sync_image mysql:8.0 mysql:8.0
sync_image redis:7.2 redis:7.2
sync_image rabbitmq:4.3.5-management rabbitmq:4.3.5-management
sync_image hashicorp/consul:1.22 consul:1.22
sync_image nginx:1.30 nginx:1.30
# 参数:<上游镜像> <目标 tag(组件名-版本)>
sync_image mysql:8.0 mysql-8.0
sync_image redis:7.2 redis-7.2
sync_image rabbitmq:4.3.5-management rabbitmq-4.3.5-management
sync_image hashicorp/consul:1.22 consul-1.22
sync_image nginx:1.30 nginx-1.30
```
::: warning 同步时把版本号固定到补丁位
`mysql:8.0` 这类浮动 tag 会随上游发新补丁而变化。建议同步时锁定到具体补丁版(如 `mysql:8.0.43`),并把 `docker-compose.yml` 的 `MYSQL_VERSION` 同步改为 `8.0.43`,保证多台机器拉到的镜像完全一致。
`mysql:8.0` 这类浮动 tag 会随上游发新补丁而变化。建议同步时锁定到具体补丁版(如 `mysql:8.0.43`),tag 写成 `mysql-8.0.43`,并把 `docker-compose.yml` 里对应的 `image` 同步改掉,保证多台机器拉到的镜像完全一致。
:::
同步完成后校验:
```bash
for img in mysql:8.0 redis:7.2 rabbitmq:4.3.5-management consul:1.22 nginx:1.30; do
docker manifest inspect "$REPO/library/$img" >/dev/null 2>&1 \
&& echo "✅ $img" || echo "❌ $img"
for tag in mysql-8.0 redis-7.2 rabbitmq-4.3.5-management consul-1.22 nginx-1.30; do
docker manifest inspect "$REPO/iotlcm/iotlcm:$tag" >/dev/null 2>&1 \
&& echo "✅ $tag" || echo "❌ $tag"
done
```
@@ -187,14 +196,14 @@ done
REG=harbor.internal.example.com
TAG=1.0.3
docker tag iotlcm-openapi:local $REG/iotlcm/iotlcm-openapi:$TAG
docker tag iotlcm-openapi:local $REG/iotlcm/iotlcm:iotlcm-openapi-$TAG
docker login $REG
docker push $REG/iotlcm/iotlcm-openapi:$TAG
docker push $REG/iotlcm/iotlcm:iotlcm-openapi-$TAG
```
```yaml
# docker-compose.yml —— 逐个替换 image 前缀
image: 'harbor.internal.example.com/iotlcm/iotlcm-openapi:1.0.3'
image: 'harbor.internal.example.com/iotlcm/iotlcm:iotlcm-openapi-v1.0.4'
```
::: tip 只覆盖部分服务
@@ -262,10 +271,10 @@ echo "全部完成,镜像标签:$REPO/iotlcm/*:$TAG"
docker images | grep iotlcm
# 二进制能否启动
docker run --rm your-registry/iotlcm/iotlcm-openapi:$TAG --help 2>&1 | head
docker run --rm your-registry/iotlcm/iotlcm:iotlcm-openapi-$TAG --help 2>&1 | head
# 检查架构
docker inspect your-registry/iotlcm/iotlcm-openapi:$TAG \
docker inspect your-registry/iotlcm/iotlcm:iotlcm-openapi-$TAG \
--format '{{.Architecture}}/{{.Os}}'
```
+9 -5
View File
@@ -26,14 +26,18 @@ outline: deep
### 镜像地址
```yaml
image: 'crpi-qflrqrxoohlkkvgc.cn-chengdu.personal.cr.aliyuncs.com/library/mysql:8.0'
image: 'crpi-qflrqrxoohlkkvgc.cn-chengdu.personal.cr.aliyuncs.com/iotlcm/iotlcm-admin-svr:latest'
image: 'crpi-.../iotlcm/iotlcm:mysql-8.0'
image: 'crpi-.../iotlcm/iotlcm:iotlcm-admin-svr-v1.0.4'
```
- 基础组件在 `<镜像仓库>/library/` 下
- 业务镜像在 `<镜像仓库>/iotlcm/` 下
所有镜像(基础组件 + 业务服务)都在**同一个镜像仓库** `<Registry>/iotlcm/iotlcm` 下,靠 tag 区分:
改用自有仓库时,全局替换前缀即可。
| tag 形式 | 示例 |
| --- | --- |
| 基础组件:`<组件>-<版本>` | `mysql-8.0`、`redis-7.2`、`nginx-1.30` |
| 业务服务:`<服务>-<版本>` | `iotlcm-admin-svr-v1.0.4`、`iotlcm-app-server-v1.0.2` |
改用自有仓库时,全局替换 Registry 前缀即可。
### 默认口令
+5 -5
View File
@@ -23,12 +23,12 @@ docker compose config --images | sort -u
输出示例(含可选 profile 时用 `--profile` 指定):
```text
registry.example.com/iotlcm/iotlcm-admin-svr:1.0.3
registry.example.com/iotlcm/iotlcm-admin-ui:1.0.3
registry.example.com/iotlcm/iotlcm-app-server:1.0.3
registry.example.com/iotlcm/iotlcm:iotlcm-admin-svr-v1.0.4
registry.example.com/iotlcm/iotlcm:iotlcm-admin-ui-v1.0.4
registry.example.com/iotlcm/iotlcm:iotlcm-app-server-v1.0.2
...
registry.example.com/library/mysql:8.0
registry.example.com/library/redis:7.2
registry.example.com/iotlcm/iotlcm:mysql-8.0
registry.example.com/iotlcm/iotlcm:redis-7.2
```
把清单保存下来,作为这次部署的镜像基线:
+18 -11
View File
@@ -64,29 +64,36 @@ docker compose version
| 命名空间 | `iotlcm` |
| 地域 | 西南1(成都) |
业务镜像路径为:
**所有镜像都放在同一个镜像仓库** `iotlcm/iotlcm` 下,靠 tag 区分服务与版本:
```text
crpi-qflrqrxoohlkkvgc.cn-chengdu.personal.cr.aliyuncs.com/iotlcm/iotlcm-admin-svr:1.0.3
crpi-qflrqrxoohlkkvgc.cn-chengdu.personal.cr.aliyuncs.com/iotlcm/iotlcm-openapi:1.0.3
...
crpi-.../iotlcm/iotlcm:mysql-8.0
crpi-.../iotlcm/iotlcm:redis-7.2
crpi-.../iotlcm/iotlcm:iotlcm-admin-svr-v1.0.4
crpi-.../iotlcm/iotlcm:iotlcm-openapi-v1.0.4
crpi-.../iotlcm/iotlcm:iotlcm-app-server-v1.0.2
```
tag 格式统一为 **`<服务名>-<版本>`**。
地址结构是 `<Registry>/<命名空间>/<镜像仓库>:<tag>`,即:
```text
crpi-...cn-chengdu.personal.cr.aliyuncs.com / iotlcm / iotlcm : iotlcm-admin-svr-v1.0.4
↑ 命名空间 ↑ 镜像仓库 ↑ tag
```
`docker-compose.yml` 里的镜像地址已预置为上述公网地址,一般无需修改。
::: tip 基础组件也在同一仓库
MySQL、Redis、RabbitMQ、Consul、nginx 同样托管在 `library/` 命名空间下,不从 Docker Hub 直连(公网不稳定且 tag 会漂)。版本已在编排文件中固定,**必须与仓库里实际同步的标签一致**。
:::
::: warning 基础组件需先同步
部署前 `library/` 下必须已有这五个镜像,否则拉取失败。同步方法见[自建镜像](build-image)的「同步基础组件」一节。
MySQL、Redis、RabbitMQ、Consul、nginx 同样在这个仓库里(`mysql-8.0`、`redis-7.2` 等 tag),不从 Docker Hub 直连(公网不稳定且 tag 会漂)。版本已在编排文件中固定。
:::
::: tip 阿里云 VPC 地址
若部署在阿里云同地域 ECS 上,可把编排文件里的镜像前缀改为 VPC 地址,走内网流量、不消耗公网带宽:
若部署在阿里云同地域 ECS 上,可把编排文件里的 Registry 前缀改为 VPC 地址,走内网流量、不消耗公网带宽:
```yaml
image: 'crpi-qflrqrxoohlkkvgc-vpc.cn-chengdu.personal.cr.aliyuncs.com/library/mysql:8.0'
image: 'crpi-qflrqrxoohlkkvgc-vpc.cn-chengdu.personal.cr.aliyuncs.com/iotlcm/iotlcm:mysql-8.0'
```
:::
+1 -1
View File
@@ -69,7 +69,7 @@ MYSQL_ROOT_PASSWORD='<口令>' MYSQL_APP_PASSWORD='<应用口令>' \
# docker-compose.app.yml
services:
admin-svr:
image: '${REGISTRY}/iotlcm/iotlcm-admin-svr:${TAG}'
image: '${REGISTRY}/iotlcm/iotlcm:iotlcm-admin-svr-${TAG}'
# ... 保留 ports / volumes / environment
# 删除 depends_on 中对 mysql/redis/rabbitmq 的依赖
```