diff --git a/.github/workflows/scripts-test.yml b/.github/workflows/scripts-test.yml index 55381fc94..ad0695854 100644 --- a/.github/workflows/scripts-test.yml +++ b/.github/workflows/scripts-test.yml @@ -49,24 +49,14 @@ jobs: - name: deploy all services run: | - git clone -b release-v3.3 https://github.com/OpenIMSDK/Open-IM-Server.git openim && export openim=$(pwd)/openim && cd $openim - curl -o docker-compose.yaml https://gist.githubusercontent.com/cubxxw/b1d5cbd2edfa23fee911118aa3e8249e/raw/openim-chat.sh + git clone https://github.com/openimsdk/open-im-server.git + cd open-im-server + sudo make init sudo docker compose up -d sudo sleep 30 - sudo chmod +x ./scripts/stop_all.sh - sudo ./scripts/stop_all.sh - sudo cat logs/openIM.log 2>/dev/null - sudo chmod +x ./scripts/build_all_service.sh - sudo ./scripts/build_all_service.sh - - sudo cat logs/openIM.log 2>/dev/null - sudo chmod +x ./scripts/start_all.sh - sudo ./scripts/start_all.sh - - sudo cat logs/openIM.log 2>/dev/null - sudo chmod +x ./scripts/check_all.sh - sudo ./scripts/check_all.sh + sudo make start + sudo make check sudo cat logs/openIM.log 2>/dev/null echo "pwd = $(pwd)" @@ -75,16 +65,35 @@ jobs: shell: bash continue-on-error: true + - name: start mysql + run: | + docker run -d \ + --name mysql4 \ + -p 13306:3306 \ + -p 3306:33060 \ + -v "$(pwd)/components/mysql/data:/var/lib/mysql" \ + -v "/etc/localtime:/etc/localtime" \ + -e MYSQL_ROOT_PASSWORD="openIM123" \ + --restart always \ + mysql:5.7 - name: start all services run: | - sudo ./scripts/start_all.sh + sudo cp ./config/config.yaml.template ./config/config.yaml + sudo make start shell: bash - name: Check all services run: | - sudo sleep 15; ports=(10008 10009 30200 30300); for port in "${ports[@]}"; do if ! lsof -i :$port > /dev/null; then echo "The service is not started on port $port."; exit 1; else echo "The service is started normally on port $port."; fi; done; echo "All port services have been started normally." + sudo make check shell: bash - continue-on-error: true + + - name: Stop chat + run: | + sudo make stop + + - name: Reinstall chat + run: | + sudo make install - name: Print openIM.log run: | diff --git a/Dockerfile b/Dockerfile index 4d93e0004..325e5c691 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,6 +40,8 @@ FROM ghcr.io/openim-sigs/openim-ubuntu-image:latest WORKDIR ${CHAT_WORKDIR} -COPY --from=builder $OPENIM_CHAT_BINDIR/platforms /openim/openim-chat/_output/bin/platforms +COPY --from=builder ${OPENIM_CHAT_BINDIR} /openim/openim-chat/_output/bin +COPY --from=builder ${CHAT_WORKDIR}/config /openim/openim-chat/config +COPY --from=builder ${CHAT_WORKDIR}/scripts /openim/openim-chat/scripts CMD ["/openim/openim-chat/scripts/docker_start_all.sh"] \ No newline at end of file diff --git a/Makefile b/Makefile index a4924343a..546c859c2 100644 --- a/Makefile +++ b/Makefile @@ -306,6 +306,10 @@ stop: .PHONY: restart restart: clean stop build start check +## install: install openim chat +.PHONY: install +install: restart + ## image.build.%: Build docker image for a specific platform .PHONY: image.build.% image.build.%: go.build.% diff --git a/README.md b/README.md index 24199dd97..cd49d794a 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,22 @@ -You may be licensed to use source code to create compiled versions not produced by OpenIM in one of two ways: -1. Under the Free Software Foundation’s GPL v.3.0, subject to the exceptions outlined in this policy; or -2. Under a commercial license available from OpenIM by contacting contact@openim.io +# openim-chat -# chat +## 📄 License Options for OpenIM Source Code -### Modifying configuration items +You may use the OpenIM source code to create compiled versions not originally produced by OpenIM under one of the following two licensing options: -Refer to `config/config.yaml` for configuration instructions +### 1. GNU General Public License v3.0 (GPLv3) 🆓 + ++ This option is governed by the Free Software Foundation's [GPL v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html). ++ Usage is subject to certain exceptions as outlined in this policy. + +### 2. Commercial License 💼 + ++ Obtain a commercial license by contacting OpenIM. ++ For more details and licensing inquiries, please email 📧 [contact@openim.io](mailto:contact@openim.io). ## 🧩 Awesome features 1. This repository implement a business system, which consists of two parts: User related function and background management function -2. The business system depends on the api of the im system ([Open-IM-Server repository](https://github.com/OpenIMSDK/Open-IM-Server)) and implement various functions by calling the api of the im system +2. The business system depends on the api of the im system ([open-im-server repository](https://github.com/openimsdk/open-im-server)) and implement various functions by calling the api of the im system 3. User related part includes some regular functions like user login, user register, user info update, etc. 4. Background management provides api for admin to manage the im system containing functions like user management, message mangement,group management,etc. @@ -21,19 +27,54 @@ Refer to `config/config.yaml` for configuration instructions ### 📦 Installation ```bash -git clone https://github.com/OpenIMSDK/chat openim-chat && export openim-chat=$(pwd)/openim-chat && cd $openim-chat && make +git clone https://github.com/openimsdk/chat openim-chat && export openim-chat=$(pwd)/openim-chat && cd $openim-chat && make ``` ### Developing chat -If you wish to deploy chat, then you should first install and deploy OpenIM, this [Open-IM-Server repository](https://github.com/OpenIMSDK/Open-IM-Server) +You can deploy OpenIM Chat in two ways, either from source (which requires openIM-server to be installed) or with [docker compose](https://github.com/openimsdk/openim-docker) + +**Here's how to deploy from source code:** + +If you wish to deploy chat, then you should first install and deploy OpenIM, this [open-im-server repository](https://github.com/openimsdk/open-im-server) + +First, install openim-server in a new directory or location repository ```bash -git clone -b release-v3.1 https://github.com/OpenIMSDK/Open-IM-Server.git openim && export openim=$(pwd)/openim && cd $openim +git clone -b release-v3.1 https://github.com/openimsdk/open-im-server.git openim && export openim=$(pwd)/openim && cd $openim sudo docker compose up -d ``` -Installing Chat +**Setting configuration items:** + +```bash +cp ./config/config.yaml.template ./config/config.yaml +``` + +> Then modify the configuration file `config/config.yaml` according to your needs +> Note: If you want to use the mysql database, you need to modify the mysql configuration item in the configuration file. If you want to use the mongo database, you need to modify the mongo configuration item in the configuration file + + +Then go back to the chat directory, Installing Chat + +**Start Mysql:** + +> The newer versions of OpenIM remove the Mysql component, which requires an additional Mysql installation if you want to deploy chat + +```bash +docker run -d \ + --name mysql4 \ + -p 13306:3306 \ + -p 3306:33060 \ + -v "$(pwd)/components/mysql/data:/var/lib/mysql" \ + -v "/etc/localtime:/etc/localtime" \ + -e MYSQL_ROOT_PASSWORD="openIM123" \ + --restart always \ + mysql:5.7 +``` + +**Install Chat:** + ```bash $ make install ``` @@ -130,14 +171,14 @@ Contributions to this project are welcome! Please see [CONTRIBUTING.md](./CONTRI ## Community Meetings We want anyone to get involved in our community, we offer gifts and rewards, and we welcome you to join us every Thursday night. -We take notes of each [biweekly meeting](https://github.com/OpenIMSDK/Open-IM-Server/issues/381) in [GitHub discussions](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting), and our minutes are written in [Google Docs](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing). +We take notes of each [biweekly meeting](https://github.com/openimsdk/open-im-server/issues/381) in [GitHub discussions](https://github.com/openimsdk/open-im-server/discussions/categories/meeting), and our minutes are written in [Google Docs](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing). -## Who are using Open-IM-Server -The [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page includes the user list of the project. You can leave a [📝comment](https://github.com/OpenIMSDK/Open-IM-Server/issues/379) to let us know your use case. +## Who are using open-im-server +The [user case studies](https://github.com/openimsdk/community/blob/main/ADOPTERS.md) page includes the user list of the project. You can leave a [📝comment](https://github.com/openimsdk/open-im-server/issues/379) to let us know your use case. -![avatar](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) +![avatar](https://github.com/openimsdk/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) ## 🚨 License -chat is licensed under the Apache 2.0 license. See [LICENSE](https://github.com/OpenIMSDK/chat/tree/main/LICENSE) for the full license text. +chat is licensed under the Apache 2.0 license. See [LICENSE](https://github.com/openimsdk/chat/tree/main/LICENSE) for the full license text. diff --git a/config/config.yaml b/config/config.yaml.template similarity index 81% rename from config/config.yaml rename to config/config.yaml.template index 6ae122a1d..dcd16c0dc 100644 --- a/config/config.yaml +++ b/config/config.yaml.template @@ -44,16 +44,15 @@ rpcRegisterName: # 没有配置表示和OpenIM一致 mysql: - # address: [ 127.0.0.1:13306 ] #目前仅支持单机 - # username: root #用户名 - # password: openIM123 #密码 - # database: openIM_v2 #不建议修改 - # maxOpenConn: 1000 #最大连接数 - # maxIdleConn: 100 #最大空闲连接数 - # maxLifeTime: 60 #连接可以重复使用的最长时间(秒) - # logLevel: 4 #日志级别 1=slient 2=error 3=warn 4=info - # slowThreshold: 500 #慢语句阈值 (毫秒) - # database: openim_enterprise + address: [ 127.0.0.1:13306 ] #目前仅支持单机 + username: root #用户名 + password: openIM123 #密码 + database: openIM_v3 #不建议修改 + maxOpenConn: 1000 #最大连接数 + maxIdleConn: 100 #最大空闲连接数 + maxLifeTime: 60 #连接可以重复使用的最长时间(秒) + logLevel: 4 #日志级别 1=slient 2=error 3=warn 4=info + slowThreshold: 500 #慢语句阈值 (毫秒) # 没有配置表示和OpenIM一致 log: