离线安装(allinone)

当前安装方式可以仅通过运行一个容器快速体验到 Rainbond 完整功能。仅适用于体验 Rainbond 功能或者个人开发环境。支持 WindowsMacOSLinux 三大操作系统,以及 x86_64Arm64 两种主流架构。

前提

离线安装(allinone) - 图1caution
  1. 安装 Docker
  2. 可用内存至少大于 4G,推荐 8G 以上
  3. 可用磁盘 50G 以上
  4. 机器上 80、443、6060、6443、7070、8443 端口可用

注意: 如果是centos 8 则需要执行以下命令。

  1. echo iptable_raw > /etc/modules-load.d/iptable_raw.conf

部署流程

  • Linux
  • Linux Arm64

1. 准备 dind 镜像和离线安装所需 tar 包

  • 在有网络的环境下提前准备好 Rainbond dind 镜像和离线安装所需 tar 包。
  1. mkdir -p ~/build_offline && cd ~/build_offline
  2. wget https://rainbond-pkg.oss-cn-shanghai.aliyuncs.com/offline/5.X/rainbond-offline-v5.10.1-amd64.tar
  3. docker pull registry.cn-hangzhou.aliyuncs.com/goodrain/rainbond:v5.10.1-dind-allinone
  4. vim Dockerfile
  • 粘贴以下内容到 Dockerfile 里
  1. FROM registry.cn-hangzhou.aliyuncs.com/goodrain/rainbond:v5.10.1-dind-allinone
  2. COPY rainbond-offline-v5.10.1-amd64.tar /app/offline.tar
  • 保存后继续执行以下命令
  1. docker build -t registry.cn-hangzhou.aliyuncs.com/goodrain/rainbond:v5.10.1-dind-allinone .
  2. docker save -o rainbond-v5.10.1-dind-allinone.tar registry.cn-hangzhou.aliyuncs.com/goodrain/rainbond:v5.10.1-dind-allinone
  • 导入 tar 包到你需要离线安装的服务器中。
  1. docker load -i rainbond-v5.10.1-dind-allinone.tar

2. 设置 EIP 环境变量(非必填)

你需要指定一个 IP 地址,在部署完成后,将使用该 IP 地址访问 Rainbond 控制台。该 IP 通过环境变量 EIP 进行设置。

该地址可以是部署机器上的公网 IP 或内网 IP。IP 地址可以通过执行 ifconfig 命令获得。

离线安装(allinone) - 图2caution

当你填写内网IP,如 192.168.3.25 时,切换网络环境后可能无法访问。因此如果仅本地测试体验,可以填写本地回环地址。 如 export EIP=127.0.0.1

  1. export EIP=<你的IP地址>

3. 启动 Rainbond

  1. docker run --privileged -d -p 7070:7070 -p 80:80 -p 443:443 -p 6060:6060 -p 8443:8443 \
  2. --name=rainbond-allinone --restart=on-failure \
  3. -v ~/.ssh:/root/.ssh \
  4. -v ~/rainbonddata:/app/data \
  5. -v /opt/rainbond:/opt/rainbond \
  6. -e EIP=$EIP \
  7. registry.cn-hangzhou.aliyuncs.com/goodrain/rainbond:v5.10.1-dind-allinone \
  8. && docker logs -f rainbond-allinone

执行完上述命令后,耐心等待 5-10 分钟,可以看到如下日志输出,表示 Rainbond 已启动完成

安装日志输出如下:

  1. 2022-10-11 11:44:49 WARN: Too little free disk space, recommended disk space greater than 50G
  2. 2022-10-11 11:44:49 INFO: Memory: 7821 MB, CPUs: 2, Disk: 31884 MB
  3. 2022-10-11 11:44:49 INFO: move images
  4. 2022-10-11 11:45:05 INFO: K3s is starting, please wait ············································
  5. 2022-10-11 11:47:09 INFO: K3s started successfully
  6. namespace/rbd-system created
  7. 2022-10-11 11:47:09 INFO: Create namespace rbd-system
  8. NAME: rainbond-operator
  9. LAST DEPLOYED: Tue Oct 11 11:47:16 2022
  10. NAMESPACE: rbd-system
  11. STATUS: deployed
  12. REVISION: 1
  13. TEST SUITE: None
  14. 2022-10-11 11:47:17 INFO: Helm rainbond-operator installed
  15. 2022-10-11 11:47:19 INFO: Rainbond Region installed
  16. 2022-10-11 11:47:19 INFO: Rainbond Region is starting, please wait ············································
  17. 2022-10-11 11:48:36 INFO: Rainbond Region started successfully
  18. 2022-10-11 11:48:38 INFO: K3s is restarting, please wait ············································
  19. 2022-10-11 11:50:19 INFO: K3s restarted successfully
  20. pod "rbd-chaos-9f6nf" deleted
  21. 2022-10-11 11:50:22 INFO: Rainbond console is starting, please wait ············································
  22. 2022-10-11 11:50:38 INFO: Rainbond started successfully, Please pass http://47.105.90.153:7070 Access Rainbond

1. 准备 dind 镜像和离线安装所需 tar 包

  • 在有网络的环境下提前准备好 Rainbond dind 镜像和离线安装所需 tar 包。
  1. mkdir -p ~/build_offline && cd ~/build_offline
  2. wget https://rainbond-pkg.oss-cn-shanghai.aliyuncs.com/offline/5.X/rainbond-offline-v5.10.1-arm64.tar
  3. docker pull registry.cn-hangzhou.aliyuncs.com/goodrain/rainbond:v5.10.1-arm64-dind-allinone
  4. vim Dockerfile
  • 粘贴以下内容到 Dockerfile 里
  1. FROM registry.cn-hangzhou.aliyuncs.com/goodrain/rainbond:v5.10.1-arm64-dind-allinone
  2. COPY rainbond-offline-v5.10.1-arm64.tar /app/offline.tar
  • 保存后继续执行以下命令
  1. docker build -t registry.cn-hangzhou.aliyuncs.com/goodrain/rainbond:v5.10.1-arm64-dind-allinone .
  2. docker save -o rainbond-v5.10.1-arm64-dind-allinone.tar registry.cn-hangzhou.aliyuncs.com/goodrain/rainbond:v5.10.1-arm64-dind-allinone
  • 导入 tar 包到目标服务器中。
  1. docker load -i rainbond-v5.10.1-arm64-dind-allinone.tar

2. 设置 EIP 环境变量(非必填)

你需要指定一个 IP 地址,在部署完成后,将使用该 IP 地址访问 Rainbond 控制台。该 IP 通过环境变量 EIP 进行设置。

该地址可以是部署机器上的公网 IP 或内网 IP。IP 地址可以通过执行 ifconfig 命令获得。

离线安装(allinone) - 图3caution

当你填写内网IP,如 192.168.3.25 时,切换网络环境后可能无法访问。因此如果仅本地测试体验,可以填写本地回环地址。 如 export EIP=127.0.0.1

  1. export EIP=<你的IP地址>

3. 启动 Rainbond

  1. docker run --privileged -d -p 7070:7070 -p 80:80 -p 443:443 -p 6060:6060 -p 8443:8443 \
  2. --name=rainbond-allinone --restart=on-failure \
  3. -v ~/.ssh:/root/.ssh \
  4. -v ~/rainbonddata:/app/data \
  5. -v /opt/rainbond:/opt/rainbond \
  6. -e EIP=$EIP \
  7. registry.cn-hangzhou.aliyuncs.com/goodrain/rainbond:v5.10.1-arm64-dind-allinone \
  8. && docker logs -f rainbond-allinone

执行完上述命令后,耐心等待 5-10 分钟,可以看到如下日志输出,表示 Rainbond 已启动完成

安装日志输出如下:

  1. 2022-10-11 11:44:49 WARN: Too little free disk space, recommended disk space greater than 50G
  2. 2022-10-11 11:44:49 INFO: Memory: 7821 MB, CPUs: 2, Disk: 31884 MB
  3. 2022-10-11 11:44:49 INFO: move images
  4. 2022-10-11 11:45:05 INFO: K3s is starting, please wait ············································
  5. 2022-10-11 11:47:09 INFO: K3s started successfully
  6. namespace/rbd-system created
  7. 2022-10-11 11:47:09 INFO: Create namespace rbd-system
  8. NAME: rainbond-operator
  9. LAST DEPLOYED: Tue Oct 11 11:47:16 2022
  10. NAMESPACE: rbd-system
  11. STATUS: deployed
  12. REVISION: 1
  13. TEST SUITE: None
  14. 2022-10-11 11:47:17 INFO: Helm rainbond-operator installed
  15. 2022-10-11 11:47:19 INFO: Rainbond Region installed
  16. 2022-10-11 11:47:19 INFO: Rainbond Region is starting, please wait ············································
  17. 2022-10-11 11:48:36 INFO: Rainbond Region started successfully
  18. 2022-10-11 11:48:38 INFO: K3s is restarting, please wait ············································
  19. 2022-10-11 11:50:19 INFO: K3s restarted successfully
  20. pod "rbd-chaos-9f6nf" deleted
  21. 2022-10-11 11:50:22 INFO: Rainbond console is starting, please wait ············································
  22. 2022-10-11 11:50:38 INFO: Rainbond started successfully, Please pass http://47.105.90.153:7070 Access Rainbond

4. 补充离线版本镜像

  • load 离线镜像的 tar 包
  1. docker exec -ti rainbond-allinone bash
  2. nerdctl -n k8s.io load < /app/offline.tar
  • 给部分离线镜像重新打 tag
  1. nerdctl -n k8s.io tag registry.cn-hangzhou.aliyuncs.com/goodrain/kaniko-executor:latest goodrain.me/kaniko-executor:latest
  2. nerdctl -n k8s.io tag registry.cn-hangzhou.aliyuncs.com/goodrain/runner:v5.8.1-release goodrain.me/runner:latest
  3. nerdctl -n k8s.io tag registry.cn-hangzhou.aliyuncs.com/goodrain/builder:v5.8.1-release goodrain.me/builder:latest
  • 切换 rbdcomponent 资源里的 rbd-resource-proxy。
  1. kubectl edit rbdcomponent rbd-resource-proxy -n rbd-system
  • 修改下面命令打开的 yaml 中 image: 后面的内容
  1. registry.cn-hangzhou.aliyuncs.com/goodrain/resource-proxy:v5.10.1-release

修改结果如下:

  1. spec:
  2. image: registry.cn-hangzhou.aliyuncs.com/goodrain/resource-proxy:v5.10.1-release
  • 查看 goodrain.me 的密码
  1. kubectl get rainbondcluster -n rbd-system -oyaml|grep password
  • 登陆本地的 goodrain.me 镜像仓库,用户名为 admin ,密码就是你刚刚获取到的。
  1. nerdctl login goodrain.me
  • 推送离线镜像到 goodrain.me 镜像仓库
  1. nerdctl -n k8s.io push goodrain.me/kaniko-executor:latest
  2. nerdctl -n k8s.io push goodrain.me/runner:latest
  3. nerdctl -n k8s.io push goodrain.me/builder:latest
  • 最后一步,补充 chaos 的 tag
  1. kubectl edit rbdcomponent rbd-chaos -n rbd-system

修改结果如下:

  1. spec:
  2. args:
  3. - --db-type=sqlite
  4. - --kaniko-image=goodrain.me/kaniko-executor:latest

访问 Rainbond

此时,你已经成功安装了离线版 Rainbond,你现在可以根据日志中提示的访问地址进行访问,开始你的体验之旅

常见问题

安装问题: