Skip to content

Commit

Permalink
docs: add openim scripts deployment system
Browse files Browse the repository at this point in the history
Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>
  • Loading branch information
cubxxw committed Oct 26, 2023
1 parent 200fbd9 commit 104c78d
Show file tree
Hide file tree
Showing 33 changed files with 614 additions and 543 deletions.
11 changes: 9 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@ MINIO_ENDPOINT=http://172.28.0.1:10005

# Base URL for the application programming interface (API).
# Default: API_URL=http://172.28.0.1:10002
API_URL=http://127.0.0.1:10002
API_URL=http://14.155.86.214:10002

# Directory path for storing data files or related information.
# Default: DATA_DIR=./
DATA_DIR=./
DATA_DIR=/root/workspaces/openim/Open-IM-Server

# Choose the appropriate image address, the default is GITHUB image,
# you can choose docker hub, for Chinese users can choose Ali Cloud
# export IMAGE_REGISTRY="ghcr.io/openimsdk"
# export IMAGE_REGISTRY="openim"
# export IMAGE_REGISTRY="registry.cn-hangzhou.aliyuncs.com/openimsdk"
IMAGE_REGISTRY=ghcr.io/openimsdk

# ======================================
# ========= Network Configuration ======
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ gen:
demo:
@$(MAKE) go.demo

## versionchecker: Check version of openim. ✨
.PHONY: versionchecker
versionchecker:
## version: Check version of openim. ✨
.PHONY: version
version:
@$(MAKE) go.versionchecker

## build: Build binaries by default ✨
Expand Down
15 changes: 7 additions & 8 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
# --| target: config/config.yaml
# -----------------------------------------------------------------

envs:
discovery: zookeeper

###################### Zookeeper ######################
# Zookeeper configuration
# It's not recommended to modify the schema
#
# Zookeeper address
# Zookeeper username
# Zookeeper password
envs:
discovery: zookeeper

zookeeper:
schema: openim
address: [ 172.28.0.1:12181 ]
Expand Down Expand Up @@ -135,14 +135,14 @@ api:
# minio.signEndpoint is minio public network address
object:
enable: "minio"
apiURL: "http://127.0.0.1:10002"
apiURL: "http://14.155.86.214:10002"
minio:
bucket: "openim"
endpoint: "http://172.28.0.1:10005"
accessKeyID: "root"
secretAccessKey: "openIM123"
sessionToken: ''
signEndpoint: "http://127.0.0.1:10005"
signEndpoint: "http://14.155.86.214:10005"
publicRead: false
cos:
bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
Expand All @@ -168,7 +168,6 @@ rpcPort:
openImUserPort: [ 10110 ]
openImFriendPort: [ 10120 ]
openImMessagePort: [ 10130 ]
openImMessageGatewayPort: [ 10140 ]
openImGroupPort: [ 10150 ]
openImAuthPort: [ 10160 ]
openImPushPort: [ 10170 ]
Expand Down Expand Up @@ -199,7 +198,7 @@ rpcRegisterName:
# Whether to output in json format
# Whether to include stack trace in logs
log:
storageLocation: ../../logs/
storageLocation: /root/workspaces/openim/Open-IM-Server/logs/
rotationTime: 24
remainRotationCount: 2
remainLogLevel: 6
Expand All @@ -216,8 +215,8 @@ log:
# Websocket connection handshake timeout
longConnSvr:
openImWsPort: [ 10001 ]
openImMessageGatewayPort: [ 10140 ]
websocketMaxConnNum: 100000
openImMessageGatewayPort: [ 10140 ]
websocketMaxMsgLen: 4096
websocketTimeout: 10

Expand Down
92 changes: 39 additions & 53 deletions deployments/README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,69 @@
# OpenIM 应用容器化部署指南
# OpenIM Application Containerization Deployment Guide

OpenIM 支持很多种集群化部署方式,包括但不限于 helm, sealos, kubeam, kubesphere, kubeflow, kuboard, kubespray, k3s, k3d, k3c, k3sup, k3v, k3x
OpenIM supports a variety of cluster deployment methods, including but not limited to `helm`, `sealos`, `kustomize`

**目前还在开发这个模块,预计 v3.2.0 之前会有一个集群方案。**
Various contributors, as well as previous official releases, have provided some referenceable solutions:

目前各个贡献者,以及之前的官方有出过一些可以参考的方案:
+ [k8s-jenkins Repository](https://github.com/OpenIMSDK/k8s-jenkins)
+ [open-im-server-k8s-deploy Repository](https://github.com/openimsdk/open-im-server-k8s-deploy)
+ [openim-charts Repository](https://github.com/OpenIMSDK/openim-charts)
+ [deploy-openim Repository](https://github.com/showurl/deploy-openim)

- https://github.com/OpenIMSDK/k8s-jenkins
- https://github.com/openimsdk/open-im-server-k8s-deploy
- https://github.com/OpenIMSDK/openim-charts
- https://github.com/showurl/deploy-openim


### 依赖检查
### Dependency Check

```bash
Kubernetes: >= 1.16.0-0
Helm: >= 3.0
```

### Minimum Configuration

### 最低配置

建议生产环境的最低配置如下:
The recommended minimum configuration for a production environment is as follows:

```bash
```yaml
CPU: 4
Memory: 8G
Disk: 100G
```
## 生成配置文件
## Configuration File Generation
我们将自动文件全部自动化处理了,所以生成配置文件对于 openim 来说是可选的,但是如果你想要自定义配置,可以参考下面的步骤:
We have automated all the files, making the generation of configuration files optional for OpenIM. However, if you desire custom configurations, you can follow the steps below:
```bash
$ make init
# 或者是使用脚本:
# Alternatively, use script:
# ./scripts/init-config.sh
```
此时会帮你在 `deployments/openim/config` 目录下生成配置文件,你可以根据自己的需求进行修改。

At this point, configuration files will be generated under `deployments/openim/config`, which you can modify as per your requirements.

## 集群搭建
## Cluster Setup

如果你已经有了一个 `kubernetes` 集群,或者是你希望自己从头开始搭建一个 `kubernetes` 那么你可以直接跳过这一步。
If you already have a `kubernetes` cluster, or if you wish to build a `kubernetes` cluster from scratch, you can skip this step.

为了快速开始,我使用 [sealos](https://github.com/labring/sealos) 来快速搭建集群,sealos 底层也是对 kubeadm 的封装:
For a quick start, I used [sealos](https://github.com/labring/sealos) to rapidly set up the cluster, with sealos also being a wrapper for kubeadm at its core:

```bash
$ SEALOS_VERSION=`curl -s https://api.github.com/repos/labring/sealos/releases/latest | grep -oE '"tag_name": "[^"]+"' | head -n1 | cut -d'"' -f4` && \
curl -sfL https://raw.githubusercontent.com/labring/sealos/${SEALOS_VERSION}/scripts/install.sh |
sh -s ${SEALOS_VERSION} labring/sealos
```

**支持的版本:**
**Supported Versions:**

+ docker: `labring/kubernetes-docker`:(v1.24.0~v1.27.0)
+ containerd: `labring/kubernetes`:(v1.24.0~v1.27.0)

#### Cluster Installation:

#### 安装集群:

集群的信息如下:
Cluster details are as follows:

| 机器名 | IP地址 | 系统信息 |
|---------|-----------------|------------------------------------------------------------------------------------------------------------|
| master01| 10.0.0.9 | Linux VM-0-9-ubuntu 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| node01 | 10.0.0.4 | Linux VM-0-9-ubuntu 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| node02 | 10.0.0.10 | Linux VM-0-9-ubuntu 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
| Hostname | IP Address | System Info |
| -------- | ---------- | ------------------------------------------------------------ |
| master01 | 10.0.0.9 | `Linux VM-0-9-ubuntu 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux` |
| node01 | 10.0.0.4 | Similar to master01 |
| node02 | 10.0.0.10 | Similar to master01 |

```bash
$ export CLUSTER_USERNAME=ubuntu
Expand All @@ -80,50 +75,41 @@ $ sudo sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:
-p "$CLUSTER_PASSWORD"
```

> **Node**
> 卸载的方式:使用 `kubeadm` 卸载并不会清除 `etcd``cni` 相关,所以需要手动清除,或者使用 `sealos` 卸载。
> **Node** Uninstallation method: using `kubeadm` for uninstallation does not remove `etcd` and `cni` related configurations. Manual clearance or using `sealos` for uninstallation is needed.
>
> ```bash
> sealos reset
> $ sealos reset
> ```
### 安装 helm
### Installing helm
helm通过打包的方式,支持发布的版本管理和控制,很大程度上简化了Kubernetes应用的部署和管理。
Helm simplifies the deployment and management of Kubernetes applications to a large extent by offering version control and release management through packaging.
**使用脚本:**
**Using Script:**
```bash
$ curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
```
**Helm Version:**

```bash
$ helm version
version.BuildInfo{Version:"v3.13.1", GitCommit:"3547a4b5bf5edb5478ce352e18858d8a552a4110", GitTreeState:"clean", GoVersion:"go1.20.8"}
``

**添加仓库:**
**Adding Repository:**

```bash
$ helm repo add brigade https://openimsdk.github.io/openim-charts
```

### OpenIM 的镜像策略
### OpenIM Image Strategy

自动化提供的 aliyun, ghcr, docker hub: https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md
Automated offerings include aliyun, ghcr, docker hub: [Image Documentation](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md)

**本地化测试构建方法:**
**Local Test Build Method:**

```bash
$ make image
```

> This command assists in quickly building the required images locally. For a detailed build strategy, refer to the [Build Documentation](https://github.com/openimsdk/open-im-server/blob/main/build/README.md).
### 容器化安装
## Installation

具体安装步骤如下:
Explore our Helm-Charts repository and read through: [Helm-Charts Repository](https://github.com/openimsdk/helm-charts)

> **Note**
> 针对中国的用户,阅读我们的 [Docker 镜像标准](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md) 以便使用国内 aliyun 的镜像地址。OpenIM 也有针对中国的 gitee 同步仓库,你可以在 [gitee.com](https://gitee.com/openimsdk) 上找到它。
Loading

0 comments on commit 104c78d

Please sign in to comment.