2023-10-26 14:16:08 +08:00
# OpenIM Application Containerization Deployment Guide
2023-07-04 20:22:26 +08:00
2023-10-26 14:16:08 +08:00
OpenIM supports a variety of cluster deployment methods, including but not limited to `helm` , `sealos` , `kustomize`
2023-07-04 20:22:26 +08:00
2023-10-26 14:16:08 +08:00
Various contributors, as well as previous official releases, have provided some referenceable solutions:
2023-08-06 15:33:42 +08:00
2023-10-26 14:16:08 +08:00
+ [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 )
2023-08-06 15:33:42 +08:00
2023-10-26 14:16:08 +08:00
### Dependency Check
2023-07-04 20:22:26 +08:00
``` bash
Kubernetes: >= 1.16.0-0
Helm: >= 3.0
```
2023-10-26 14:16:08 +08:00
### Minimum Configuration
2023-07-04 20:22:26 +08:00
2023-10-26 14:16:08 +08:00
The recommended minimum configuration for a production environment is as follows:
2023-07-04 20:22:26 +08:00
2023-10-26 14:16:08 +08:00
``` yaml
2023-09-05 16:31:40 +08:00
CPU : 4
Memory : 8G
Disk : 100G
```
2023-10-26 14:16:08 +08:00
## Configuration File Generation
2023-07-04 20:22:26 +08:00
2023-10-26 14:16:08 +08:00
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:
2023-09-05 16:31:40 +08:00
``` bash
$ make init
2023-10-26 14:16:08 +08:00
# Alternatively, use script:
2023-09-05 16:31:40 +08:00
# ./scripts/init-config.sh
```
2023-07-04 20:22:26 +08:00
2023-10-26 14:16:08 +08:00
At this point, configuration files will be generated under `deployments/openim/config` , which you can modify as per your requirements.
2023-09-07 17:38:09 +08:00
2023-10-26 14:16:08 +08:00
## Cluster Setup
2023-09-07 17:38:09 +08:00
2023-10-26 14:16:08 +08:00
If you already have a `kubernetes` cluster, or if you wish to build a `kubernetes` cluster from scratch, you can skip this step.
2023-09-07 17:38:09 +08:00
2023-10-26 14:16:08 +08:00
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:
2023-09-07 17:38:09 +08:00
``` 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
```
2023-10-26 14:16:08 +08:00
**Supported Versions: **
2023-09-07 17:38:09 +08:00
+ docker: `labring/kubernetes-docker` :(v1.24.0~v1.27.0)
+ containerd: `labring/kubernetes` :(v1.24.0~v1.27.0)
2023-10-26 14:16:08 +08:00
#### Cluster Installation:
2023-09-07 17:38:09 +08:00
2023-10-26 14:16:08 +08:00
Cluster details are as follows:
2023-09-07 17:38:09 +08:00
2023-10-26 14:16:08 +08:00
| 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 |
2023-09-07 17:38:09 +08:00
``` bash
$ export CLUSTER_USERNAME = ubuntu
$ export CLUSTER_PASSWORD = 123456
2023-09-28 18:00:41 +08:00
$ sudo sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:v3.24.1 \
2023-09-07 17:38:09 +08:00
--masters 10.0.0.9 \
--nodes 10.0.0.4,10.0.0.10 \
-u " $CLUSTER_USERNAME " \
-p " $CLUSTER_PASSWORD "
```
2023-10-26 14:16:08 +08:00
> **Node** Uninstallation method: using `kubeadm` for uninstallation does not remove `etcd` and `cni` related configurations. Manual clearance or using `sealos` for uninstallation is needed.
>
2023-10-21 15:23:33 +08:00
> ```bash
2023-10-26 14:16:08 +08:00
> $ sealos reset
2023-10-21 15:23:33 +08:00
> ```
2023-10-26 14:16:08 +08:00
### Installing helm
2023-09-07 17:38:09 +08:00
2023-10-26 14:16:08 +08:00
Helm simplifies the deployment and management of Kubernetes applications to a large extent by offering version control and release management through packaging.
2023-09-07 17:38:09 +08:00
2023-10-26 14:16:08 +08:00
**Using Script: **
2023-09-07 17:38:09 +08:00
``` bash
$ curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
```
2023-10-26 14:16:08 +08:00
**Adding Repository: **
2023-09-07 17:38:09 +08:00
``` bash
$ helm repo add brigade https://openimsdk.github.io/openim-charts
```
2023-10-26 14:16:08 +08:00
### OpenIM Image Strategy
2023-09-07 17:38:09 +08:00
2023-10-26 14:16:08 +08:00
Automated offerings include aliyun, ghcr, docker hub: [Image Documentation ](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md )
2023-07-04 20:22:26 +08:00
2023-10-26 14:16:08 +08:00
**Local Test Build Method: **
2023-10-21 15:23:33 +08:00
``` bash
$ make image
```
2023-07-04 20:22:26 +08:00
2023-10-26 14:16:08 +08:00
> 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).
2023-07-04 20:22:26 +08:00
2023-10-26 14:16:08 +08:00
## Installation
2023-07-04 20:22:26 +08:00
2023-10-26 14:16:08 +08:00
Explore our Helm-Charts repository and read through: [Helm-Charts Repository ](https://github.com/openimsdk/helm-charts )