Skip to content

Commit

Permalink
docs: update deployment docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et committed Dec 18, 2024
1 parent 01eec5c commit e19f7ca
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions deployments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,70 @@

## Preconditions

- Successfully deployed OpenIM Server and its dependencies(mongo, kafka, redis, minio).
- Ensure deployed OpenIM Server and its dependencies.
- Redis
- MongoDB
- Kafka
- MinIO
- Expose the corresponding Services and ports of OpenIM Server.

## Deploy OpenIM Chat

Chat depends on OpenIM Server, so you need to deploy OpenIM Server first.
**Chat depends on OpenIM Server, so you need to deploy OpenIM Server first.**

enter the target directory

```shell
cd deployments/deploy
```

### Modify ConfigMap

You need to modify the `chat-config.yml` file to match your environment. Focus on the following fields:
**discovery.yml**

- `kubernetes.namespace`: default is `default`, you can change it to your namespace.
- `enable`: set to `kubernetes`
- `rpcService`: Every field value need to same to the corresponding service name. Such as `chat` value in same to `openim-chat-rpc-service.yml` service name.

**log.yml**

- `storageLocation`: log save path in container.
- `isStdout`: output in kubectl log.
- `isJson`: log format to JSON.

**mongodb.yml**

- `address`: set to your already mongodb address or mongo Service name and port in your deployed.
- `username`: set to your mongodb username.
- `database`: set to your mongodb database name.
- `password`: **need to set to secret use base64 encode.**
- `authSource`: set to your mongodb authSource, default is `openim_v3`.
- `authSource`: et to your mongodb authSource. (authSource is specify the database name associated with the user's credentials, user need create in this database.)

**redis.yml**

- `address`: set to your already redis address or redis Service name and port in your deployed.
- `password`: **need to set to secret use base64 encode.**

**share.yml**

- `openIM.apiURL`: modify to your already API address or use your `openim-api` service name and port
- `openIM.adminUserID`: same to IM Server `imAdminUserID` field value.
- `chatAdmin`: default is `chatAdmin`.

### Set the secret

A Secret is an object that contains a small amount of sensitive data. Such as password and secret. Secret is similar to ConfigMaps.

#### Example:

create a secret for redis password. You can create new file is `redis-secret.yml` or append contents to `chat-config.yml` use `---` split it.
create a secret for redis password. You can update `redis-secret.yml`.

you need update `redis-password` value to your redis password in base64.

```yaml
apiVersion: v1
kind: Secret
metadata:
name: redis-secret
name: openim-redis-secret
type: Opaque
data:
redis-password: b3BlbklNMTIz # "openIM123" in base64
redis-password: b3BlbklNMTIz # you need update to your redis password in base64
```
#### Usage:
use secret in deployment file. If you apply the secret to IM Server, you need adapt the Env Name to config file and all toupper.
OpenIM Server use prefix `IMENV_`, OpenIM Chat use prefix `CHATENV_`. Next adapt is the config file name. Like `redis.yml`. Such as `CHATENV_REDIS_PASSWORD` is mapped to `redis.yml` password filed in OpenIM Server.
OpenIM Chat use prefix `CHATENV_`. Next adapt is the config file name. Like `redis.yml`. Such as `CHATENV_REDIS_PASSWORD` is mapped to `redis.yml` password filed in OpenIM Server.

```yaml
apiVersion: apps/v1
Expand All @@ -78,28 +78,27 @@ spec:
containers:
- name: chat-rpc-server
env:
- name: CHATENV_REDIS_PASSWORD # adapt to redis.yml password field
- name: CHATENV_REDIS_PASSWORD # adapt to redis.yml password field in OpenIM Server config, Don't modify it.
valueFrom:
secretKeyRef:
name: redis-secret
key: redis-password
name: openim-redis-secret # You deployed secret name
key: redis-password # You deployed secret key name
```

So, you need following configurations to set secret:

- `MONGODB_USERNAME`
- `MONGODB_PASSWORD`
- `REDIS_PASSWORD`
- `SHARE_OPENIM_SECRET`

### Apply Config and Services

enter the target directory
Apply the secret.

```shell
cd deployments/deploy
kubectl apply -f redis-secret.yml -f mongo-secret.yml
```

### Apply Config and Services

deploy the config and services

```shell
Expand Down

0 comments on commit e19f7ca

Please sign in to comment.