Skip to content

Commit

Permalink
🎯 Optimize the deployment scheme to provide kubernetes deployment str…
Browse files Browse the repository at this point in the history
…ategy (#1050)

* fix: fix openim web port

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* fix: fix openim web port

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* fix: github gh images

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* fix: github gh images

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: go mod package

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

---------

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>
  • Loading branch information
cubxxw authored Sep 9, 2023
1 parent 72e5c4a commit 2628874
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ 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://172.28.0.1:10002
API_URL=http://127.0.0.1:10002

# Directory path for storing data files or related information.
# Default: DATA_DIR=./
Expand Down
73 changes: 10 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q"><img src="https://img.shields.io/badge/Slack-300%2B-blueviolet?logo=slack&amp;logoColor=white"></a>
<a href="https://github.com/openimsdk/open-im-server/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green"></a>
<a href="https://golang.org/"><img src="https://img.shields.io/badge/Language-Go-blue.svg"></a>
<a href="https://pkg.go.dev/github.com/openimsdk/open-im-server/v3"><img src="https://pkg.go.dev/badge/github.com/openimsdk/open-im-server/v3.svg" alt="Go Reference"></a>
</p>

</p>
Expand Down Expand Up @@ -81,7 +82,7 @@ Further enhancing your experience, we also provide an SDK client, wherein most c

5. **Open Source :open_hands:**

✅ The code of OpenIM is open source, self-controlled data, aimed at building a globally leading IM open source community, including client SDK and server
✅ The code of OpenIM is open source, self-controlled data, aimed at building a globally leading [IM open source community](https://github.com/OpenIMSDK), including [client SDK](https://github.com/openimsdk/openim-sdk-core) and server

✅ Based on open source Server, many excellent open source projects have been developed, such as [OpenKF](https://github.com/OpenIMSDK/OpenKF) (Open source AI customer service system)

Expand Down Expand Up @@ -111,72 +112,26 @@ Further enhancing your experience, we also provide an SDK client, wherein most c

## :rocket: Quick Start

You can quickly learn OpenIM engineering solutions, all it takes is one simple command:
You can quickly learn OpenIM engineering solutions, all it takes is one simple command:

```bash
$ make demo
```

🤲 In order to facilitate the user experience, we have provided a variety of deployment solutions, you can choose your own deployment method according to the list below:

<details> <summary>Deploying with Docker Compose</summary>
<details> <summary>Deploying with Docker Compose</summary>

It is recommended to use Docker Compose for deployment, which can easily and quickly deploy the entire OpenIM service on a single node

> docker compose will not be maintained in future versions, but it is still the easiest and most convenient way to organize docker compose deployments into a separate project https://github.com/openim-sigs/openim-docker to maintain.
+ [https://github.com/openimsdk/openim-docker](https://github.com/openimsdk/openim-docker)

**1. Clone the project**


```bash
git clone -b main https://github.com/openim-sigs/openim-docker openim/openim-docker && export openim=$(pwd)/openim && cd $openim/openim-docker && ./scripts/init-config.sh && docker-compose up -d
```

> **Note**
>
> If you don't know OpenIM's versioning policy, 📚Read our release policy: https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/version.md

**2. Configure the config file**

If you tried to get started quickly with `make demo`, then you know that our config file is generated by automation.

You can use `make init` to quickly initialize a configuration file

Modify the automation script:

```bash
cat scripts/install/environment.sh
```

1. Recommended using environment variables:

```bash
export PASSWORD="openIM123" # Set password
export USER="root" # Set username
# Choose chat version and server version https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md, eg: main, release-v*.*
export CHAT_BRANCH="main"
export SERVER_BRANCH="main"
#... Other environment variables
# MONGO_USERNAME: This sets the MongoDB username
# MONGO_PASSWORD: Set the MongoDB password
# MONGO_DATABASE: Sets the MongoDB database name
# MINIO_ENDPOINT: set the MinIO service address
# DOCKER_BRIDGE_SUBNET: set the docker bridge network address
export DOCKER_BRIDGE_SUBNET="172.28.0.0/16"
# API_URL: under network environment, set OpenIM Server API address
export API_URL="http://127.0.0.1:10002"
```

If you wish to use more custom features, read our [config documentation](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md).


Next, update the configuration using make init:

```bash
$ make init
$ git diff
```


</details>

<details> <summary>Compile from Source</summary>
Expand Down Expand Up @@ -211,16 +166,11 @@ Deploy basic components at the click of a command:
```bash
# install openim dependency
$ git clone https://github.com/openimsdk/open-im-server openim/openim-server && export openim=$(pwd)/openim/openim-server && cd $openim/openim-server && git checkout $OPENIM_VERSION
$ curl https://raw.githubusercontent.com/OpenIMSDK/openim-docker/main/example/basic-openim-server-dependency.yml -o basic-openim-server-dependency.yml && make init && docker compose -f basic-openim-server-dependency.yml up -d && make start
$ make init && docker compose -f basic-openim-server-dependency.yml up -d && make start && make check
```

> `make help` to help you see the instructions supported by OpenIM.
Use `make check` to check all component starts

```bash
$ make check
```

You can use the `make help-all` see OpenIM in action.

Expand All @@ -240,19 +190,16 @@ Read: https://github.com/openimsdk/open-im-server/blob/main/deployments/README.m

</details>

<details> <summary>Open IM Ports</summary>
<details> <summary>Open IM and Chat Ports</summary>

+ oepnim-server warehouse: https://github.com/openimsdk/open-im-server

| TCP Port | Description | Operation |
| --------- | ------------------------------------------------------------ | ----------------------------------------------------- |
| TCP:10001 | ws protocol, message port such as message sending, pushing etc, used for client SDK | Port release or nginx reverse proxy, and firewall off |
| TCP:10002 | api port, such as user, friend, group, message interfaces. | Port release or nginx reverse proxy, and firewall off |
| TCP:10005 | Required when choosing minio storage (openIM uses minio storage by default) | Port release or nginx reverse proxy, and firewall off |

</details>

<details> <summary>Open Chat Ports</summary>


+ chat warehouse: https://github.com/OpenIMSDK/chat

Expand Down
4 changes: 2 additions & 2 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ api:
# minio.signEndpoint is minio public network address
object:
enable: "minio"
apiURL: "http://172.28.0.1:10002"
apiURL: "http://http://127.0.0.1:10002"
minio:
bucket: "openim"
endpoint: "http://172.28.0.1:10005"
accessKeyID: "root"
secretAccessKey: "openIM123"
sessionToken: ''
signEndpoint: "http://172.28.0.1:10005"
signEndpoint: "http://127.0.0.1:10005"
cos:
bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
secretID: ''
Expand Down
23 changes: 21 additions & 2 deletions scripts/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

if ! command -v pv &> /dev/null
then
echo "pv not found, installing..."
if [ -e /etc/debian_version ]; then
sudo apt-get update
sudo apt-get install -y pv
elif [ -e /etc/redhat-release ]; then
sudo yum install -y pv
else
echo "Unsupported OS, please install pv manually."
exit 1
fi
fi

readonly t_reset=$(tput sgr0)
readonly green=$(tput bold; tput setaf 2)
readonly yellow=$(tput bold; tput setaf 3)
Expand Down Expand Up @@ -58,8 +72,11 @@ clear

openim::util::desc "========> Start the basic openim docker components"
openim::util::desc "========> You can use docker-compose ps to check the status of the container"
openim::util::run "curl https://raw.githubusercontent.com/OpenIMSDK/openim-docker/main/example/basic-openim-server-dependency.yml -o basic-openim-server-dependency.yml"
openim::util::run "docker compose up --f basic-openim-server-dependency.yml up -d"
openim::util::run "docker compose up -d"
clear

openim::util::desc "========> Use make init-githooks Initialize git hooks "
openim::util::run "make init-githooks"
clear

openim::util::desc "The specification is pretty high, you need to be bound on your branch name, as well as commit messages"
Expand Down Expand Up @@ -133,3 +150,5 @@ clear
openim::util::desc "Add copyright"
openim::util::run "make add-copyright"
clear

exit 0

0 comments on commit 2628874

Please sign in to comment.