You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
176 lines
5.8 KiB
176 lines
5.8 KiB
10 months ago
|
# OpenIM Application Containerization Deployment Guide
|
||
1 year ago
|
|
||
10 months ago
|
OpenIM supports a variety of cluster deployment methods, including but not limited to `helm`, `sealos`, `kustomize`
|
||
1 year ago
|
|
||
10 months ago
|
Various contributors, as well as previous official releases, have provided some referenceable solutions:
|
||
1 year ago
|
|
||
10 months ago
|
+ [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)
|
||
1 year ago
|
|
||
10 months ago
|
### Dependency Check
|
||
1 year ago
|
|
||
|
```bash
|
||
|
Kubernetes: >= 1.16.0-0
|
||
|
Helm: >= 3.0
|
||
|
```
|
||
|
|
||
10 months ago
|
### Minimum Configuration
|
||
1 year ago
|
|
||
10 months ago
|
The recommended minimum configuration for a production environment is as follows:
|
||
1 year ago
|
|
||
10 months ago
|
```yaml
|
||
12 months ago
|
CPU: 4
|
||
|
Memory: 8G
|
||
|
Disk: 100G
|
||
|
```
|
||
|
|
||
10 months ago
|
## Configuration File Generation
|
||
1 year ago
|
|
||
10 months ago
|
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:
|
||
12 months ago
|
|
||
|
```bash
|
||
|
$ make init
|
||
10 months ago
|
# Alternatively, use script:
|
||
12 months ago
|
# ./scripts/init-config.sh
|
||
|
```
|
||
1 year ago
|
|
||
10 months ago
|
At this point, configuration files will be generated under `deployments/openim/config`, which you can modify as per your requirements.
|
||
12 months ago
|
|
||
10 months ago
|
## Cluster Setup
|
||
12 months ago
|
|
||
10 months ago
|
If you already have a `kubernetes` cluster, or if you wish to build a `kubernetes` cluster from scratch, you can skip this step.
|
||
12 months ago
|
|
||
10 months ago
|
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:
|
||
12 months ago
|
|
||
|
```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
|
||
|
```
|
||
|
|
||
10 months ago
|
**Supported Versions:**
|
||
12 months ago
|
|
||
|
+ docker: `labring/kubernetes-docker`:(v1.24.0~v1.27.0)
|
||
|
+ containerd: `labring/kubernetes`:(v1.24.0~v1.27.0)
|
||
|
|
||
10 months ago
|
#### Cluster Installation:
|
||
12 months ago
|
|
||
10 months ago
|
Cluster details are as follows:
|
||
12 months ago
|
|
||
10 months ago
|
| 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 |
|
||
12 months ago
|
|
||
|
```bash
|
||
|
$ export CLUSTER_USERNAME=ubuntu
|
||
|
$ export CLUSTER_PASSWORD=123456
|
||
11 months ago
|
$ sudo sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:v3.24.1 \
|
||
12 months ago
|
--masters 10.0.0.9 \
|
||
|
--nodes 10.0.0.4,10.0.0.10 \
|
||
|
-u "$CLUSTER_USERNAME" \
|
||
|
-p "$CLUSTER_PASSWORD"
|
||
|
```
|
||
|
|
||
10 months ago
|
> **Node** Uninstallation method: using `kubeadm` for uninstallation does not remove `etcd` and `cni` related configurations. Manual clearance or using `sealos` for uninstallation is needed.
|
||
|
>
|
||
10 months ago
|
> ```bash
|
||
10 months ago
|
> $ sealos reset
|
||
10 months ago
|
> ```
|
||
|
|
||
10 months ago
|
If you are local, you can also use Kind and Minikube to test, for example, using Kind:
|
||
12 months ago
|
|
||
10 months ago
|
```bash
|
||
9 months ago
|
$ GO111MODULE="on" go get sigs.k8s.io/kind@v0.11.1
|
||
|
$ kind create cluster
|
||
10 months ago
|
```
|
||
|
|
||
|
### Installing helm
|
||
12 months ago
|
|
||
10 months ago
|
Helm simplifies the deployment and management of Kubernetes applications to a large extent by offering version control and release management through packaging.
|
||
12 months ago
|
|
||
10 months ago
|
**Using Script:**
|
||
12 months ago
|
|
||
|
```bash
|
||
|
$ curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||
|
```
|
||
|
|
||
10 months ago
|
**Adding Repository:**
|
||
12 months ago
|
|
||
|
```bash
|
||
|
$ helm repo add brigade https://openimsdk.github.io/openim-charts
|
||
|
```
|
||
|
|
||
10 months ago
|
### OpenIM Image Strategy
|
||
12 months ago
|
|
||
10 months ago
|
Automated offerings include aliyun, ghcr, docker hub: [Image Documentation](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md)
|
||
1 year ago
|
|
||
10 months ago
|
**Local Test Build Method:**
|
||
10 months ago
|
|
||
|
```bash
|
||
|
$ make image
|
||
|
```
|
||
1 year ago
|
|
||
10 months ago
|
> 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)
|
||
1 year ago
|
|
||
|
|
||
10 months ago
|
Using the helm charts repository, you can ignore the following configuration, but if you want to just use the server and scale on top of it, you can go ahead:
|
||
|
|
||
10 months ago
|
**Use the Helm template to generate the deployment yaml file: `openim-charts.yaml`**
|
||
|
|
||
|
**Gen Image:**
|
||
|
|
||
|
```bash
|
||
|
../scripts/genconfig.sh ../scripts/install/environment.sh ./templates/helm-image.yaml > ./charts/generated-configs/helm-image.yaml
|
||
|
```
|
||
|
|
||
|
**Gen Charts:**
|
||
|
|
||
|
```bash
|
||
|
for chart in ./charts/*/; do
|
||
|
if [[ "$chart" == *"generated-configs"* || "$chart" == *"helmfile.yaml"* ]]; then
|
||
|
continue
|
||
|
fi
|
||
|
|
||
|
if [ -f "${chart}values.yaml" ]; then
|
||
|
helm template "$chart" -f "./charts/generated-configs/helm-image.yaml" -f "./charts/generated-configs/config.yaml" -f "./charts/generated-configs/notification.yaml" >> openim-charts.yaml
|
||
|
else
|
||
|
helm template "$chart" >> openim-charts.yaml
|
||
|
fi
|
||
|
done
|
||
|
```
|
||
|
|
||
10 months ago
|
**Use Helmfile:**
|
||
|
|
||
|
```bash
|
||
|
GO111MODULE=on go get github.com/roboll/helmfile@latest
|
||
|
```
|
||
|
|
||
|
```bash
|
||
|
export MONGO_ADDRESS=im-mongo
|
||
|
export MONGO_PORT=27017
|
||
|
export REDIS_ADDRESS=im-redis-master
|
||
|
export REDIS_PORT=6379
|
||
|
export KAFKA_ADDRESS=im-kafka
|
||
|
export KAFKA_PORT=9092
|
||
|
export OBJECT_APIURL="https://openim.server.com/api"
|
||
|
export MINIO_ENDPOINT="http://im-minio:9000"
|
||
|
export MINIO_SIGN_ENDPOINT="https://openim.server.com/im-minio-api"
|
||
|
|
||
|
mkdir ./charts/generated-configs
|
||
|
../scripts/genconfig.sh ../scripts/install/environment.sh ./templates/openim.yaml > ./charts/generated-configs/config.yaml
|
||
|
cp ../config/notification.yaml ./charts/generated-configs/notification.yaml
|
||
|
../scripts/genconfig.sh ../scripts/install/environment.sh ./templates/helm-image.yaml > ./charts/generated-configs/helm-image.yaml
|
||
|
```
|
||
|
|
||
|
```bash
|
||
|
helmfile apply
|
||
9 months ago
|
```
|