feat: add openim kubernetes deployment

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong(cubxxw) 2023-10-27 03:42:55 +08:00
parent a1547af65d
commit b3a7fcdbed
17 changed files with 364 additions and 74 deletions

1
.gitignore vendored
View File

@ -29,6 +29,7 @@ tmp/
bin/
output/
_output/
deployments/charts/generated-configs/
### OpenIM Config ###
config/config.yaml

View File

@ -81,6 +81,13 @@ $ sudo sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:
> $ sealos reset
> ```
If you are local, you can also use Kind and Minikube to test, for example, using Kind:
```bash
$ sGO111MODULE="on" go get sigs.k8s.io/kind@v0.11.1
$ skind create cluster
```
### Installing helm
Helm simplifies the deployment and management of Kubernetes applications to a large extent by offering version control and release management through packaging.
@ -112,3 +119,10 @@ $ make image
## Installation
Explore our Helm-Charts repository and read through: [Helm-Charts Repository](https://github.com/openimsdk/helm-charts)
```bash
../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
```

View File

@ -1,74 +0,0 @@
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v2
name: openim-api
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/openim-sdk-core"
- "https://github.com/openimsdk/openim-docker"
dependencies:
- name: mysql
version: 8.0.25
repository: https://charts.bitnami.com/bitnami
- name: redis
version: 14.6.1
repository: https://charts.bitnami.com/bitnami
- name: mongodb
version: 10.1.0
repository: https://charts.bitnami.com/bitnami
- name: kafka
version: 14.1.0
repository: https://charts.bitnami.com/bitnami
- name: minio
version: 8.1.2
repository: https://charts.bitnami.com/bitnami
- name: zookeeper
version: 5.17.0
repository: https://charts.bitnami.com/bitnami

View File

@ -0,0 +1,92 @@
repositories:
- name: stable
url: https://charts.helm.sh/stable
releases:
- name: openim-api
namespace: default
chart: ./openim-api
values:
- openim-api/values.yaml
- generated-configs/helm-image.yaml
- generated-configs/config.yaml
- generated-configs/notification.yaml
- name: openim-msggateway
namespace: default
chart: ./openim-msggateway
values:
- openim-msggateway/values.yaml
- generated-configs/helm-image.yaml
- generated-configs/config.yaml
- generated-configs/notification.yaml
- name: openim-msgtransfer
namespace: default
chart: ./openim-msgtransfer
values:
- openim-msgtransfer/values.yaml
- generated-configs/helm-image.yaml
- generated-configs/config.yaml
- generated-configs/notification.yaml
- name: openim-push
namespace: default
chart: ./openim-push
values:
- openim-push/values.yaml
- generated-configs/helm-image.yaml
- generated-configs/config.yaml
- generated-configs/notification.yaml
- name: openim-rpc-auth
namespace: default
chart: ./openim-rpc-auth
values:
- openim-rpc-auth/values.yaml
- generated-configs/helm-image.yaml
- generated-configs/config.yaml
- generated-configs/notification.yaml
- name: openim-rpc-conversation
namespace: default
chart: ./openim-rpc-conversation
values:
- openim-rpc-conversation/values.yaml
- generated-configs/helm-image.yaml
- generated-configs/config.yaml
- generated-configs/notification.yaml
- name: openim-rpc-friend
namespace: default
chart: ./openim-rpc-friend
values:
- openim-rpc-friend/values.yaml
- generated-configs/helm-image.yaml
- generated-configs/config.yaml
- generated-configs/notification.yaml
- name: openim-rpc-group
namespace: default
chart: ./openim-rpc-group
values:
- openim-rpc-group/values.yaml
- generated-configs/helm-image.yaml
- generated-configs/config.yaml
- generated-configs/notification.yaml
- name: openim-rpc-msg
namespace: default
chart: ./openim-rpc-msg
values:
- openim-rpc-msg/values.yaml
- generated-configs/helm-image.yaml
- generated-configs/config.yaml
- generated-configs/notification.yaml
- name: openim-rpc-third
namespace: default
chart: ./openim-rpc-third
values:
- openim-rpc-third/values.yaml
- generated-configs/helm-image.yaml
- generated-configs/config.yaml
- generated-configs/notification.yaml
- name: openim-rpc-user
namespace: default
chart: ./openim-rpc-user
values:
- openim-rpc-user/values.yaml
- generated-configs/helm-image.yaml

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -22,3 +22,18 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
maintainers:
- name: "OpenIM"
url: "https://github.com/openimsdk"
keywords:
- openim
- im
- chat
sources:
- "https://github.com/openimsdk/open-im-server"
- "https://github.com/openimsdk/helm-charts"

View File

@ -0,0 +1,89 @@
#This configuration file is used to override the use of the value.yaml variable.
#Currently, only the configuration with ingressName as nginx is provided.
#If it is another gateway such as istio or treafik, please modify the corresponding gateway requirements
image:
repository: ${IMAGE_REGISTRY}/openim-api
pullPolicy: Always
tag: "${SERVER_IMAGE_TAG}"
ingress:
enabled: true
className: "nginx"
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
hosts:
- host: openim.server.com # your hostname
paths:
- path: /api(/|$)(.*)
pathType: ImplementationSpecific
tls:
- secretName: webapitls #your hostname tls
hosts:
- openim.server.com
openim-msggateway:
image:
repository: ${IMAGE_REGISTRY}/openim-msggateway
tag: "${SERVER_IMAGE_TAG}"
pullPolicy: Always
ingress:
enabled: true
className: "nginx"
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
hosts:
- host: openim.server.com # your hostname
paths:
- path: /msg_gateway(/|$)(.*)
pathType: ImplementationSpecific
tls:
- secretName: webapitls #your hostname tls
hosts:
- openim.server.com
openim-msgtransfer:
image:
repository: ${IMAGE_REGISTRY}/openim-msgtransfer
tag: "${SERVER_IMAGE_TAG}"
pullPolicy: Always
openim-push:
image:
repository: ${IMAGE_REGISTRY}/openim-push
tag: "${SERVER_IMAGE_TAG}"
pullPolicy: Always
openim-rpc-auth:
image:
repository: ${IMAGE_REGISTRY}/openim-rpc-auth
tag: "${SERVER_IMAGE_TAG}"
pullPolicy: Always
openim-rpc-conversation:
image:
repository: ${IMAGE_REGISTRY}/openim-rpc-conversation
tag: "${SERVER_IMAGE_TAG}"
pullPolicy: Always
openim-rpc-friend:
image:
repository: ${IMAGE_REGISTRY}/openim-rpc-friend
tag: "${SERVER_IMAGE_TAG}"
pullPolicy: Always
openim-rpc-group:
image:
repository: ${IMAGE_REGISTRY}/openim-rpc-group
tag: "${SERVER_IMAGE_TAG}"
pullPolicy: Always
openim-rpc-msg:
image:
repository: ${IMAGE_REGISTRY}/openim-rpc-msg
tag: "${SERVER_IMAGE_TAG}"
pullPolicy: Always
openim-rpc-third:
image:
repository: ${IMAGE_REGISTRY}/openim-rpc-third
tag: "${SERVER_IMAGE_TAG}"
pullPolicy: Always
openim-rpc-user:
image:
repository: ${IMAGE_REGISTRY}/openim-rpc-user
tag: "${SERVER_IMAGE_TAG}"
pullPolicy: Always

View File

@ -78,6 +78,9 @@ def "IMAGE_REGISTRY" "ghcr.io/openimsdk"
# def "IMAGE_REGISTRY" "openim"
# def "IMAGE_REGISTRY" "registry.cn-hangzhou.aliyuncs.com/openimsdk"
# Choose the appropriate image tag, the default is the latest version
def "SERVER_IMAGE_TAG" "latest"
###################### OpenIM Docker Network ######################
# 设置 Docker 网络的网段
readonly DOCKER_BRIDGE_SUBNET=${DOCKER_BRIDGE_SUBNET:-'172.28.0.0/16'}