mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 22:39:18 +08:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cffefbd242 | |||
| cc5fa648de | |||
| 263ab752dd | |||
| cf0ef7652a | |||
| 709d772233 | |||
| c9df323da4 | |||
| 22df23cf8b | |||
| 0031aeca02 | |||
| 67e6e789ec | |||
| 9fdb85d354 | |||
| 8b2bfba89b | |||
| 2934535c18 | |||
| 9b9bfae857 | |||
| 32edd4b17c | |||
| d5651ae1d8 | |||
| 8aad2cf300 | |||
| 4bf4eb5464 | |||
| e66e490ae6 | |||
| 1d6d163da0 | |||
| 8e1bb9abb9 | |||
| d26e2594f2 | |||
| 5893181226 | |||
| e2b581f2cc | |||
| 2531091742 | |||
| 9d42a2abc2 | |||
| 0ff8402c83 | |||
| 76484e09ac | |||
| 8c2e7c1fdc | |||
| d62fedcabb | |||
| 4d89bba8c0 | |||
| 8da0c53523 | |||
| 96e09a1b37 | |||
| 786090f742 |
@@ -2,6 +2,7 @@
|
||||
|
||||
# Ignore specific files
|
||||
.dockerignore
|
||||
.git
|
||||
|
||||
# Ignore build artifacts
|
||||
_output/
|
||||
|
||||
@@ -1,19 +1,64 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
# The following is automatically generated
|
||||
# Use `make init` OR `./scripts/init-config.sh`
|
||||
#
|
||||
# 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.
|
||||
|
||||
USER=root
|
||||
PASSWORD=openIM123
|
||||
# ================= Basic Configuration ===================
|
||||
# Endpoint for the MinIO object storage service
|
||||
MINIO_ENDPOINT=http://127.0.0.1:10005
|
||||
|
||||
# Base URL for the application programming interface (API)
|
||||
API_URL=http://127.0.0.1:10002
|
||||
|
||||
# Directory path for storing data files or related information
|
||||
DATA_DIR=./
|
||||
|
||||
# ============ Component Extension Configuration ==========
|
||||
# Address or hostname for the ZooKeeper service (often used in distributed systems for maintaining configuration information)
|
||||
ZOOKEEPER_ADDRESS=127.0.0.1
|
||||
|
||||
# Port on which MySQL database service is running
|
||||
MYSQL_PORT=13306
|
||||
|
||||
# Password to authenticate with the MySQL database service
|
||||
MYSQL_PASSWORD=openIM123
|
||||
|
||||
# Port on which MongoDB service is running
|
||||
MONGO_PORT=37017
|
||||
|
||||
# Username to authenticate with the MongoDB service
|
||||
MONGO_USERNAME=root
|
||||
|
||||
# Password to authenticate with the MongoDB service
|
||||
MONGO_PASSWORD=openIM123
|
||||
|
||||
# Name of the database in MongoDB to be used
|
||||
MONGO_DATABASE=openIM_v3
|
||||
|
||||
# Port on which Redis in-memory data structure store is running
|
||||
REDIS_PORT=16379
|
||||
|
||||
# Password to authenticate with the Redis service
|
||||
REDIS_PASSWORD=openIM123
|
||||
|
||||
# Port on which Kafka distributed streaming platform is running
|
||||
KAFKA_PORT=9092
|
||||
|
||||
# Address or hostname for the Kafka service
|
||||
KAFKA_ADDR=127.0.0.1
|
||||
|
||||
# Topic in Kafka for storing the latest messages in Redis
|
||||
KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
|
||||
|
||||
# Topic in Kafka for pushing messages (e.g. notifications or updates)
|
||||
KAFKA_MSG_PUSH_TOPIC=msgToPush
|
||||
|
||||
# Topic in Kafka for storing offline messages in MongoDB
|
||||
KAFKA_OFFLINEMSG_MONGO_TOPIC=offlineMsgToMongoMysql
|
||||
|
||||
# Port on which MinIO object storage service is running
|
||||
MINIO_PORT=10005
|
||||
|
||||
# Access key to authenticate with the MinIO service
|
||||
MINIO_ACCESS_KEY=root
|
||||
|
||||
# Secret key corresponding to the access key for MinIO authentication
|
||||
MINIO_SECRET_KEY=openIM123
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
# 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.
|
||||
|
||||
OpenIMSDK/openim-docker:
|
||||
- source: ./config
|
||||
dest: ./openim-server/release/config
|
||||
|
||||
@@ -34,11 +34,11 @@ jobs:
|
||||
body: |
|
||||
We value close connections with our users, developers, and contributors here at Open-IM-Server. With a large community and maintainer team, we're always here to help and support you. Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us.
|
||||
|
||||
Our most recommended way to get in touch is through [Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg). Even if you're in China, Slack is usually not blocked by firewalls, making it an easy way to connect with us. Our Slack community is the ideal place to discuss and share ideas and suggestions with other users and developers of Open-IM-Server. You can ask technical questions, seek help, or share your experiences with other users of Open-IM-Server.
|
||||
Our most recommended way to get in touch is through [Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q). Even if you're in China, Slack is usually not blocked by firewalls, making it an easy way to connect with us. Our Slack community is the ideal place to discuss and share ideas and suggestions with other users and developers of Open-IM-Server. You can ask technical questions, seek help, or share your experiences with other users of Open-IM-Server.
|
||||
|
||||
In addition to Slack, we also offer the following ways to get in touch:
|
||||
|
||||
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg" target="_blank"><img src="https://img.shields.io/badge/Slack-OpenIM%2B-blueviolet?logo=slack&logoColor=white"></a> We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) team channel.
|
||||
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" target="_blank"><img src="https://img.shields.io/badge/Slack-OpenIM%2B-blueviolet?logo=slack&logoColor=white"></a> We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel.
|
||||
+ <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a> Get in touch with us on [Gmail](https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email.
|
||||
+ <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a> Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information.
|
||||
+ <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a> Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible.
|
||||
|
||||
@@ -317,4 +317,69 @@ jobs:
|
||||
tags: ${{ steps.meta13.outputs.tags }}
|
||||
labels: ${{ steps.meta13.outputs.labels }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
|
||||
build-tools-ghcr:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-web
|
||||
id: meta1
|
||||
uses: docker/metadata-action@v4.6.0
|
||||
with:
|
||||
images: ghcr.io/openimsdk/openim-web
|
||||
|
||||
- name: Build and push Docker image for openim-web
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/images/openim-tools/openim-web/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta1.outputs.tags }}
|
||||
labels: ${{ steps.meta1.outputs.labels }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-web
|
||||
id: meta2
|
||||
uses: docker/metadata-action@v4.6.0
|
||||
with:
|
||||
images: ghcr.io/openimsdk/component
|
||||
|
||||
- name: Build and push Docker image for component
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/images/openim-tools/component/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta2.outputs.tags }}
|
||||
labels: ${{ steps.meta2.outputs.labels }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
@@ -36,12 +36,14 @@ jobs:
|
||||
|
||||
If you are implementing a feature request, please check with the maintainers that the feature will be accepted first.
|
||||
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) to connect and communicate with our developers.
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) to connect and communicate with our developers.
|
||||
|
||||
Please leave your information in the [✨ discussions](https://github.com/orgs/OpenIMSDK/discussions/426), we expect anyone to join OpenIM developer community.
|
||||
|
||||
issue-message: |
|
||||
Hello! Thank you for filing an issue.
|
||||
|
||||
If this is a bug report, please include relevant logs to help us debug the problem.
|
||||
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) to connect and communicate with our developers.
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) to connect and communicate with our developers.
|
||||
continue-on-error: true
|
||||
@@ -31,5 +31,5 @@ jobs:
|
||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
body: |
|
||||
This issue is available for anyone to work on. **Make sure to reference this issue in your pull request.** :sparkles: Thank you for your contribution! :sparkles:
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) to connect and communicate with our developers.
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) to connect and communicate with our developers.
|
||||
If you wish to accept this assignment, please leave a comment in the comments section: `/accept`.🎯
|
||||
|
||||
@@ -68,7 +68,9 @@ jobs:
|
||||
- name: verify format
|
||||
run: |
|
||||
sudo make format
|
||||
continue-on-error: true
|
||||
|
||||
- name: verify license
|
||||
run: |
|
||||
sudo make verify-copyright
|
||||
sudo make verify-copyright
|
||||
continue-on-error: true
|
||||
+4
-4
@@ -72,7 +72,7 @@ For any substantial design, there should be a well-crafted design document. This
|
||||
|
||||
Anybody can access the shared Drive for reading. To get access to comment. Once you've done that, head to the [shared Drive](https://drive.google.com/) and behold all the docs.
|
||||
|
||||
In addition to that, we'd love to invite you to [join our Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) where you can play with your imagination, tell us what you're working on, and get a quick response.
|
||||
In addition to that, we'd love to invite you to [join our Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) where you can play with your imagination, tell us what you're working on, and get a quick response.
|
||||
|
||||
When documenting a new design, we recommend a 2-step approach:
|
||||
|
||||
@@ -81,7 +81,7 @@ When documenting a new design, we recommend a 2-step approach:
|
||||
|
||||
In order to contribute a feature to Open-IM-Server you'll need to go through the following steps:
|
||||
|
||||
+ Discuss your idea with the appropriate [working groups](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) on the working group's Slack channel.
|
||||
+ Discuss your idea with the appropriate [working groups](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) on the working group's Slack channel.
|
||||
+ Once there is general agreement that the feature is useful, create a GitHub issue to track the discussion. The issue should include information about the requirements and use cases that it is trying to address.
|
||||
+ Include a discussion of the proposed design and technical details of the implementation in the issue.
|
||||
|
||||
@@ -364,11 +364,11 @@ Such a commit can get produced as follows:
|
||||
|
||||
We value close connections with our users, developers, and contributors here at Open-IM-Server. With a large community and maintainer team, we're always here to help and support you. Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us.
|
||||
|
||||
Our most recommended way to get in touch is through [Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg). Even if you're in China, Slack is usually not blocked by firewalls, making it an easy way to connect with us. Our Slack community is the ideal place to discuss and share ideas and suggestions with other users and developers of Open-IM-Server. You can ask technical questions, seek help, or share your experiences with other users of Open-IM-Server.
|
||||
Our most recommended way to get in touch is through [Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q). Even if you're in China, Slack is usually not blocked by firewalls, making it an easy way to connect with us. Our Slack community is the ideal place to discuss and share ideas and suggestions with other users and developers of Open-IM-Server. You can ask technical questions, seek help, or share your experiences with other users of Open-IM-Server.
|
||||
|
||||
In addition to Slack, we also offer the following ways to get in touch:
|
||||
|
||||
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg" target="_blank"><img src="https://img.shields.io/badge/slack-%40OpenIMSDKCore-informational?logo=slack&style=flat-square"></a>: We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) team channel.
|
||||
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" target="_blank"><img src="https://img.shields.io/badge/slack-%40OpenIMSDKCore-informational?logo=slack&style=flat-square"></a>: We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel.
|
||||
+ <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=4closetool3@gmail.com" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a>: Get in touch with us on [Gmail](winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email.
|
||||
+ <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a>: Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information.
|
||||
+ <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a>: Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible.
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ ENV GOPROXY=$GOPROXY
|
||||
# Set up the working directory
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY go.mod go.sum go.work ./
|
||||
#RUN go mod download
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files to the container
|
||||
ADD . .
|
||||
|
||||
@@ -58,6 +58,16 @@ export USAGE_OPTIONS
|
||||
init:
|
||||
@$(MAKE) gen.init
|
||||
|
||||
## init-githooks: Initialize git hooks ✨
|
||||
.PHONY: init-githooks
|
||||
init-githooks:
|
||||
@$(MAKE) gen.init-githooks
|
||||
|
||||
## gen: Generate all necessary files. ✨
|
||||
.PHONY: gen
|
||||
gen:
|
||||
@$(MAKE) gen.run
|
||||
|
||||
## demo: Run demo get started with Makefiles quickly ✨
|
||||
.PHONY: demo
|
||||
demo:
|
||||
@@ -190,11 +200,6 @@ push.multiarch:
|
||||
tools:
|
||||
@$(MAKE) tools.install
|
||||
|
||||
## gen: Generate all necessary files. ✨
|
||||
.PHONY: gen
|
||||
gen:
|
||||
@$(MAKE) gen.run
|
||||
|
||||
## swagger: Generate swagger document. ✨
|
||||
.PHONY: swagger
|
||||
swagger:
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@
|
||||
<a href="https://goreportcard.com/report/github.com/OpenIMSDK/Open-IM-Server"><img src="https://goreportcard.com/badge/github.com/OpenIMSDK/Open-IM-Server" alt="A+"></a>
|
||||
<a href="https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22"><img src="https://img.shields.io/github/issues/OpenIMSDK/Open-IM-Server/good%20first%20issue?logo=%22github%22" alt="good first"></a>
|
||||
<a href="https://github.com/OpenIMSDK/Open-IM-Server"><img src="https://img.shields.io/github/stars/OpenIMSDK/Open-IM-Server.svg?style=flat&logo=github&colorB=deeppink&label=stars"></a>
|
||||
<a href="https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg"><img src="https://img.shields.io/badge/Slack-300%2B-blueviolet?logo=slack&logoColor=white"></a>
|
||||
<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&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>
|
||||
</p>
|
||||
@@ -316,7 +316,7 @@ OpenIM 我们的目标是建立一个顶级的开源社区。我们有一套标
|
||||
|
||||
如果您想为这个 Open-IM-Server 仓库做贡献,请阅读我们的 [贡献者文档](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md)。
|
||||
|
||||
在您开始之前,请确保您的更改是需要的。最好的方法是创建一个 [新的讨论](https://github.com/OpenIMSDK/Open-IM-Server/discussions/new/choose) 或 [Slack 通讯](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg),或者如果您发现一个问题,首先 [报告它](https://github.com/OpenIMSDK/Open-IM-Server/issues/new/choose)。
|
||||
在您开始之前,请确保您的更改是需要的。最好的方法是创建一个 [新的讨论](https://github.com/OpenIMSDK/Open-IM-Server/discussions/new/choose) 或 [Slack 通讯](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q),或者如果您发现一个问题,首先 [报告它](https://github.com/OpenIMSDK/Open-IM-Server/issues/new/choose)。
|
||||
|
||||
- [代码标准](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/go_code.md)
|
||||
- [Docker 图像标准](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md)
|
||||
@@ -331,14 +331,14 @@ OpenIM 我们的目标是建立一个顶级的开源社区。我们有一套标
|
||||
|
||||
- 📚 [OpenIM 社区](https://github.com/OpenIMSDK/community)
|
||||
- 💕 [OpenIM 兴趣小组](https://github.com/Openim-sigs)
|
||||
- 🚀 [加入我们的 Slack 社区](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg)
|
||||
- 🚀 [加入我们的 Slack 社区](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q)
|
||||
- :eyes: [加入我们的微信群 (微信群)](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
|
||||
|
||||
## :calendar: 社区会议
|
||||
|
||||
我们希望任何人都可以参与我们的社区并贡献代码,我们提供礼物和奖励,欢迎您每周四晚上加入我们。
|
||||
|
||||
我们的会议在 [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) 🎯,然后您可以搜索 Open-IM-Server 管道加入。
|
||||
我们的会议在 [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) 🎯,然后您可以搜索 Open-IM-Server 管道加入。
|
||||
|
||||
我们在 [GitHub 讨论](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting) 中记下每次 [双周会议](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) 的笔记,我们的历史会议记录以及会议回放都可在 [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing) 中找到。
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<a href="https://goreportcard.com/report/github.com/OpenIMSDK/Open-IM-Server"><img src="https://goreportcard.com/badge/github.com/OpenIMSDK/Open-IM-Server" alt="A+"></a>
|
||||
<a href="https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22"><img src="https://img.shields.io/github/issues/OpenIMSDK/Open-IM-Server/good%20first%20issue?logo=%22github%22" alt="good first"></a>
|
||||
<a href="https://github.com/OpenIMSDK/Open-IM-Server"><img src="https://img.shields.io/github/stars/OpenIMSDK/Open-IM-Server.svg?style=flat&logo=github&colorB=deeppink&label=stars"></a>
|
||||
<a href="https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg"><img src="https://img.shields.io/badge/Slack-300%2B-blueviolet?logo=slack&logoColor=white"></a>
|
||||
<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&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>
|
||||
</p>
|
||||
@@ -349,7 +349,7 @@ OpenIM Our goal is to build a top-level open source community. We have a set of
|
||||
|
||||
If you'd like to contribute to this Open-IM-Server repository, please read our [contributor documentation](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md).
|
||||
|
||||
Before you start, please make sure your changes are in demand. The best for that is to create a [new discussion](https://github.com/OpenIMSDK/Open-IM-Server/discussions/new/choose) OR [Slack Communication](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg), or if you find an issue, [report it](https://github.com/OpenIMSDK/Open-IM-Server/issues/new/choose) first.
|
||||
Before you start, please make sure your changes are in demand. The best for that is to create a [new discussion](https://github.com/OpenIMSDK/Open-IM-Server/discussions/new/choose) OR [Slack Communication](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q), or if you find an issue, [report it](https://github.com/OpenIMSDK/Open-IM-Server/issues/new/choose) first.
|
||||
|
||||
- [Code Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/go_code.md)
|
||||
- [Docker Images Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md)
|
||||
@@ -364,14 +364,14 @@ Before you start, please make sure your changes are in demand. The best for that
|
||||
|
||||
+ 📚 [OpenIM Community](https://github.com/OpenIMSDK/community)
|
||||
+ 💕 [OpenIM Interest Group](https://github.com/Openim-sigs)
|
||||
+ 🚀 [Join our Slack community](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg)
|
||||
+ 🚀 [Join our Slack community](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q)
|
||||
+ :eyes: [Join our wechat (微信群)](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
|
||||
|
||||
## :calendar: Community Meetings
|
||||
|
||||
We want anyone to get involved in our community and contributing code, we offer gifts and rewards, and we welcome you to join us every Thursday night.
|
||||
|
||||
Our conference is in the [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) 🎯, then you can search the Open-IM-Server pipeline to join
|
||||
Our conference is in the [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) 🎯, then you can search the Open-IM-Server pipeline to join
|
||||
|
||||
We take notes of each [biweekly meeting](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) in [GitHub discussions](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting), Our historical meeting notes, as well as replays of the meetings are available at [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing).
|
||||
|
||||
|
||||
+146
-5
@@ -255,6 +255,134 @@ builds:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: infra
|
||||
id: infra
|
||||
main: ./tools/infra/infra.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: ncpu
|
||||
id: ncpu
|
||||
main: ./tools/ncpu/ncpu.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-web
|
||||
id: openim-web
|
||||
main: ./tools/openim-web/openim-web.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: component
|
||||
id: component
|
||||
main: ./tools/component/component.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: versionchecker
|
||||
id: versionchecker
|
||||
main: ./tools/versionchecker/versionchecker.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: changelog
|
||||
id: changelog
|
||||
main: ./tools/changelog/changelog.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: yamlfmt
|
||||
id: yamlfmt
|
||||
main: ./tools/yamlfmt/yamlfmt.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
# TODO:Need a script, such as the init - release to help binary to find the right directory
|
||||
# ,which can be compiled binary
|
||||
archives:
|
||||
- format: tar.gz
|
||||
# this name template makes the OS and Arch compatible with the results of uname.
|
||||
@@ -265,12 +393,23 @@ archives:
|
||||
{{- else if eq .Arch "386" }}i386
|
||||
{{- else }}{{ .Arch }}{{ end }}
|
||||
{{- if .Arm }}v{{ .Arm }}{{ end }}
|
||||
|
||||
# Set this to true if you want all files in the archive to be in a single directory.
|
||||
# If set to true and you extract the archive 'goreleaser_Linux_arm64.tar.gz',
|
||||
# you'll get a folder 'goreleaser_Linux_arm64'.
|
||||
# If set to false, all files are extracted separately.
|
||||
# You can also set it to a custom folder name (templating is supported).
|
||||
wrap_in_directory: true
|
||||
|
||||
# use zip for windows archives
|
||||
files:
|
||||
- LICENSE
|
||||
- README.md
|
||||
- CHANGELOG/*
|
||||
- CONTRIBUTING.md
|
||||
- deployment/*
|
||||
- config/*
|
||||
- build/*
|
||||
- scripts/*
|
||||
- Makefile
|
||||
- install.sh
|
||||
- docs/*
|
||||
- src: "*.md"
|
||||
dst: docs
|
||||
@@ -339,7 +478,9 @@ changelog:
|
||||
# - image_templates:
|
||||
# - "openimsdk/open-im-server:{{ .Tag }}-amd64"
|
||||
# - "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-amd64"
|
||||
# dockerfile: Dockerfile
|
||||
# dockerfile: build/images/openim-api/Dockerfile.release
|
||||
# ids:
|
||||
# - openim-api
|
||||
# use: buildx
|
||||
# build_flag_templates:
|
||||
# - "--pull"
|
||||
@@ -359,7 +500,7 @@ changelog:
|
||||
# - image_templates:
|
||||
# - "goreleaser/goreleaser:{{ .Tag }}-arm64"
|
||||
# - "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-arm64"
|
||||
# dockerfile: Dockerfile
|
||||
# dockerfile: build/images/openim-api/Dockerfile.release
|
||||
# use: buildx
|
||||
# build_flag_templates:
|
||||
# - "--pull"
|
||||
|
||||
@@ -43,7 +43,8 @@ COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-s
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
ENV PORT 10002
|
||||
EXPOSE 10002
|
||||
|
||||
EXPOSE ${PORT}
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-api /usr/bin/openim-api
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-api --port ${PORT} -c ${SERVER_WORKDIR}/config"]
|
||||
ENTRYPOINT ["bash", "-c", "openim-api -c $OPENIM_SERVER_CONFIG_NAME --port $PORT"]
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
COPY openim-api /usr/bin/
|
||||
|
||||
# nosemgrep: dockerfile.security.missing-user.missing-user
|
||||
ENTRYPOINT ["/usr/bin/openim-api"]
|
||||
# nosemgrep: dockerfile.security.missing-user.missing-user
|
||||
CMD ["--help"]
|
||||
@@ -42,4 +42,8 @@ WORKDIR /openim/openim-server
|
||||
COPY --from=builder $OPENIM_SERVER_BINDIR/platforms /openim/openim-server/_output/bin/platforms
|
||||
COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-cmdutils"]
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-cmdutils /usr/bin/openim-cmdutils
|
||||
|
||||
ENTRYPOINT ["openim-cmdutils"]
|
||||
|
||||
CMD ["--help"]
|
||||
|
||||
@@ -41,4 +41,8 @@ WORKDIR /openim/openim-server
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-crontask"]
|
||||
ENV OPENIM_SERVER_CONFIG_NAME=/openim/openim-server/config
|
||||
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-crontask /usr/bin/openim-crontask
|
||||
|
||||
CMD ["bash", "-c", "openim-crontask -c $OPENIM_SERVER_CONFIG_NAME"]
|
||||
|
||||
@@ -41,10 +41,12 @@ WORKDIR /openim/openim-server
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
ENV PORT 10140 \
|
||||
WS_PORT 10001
|
||||
|
||||
EXPOSE 10140
|
||||
EXPOSE 10001
|
||||
|
||||
CMD ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msggateway --port 10140 --ws_port 10001
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msggateway /usr/bin/openim-msggateway
|
||||
|
||||
CMD ["bash", "-c", "openim-msggateway -c $OPENIM_SERVER_CONFIG_NAME --port $PORT --ws_port $WS_PORT"]
|
||||
@@ -36,12 +36,11 @@ RUN make build BINS=openim-msgtransfer
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
CMD ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msgtransfer
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msgtransfer /usr/bin/openim-msgtransfer
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then openim-msgtransfer -c $OPENIM_SERVER_CONFIG_NAME --prometheus_port $PROMETHEUS_PORT; else openim-msgtransfer -c $OPENIM_SERVER_CONFIG_NAME; fi"]
|
||||
@@ -15,6 +15,7 @@
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set go mod installation source and proxy
|
||||
# docker run -e "PORT=10003" -e "PROMETHEUSORT=4321" --network host -it 67ef891ad1ff
|
||||
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
@@ -38,12 +39,14 @@ FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
ENV PORT 10170 \
|
||||
PROMETHEUS_PORT 20170
|
||||
|
||||
EXPOSE 10170
|
||||
|
||||
CMD ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-push --port 10170
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-push /usr/bin/openim-push
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then openim-push -c $OPENIM_SERVER_CONFIG_NAME --port $PORT --prometheus_port $PROMETHEUS_PORT; else openim-push -c $OPENIM_SERVER_CONFIG_NAME --port $PORT; fi"]
|
||||
@@ -33,21 +33,20 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
# RUN make build BINS=openim-rpc
|
||||
|
||||
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth ./cmd/openim-rpc/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-auth
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
ENV PORT 10160 \
|
||||
PROMETHEUS_PORT 20160
|
||||
|
||||
EXPOSE 10160
|
||||
|
||||
# ENTRYPOINT
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-auth --port 10160 -c ${SERVER_WORKDIR}/config"]
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-auth /usr/bin/openim-rpc-auth
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-auth --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-auth --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
|
||||
@@ -33,27 +33,20 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation ./cmd/openim-rpc/openim-rpc-conversation
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-conversation
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10230
|
||||
EXPOSE 20230
|
||||
ENV PORT 10230 \
|
||||
PROMETHEUS_PORT 20230
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-conversation --port 10230 --prometheus_port 20230 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE 10230
|
||||
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-conversation /usr/bin/openim-rpc-conversation
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-conversation --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-conversation --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
|
||||
@@ -33,27 +33,20 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend ./cmd/openim-rpc/openim-rpc-friend
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-friend
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10120
|
||||
EXPOSE 20120
|
||||
ENV PORT 10120 \
|
||||
PROMETHEUS_PORT 20120
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-friend --port 10120 --prometheus_port 20120 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE 10120
|
||||
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-friend /usr/bin/openim-rpc-friend
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-friend --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-friend --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
|
||||
|
||||
@@ -33,27 +33,20 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group ./cmd/openim-rpc/openim-rpc-group
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-group
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10150
|
||||
EXPOSE 20150
|
||||
ENV PORT 10150 \
|
||||
PROMETHEUS_PORT 20150
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-group --port 10150 --prometheus_port 20150 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE 10150
|
||||
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-group /usr/bin/openim-rpc-group
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-group --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-group --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
|
||||
@@ -33,27 +33,20 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg ./cmd/openim-rpc/openim-rpc-msg
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-msg
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10130
|
||||
EXPOSE 20130
|
||||
ENV PORT 10130 \
|
||||
PROMETHEUS_PORT 20130
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-msg --port 10130 --prometheus_port 20130 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE 10130
|
||||
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-msg /usr/bin/openim-rpc-msg
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-msg --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-msg --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
|
||||
@@ -33,26 +33,21 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third ./cmd/openim-rpc/openim-rpc-third
|
||||
RUN make build BINS=openim-rpc-third
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10200
|
||||
ENV PORT 10190 \
|
||||
PROMETHEUS_PORT 21301
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-third --port 10200 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE 10190
|
||||
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-third /usr/bin/openim-rpc-third
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-third --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-third --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
|
||||
|
||||
@@ -33,26 +33,20 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user ./cmd/openim-rpc/openim-rpc-user
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-user
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
ENV PORT 10110 \
|
||||
PROMETHEUS_PORT 20110
|
||||
|
||||
EXPOSE 10110
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-user --port 10110 -c ${SERVER_WORKDIR}/config"]
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-user /usr/bin/openim-rpc-user
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-user --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-user --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
# 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.
|
||||
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN make clean
|
||||
RUN make build BINS=component
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/tools /openim/openim-server/_output/bin/tools/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
ENV OPENIM_SERVER_CONFIG_NAME=/openim/openim-server/config
|
||||
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/component /usr/bin/component
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "component -c $OPENIM_SERVER_CONFIG_NAME"]
|
||||
@@ -0,0 +1,57 @@
|
||||
# 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.
|
||||
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
RUN apt-get update && apt-get install -y curl unzip
|
||||
|
||||
RUN curl -LO https://app-1302656840.cos.ap-nanjing.myqcloud.com/dist.zip \
|
||||
&& unzip dist.zip -d ./ \
|
||||
&& rm dist.zip
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN make clean
|
||||
RUN make build BINS=openim-web
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-ubuntu-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/tools /openim/openim-server/_output/bin/tools/
|
||||
COPY --from=builder /openim/openim-server/dist /openim/openim-server/dist
|
||||
|
||||
ENV PORT 11001
|
||||
ENV DISTPATH /openim/openim-server/dist
|
||||
|
||||
EXPOSE $PORT
|
||||
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/tools/$(get_os)/$(get_arch)/openim-web /usr/bin/openim-web
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "openim-web -port $PORT -distPath $DISTPATH"]
|
||||
@@ -1,378 +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.
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Infrastructural configurations, please modify based on your setup
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
###################### Zookeeper ######################
|
||||
# Zookeeper configuration
|
||||
# It's not recommended to modify the schema
|
||||
#
|
||||
# Zookeeper address
|
||||
# Zookeeper username
|
||||
# Zookeeper password
|
||||
zookeeper:
|
||||
schema: openim
|
||||
address: [ 127.0.0.1:2181 ]
|
||||
username:
|
||||
password:
|
||||
|
||||
###################### Mysql ######################
|
||||
# MySQL configuration
|
||||
# Currently, only single machine setup is supported
|
||||
#
|
||||
# Maximum number of open connections
|
||||
# Maximum number of idle connections
|
||||
# Maximum lifetime in seconds a connection can be reused
|
||||
# Log level: 1=slient, 2=error, 3=warn, 4=info
|
||||
# Slow query threshold in milliseconds
|
||||
mysql:
|
||||
address: [ 127.0.0.1:13306 ]
|
||||
username: root
|
||||
password: openIM123
|
||||
database: openIM_v3
|
||||
maxOpenConn: 1000
|
||||
maxIdleConn: 100
|
||||
maxLifeTime: 60
|
||||
logLevel: 4
|
||||
slowThreshold: 500
|
||||
|
||||
###################### Mongo ######################
|
||||
# MongoDB configuration
|
||||
# If uri is not empty, it will be used directly
|
||||
#
|
||||
# MongoDB address for standalone setup, Mongos address for sharded cluster setup
|
||||
# Default MongoDB database name
|
||||
# Maximum connection pool size
|
||||
mongo:
|
||||
uri:
|
||||
address: [ 127.0.0.1:37017 ]
|
||||
database: openIM_v3
|
||||
username: root
|
||||
password: openIM123
|
||||
maxPoolSize: 100
|
||||
|
||||
###################### Redis ######################
|
||||
# Redis configuration
|
||||
#
|
||||
# Username is required only for Redis version 6.0+
|
||||
redis:
|
||||
address: [ 127.0.0.1:16379 ]
|
||||
username:
|
||||
password: openIM123
|
||||
|
||||
###################### Kafka ######################
|
||||
# Kafka configuration
|
||||
#
|
||||
# Kafka username
|
||||
# Kafka password
|
||||
# It's not recommended to modify this topic name
|
||||
# Consumer group ID, it's not recommended to modify
|
||||
kafka:
|
||||
username:
|
||||
password:
|
||||
addr: [ 127.0.0.1:9092 ]
|
||||
latestMsgToRedis:
|
||||
topic: "latestMsgToRedis"
|
||||
offlineMsgToMongo:
|
||||
topic: "offlineMsgToMongoMysql"
|
||||
msgToPush:
|
||||
topic: "msgToPush"
|
||||
consumerGroupID:
|
||||
msgToRedis: redis
|
||||
msgToMongo: mongo
|
||||
msgToMySql: mysql
|
||||
msgToPush: push
|
||||
|
||||
###################### RPC ######################
|
||||
# RPC configuration
|
||||
#
|
||||
# IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway
|
||||
# Default listen IP is 0.0.0.0
|
||||
rpc:
|
||||
registerIP:
|
||||
listenIP: 0.0.0.0
|
||||
|
||||
###################### API ######################
|
||||
# API configuration
|
||||
#
|
||||
# API service port
|
||||
# Default listen IP is 0.0.0.0
|
||||
api:
|
||||
openImApiPort: [ 10002 ]
|
||||
listenIP: 0.0.0.0
|
||||
|
||||
###################### Gateway ######################
|
||||
# Object storage configuration
|
||||
#
|
||||
# Use minio for object storage
|
||||
# API URL should be accessible by the app
|
||||
# It's not recommended to modify the bucket name
|
||||
# Endpoint should be accessible by the app
|
||||
# Session token
|
||||
# Configuration for Tencent COS
|
||||
# Configuration for Aliyun OSS
|
||||
# apiURL is the address of the api, the access address of the app, use s3 must be configured
|
||||
# minio.endpoint can be configured as an intranet address,
|
||||
# minio.signEndpoint is minio public network address
|
||||
object:
|
||||
enable: "minio"
|
||||
apiURL: "http://127.0.0.1:10002"
|
||||
minio:
|
||||
bucket: "openim"
|
||||
endpoint: "http://127.0.0.1:10005"
|
||||
accessKeyID: "root"
|
||||
secretAccessKey: "openIM123"
|
||||
sessionToken: ""
|
||||
signEndpoint: "http://127.0.0.1:10005"
|
||||
cos:
|
||||
bucketURL: "https://temp-1252357374.cos.ap-chengdu.myqcloud.com"
|
||||
secretID: ""
|
||||
secretKey: ""
|
||||
sessionToken: ""
|
||||
oss:
|
||||
endpoint: "https://oss-cn-chengdu.aliyuncs.com"
|
||||
bucket: "demo-9999999"
|
||||
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com"
|
||||
accessKeyID: ""
|
||||
accessKeySecret: ""
|
||||
sessionToken: ""
|
||||
|
||||
# RPC service ports
|
||||
# These ports are passed into the program by the script and are not recommended to modify
|
||||
# For launching multiple programs, just fill in multiple ports separated by commas
|
||||
# For example, [10110, 10111]
|
||||
rpcPort:
|
||||
openImUserPort: [ 10110 ]
|
||||
openImFriendPort: [ 10120 ]
|
||||
openImMessagePort: [ 10130 ]
|
||||
openImMessageGatewayPort: [ 10140 ]
|
||||
openImGroupPort: [ 10150 ]
|
||||
openImAuthPort: [ 10160 ]
|
||||
openImPushPort: [ 10170 ]
|
||||
openImConversationPort: [ 10180 ]
|
||||
openImThirdPort: [ 10190 ]
|
||||
|
||||
# RPC service names for registration, it's not recommended to modify these
|
||||
rpcRegisterName:
|
||||
openImUserName: User
|
||||
openImFriendName: Friend
|
||||
openImMsgName: Msg
|
||||
openImPushName: Push
|
||||
openImMessageGatewayName: MessageGateway
|
||||
openImGroupName: Group
|
||||
openImAuthName: Auth
|
||||
openImConversationName: Conversation
|
||||
openImThirdName: Third
|
||||
|
||||
# Log configuration
|
||||
#
|
||||
# Storage directory
|
||||
# Log rotation time
|
||||
# Maximum number of logs to retain
|
||||
# Log level, 6 means all levels
|
||||
# Whether to output to stdout
|
||||
# Whether to output in json format
|
||||
# Whether to include stack trace in logs
|
||||
log:
|
||||
storageLocation: ../../../../../logs/
|
||||
rotationTime: 24
|
||||
remainRotationCount: 2
|
||||
remainLogLevel: 6
|
||||
isStdout: false
|
||||
isJson: false
|
||||
withStack: false
|
||||
|
||||
# Long connection server configuration
|
||||
#
|
||||
# Websocket port for msg_gateway
|
||||
# Maximum number of websocket connections
|
||||
# Maximum length of websocket request package
|
||||
# Websocket connection handshake timeout
|
||||
longConnSvr:
|
||||
openImWsPort: [ 10001 ]
|
||||
websocketMaxConnNum: 100000
|
||||
websocketMaxMsgLen: 4096
|
||||
websocketTimeout: 10
|
||||
|
||||
# Push notification service configuration
|
||||
#
|
||||
# Use GeTui for push notifications
|
||||
# GeTui offline push configuration
|
||||
# FCM offline push configuration
|
||||
# Account file, place it in the config directory
|
||||
# JPush configuration, modify these after applying in JPush backend
|
||||
push:
|
||||
enable: getui
|
||||
geTui:
|
||||
pushUrl: "https://restapi.getui.com/v2/$appId"
|
||||
masterSecret: ""
|
||||
appKey: ""
|
||||
intent: ""
|
||||
channelID: ""
|
||||
channelName: ""
|
||||
fcm:
|
||||
serviceAccount: "x.json"
|
||||
jpns:
|
||||
appKey:
|
||||
masterSecret:
|
||||
pushUrl:
|
||||
pushIntent:
|
||||
|
||||
# App manager configuration
|
||||
#
|
||||
# Built-in app manager user IDs
|
||||
# Built-in app manager nicknames
|
||||
manager:
|
||||
userID: [ "openIM123456","openIM654321","openIMAdmin" ]
|
||||
nickname: [ "system1","system2", "system3" ]
|
||||
|
||||
# Multi-platform login policy
|
||||
# For each platform(Android, iOS, Windows, Mac, web), only one can be online at a time
|
||||
multiLoginPolicy: 1
|
||||
|
||||
# Whether to store messages in MySQL, messages in MySQL are only used for management background
|
||||
chatPersistenceMysql: true
|
||||
|
||||
# Message cache timeout in seconds, it's not recommended to modify
|
||||
msgCacheTimeout: 86400
|
||||
|
||||
# Whether to enable read receipts for group chat
|
||||
groupMessageHasReadReceiptEnable: true
|
||||
|
||||
# Whether to enable read receipts for single chat
|
||||
singleMessageHasReadReceiptEnable: true
|
||||
|
||||
# MongoDB offline message retention period in days
|
||||
retainChatRecords: 365
|
||||
|
||||
# Schedule to clear expired messages(older than retainChatRecords days) in MongoDB every Wednesday at 2am
|
||||
# This deletion is just for cleaning up disk usage according to previous configuration retainChatRecords, no notification will be sent
|
||||
chatRecordsClearTime: "0 2 * * 3"
|
||||
|
||||
# Schedule to auto delete messages every day at 2am
|
||||
# This deletion is for messages that have been retained for more than msg_destruct_time (seconds) in the conversation field
|
||||
msgDestructTime: "0 2 * * *"
|
||||
|
||||
# Secret key
|
||||
secret: openIM123
|
||||
|
||||
# Token policy
|
||||
#
|
||||
# Token expiration period in days
|
||||
tokenPolicy:
|
||||
expire: 90
|
||||
|
||||
# Message verification policy
|
||||
#
|
||||
# Whether to verify friendship when sending messages
|
||||
messageVerify:
|
||||
friendVerify: false
|
||||
|
||||
# iOS push notification configuration
|
||||
#
|
||||
# iOS push notification sound
|
||||
# Whether to count badge
|
||||
# Whether it's production environment
|
||||
iosPush:
|
||||
pushSound: "xxx"
|
||||
badgeCount: true
|
||||
production: false
|
||||
|
||||
# Callback configuration
|
||||
#
|
||||
# Callback URL
|
||||
# Whether to enable this callback event
|
||||
# Timeout in seconds
|
||||
# Whether to continue execution if callback fails
|
||||
callback:
|
||||
url:
|
||||
beforeSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
afterSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
beforeSendGroupMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
afterSendGroupMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
msgModify:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
userOnline:
|
||||
enable: false
|
||||
timeout: 5
|
||||
userOffline:
|
||||
enable: false
|
||||
timeout: 5
|
||||
userKickOff:
|
||||
enable: false
|
||||
timeout: 5
|
||||
offlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
onlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
superGroupOnlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeAddFriend:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeCreateGroup:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeMemberJoinGroup:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeSetGroupMemberInfo:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
setMessageReactionExtensions:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
|
||||
###################### Prometheus ######################
|
||||
# Prometheus configuration
|
||||
# The number of Prometheus ports per service needs to correspond to rpcPort
|
||||
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||
prometheus:
|
||||
enable: false
|
||||
userPrometheusPort: [ 20110 ]
|
||||
friendPrometheusPort: [ 20120 ]
|
||||
messagePrometheusPort: [ 20130 ]
|
||||
messageGatewayPrometheusPort: [ 20140 ]
|
||||
groupPrometheusPort: [ 20150 ]
|
||||
authPrometheusPort: [ 20160 ]
|
||||
pushPrometheusPort: [ 20170 ]
|
||||
conversationPrometheusPort: [ 20230 ]
|
||||
rtcPrometheusPort: [ 21300 ]
|
||||
thirdPrometheusPort: [ 21301 ]
|
||||
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ]
|
||||
@@ -12,8 +12,81 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# ================= Basic Configuration ===================
|
||||
# User for authentication or system operations
|
||||
USER=${USER}
|
||||
|
||||
# Password associated with the specified user for authentication
|
||||
PASSWORD=${PASSWORD}
|
||||
|
||||
# Endpoint for the MinIO object storage service
|
||||
MINIO_ENDPOINT=${MINIO_ENDPOINT}
|
||||
|
||||
# Base URL for the application programming interface (API)
|
||||
API_URL=${API_URL}
|
||||
DATA_DIR=${DATA_DIR}
|
||||
|
||||
# Directory path for storing data files or related information
|
||||
DATA_DIR=${DATA_DIR}
|
||||
|
||||
|
||||
# ============ Component Extension Configuration ==========
|
||||
# Address or hostname for the ZooKeeper service (often used in distributed systems for maintaining configuration information)
|
||||
ZOOKEEPER_ADDRESS=${ZOOKEEPER_ADDRESS}
|
||||
ZOOKEEPER_PORT=${ZOOKEEPER_PORT}
|
||||
|
||||
# Port on which MySQL database service is running
|
||||
MYSQL_PORT=${MYSQL_PORT}
|
||||
|
||||
# Password to authenticate with the MySQL database service
|
||||
MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||
|
||||
# Port on which MongoDB service is running
|
||||
MONGO_PORT=${MONGO_PORT}
|
||||
|
||||
# Username to authenticate with the MongoDB service
|
||||
MONGO_USERNAME=${MONGO_USERNAME}
|
||||
|
||||
# Password to authenticate with the MongoDB service
|
||||
MONGO_PASSWORD=${MONGO_PASSWORD}
|
||||
|
||||
# Name of the database in MongoDB to be used
|
||||
MONGO_DATABASE=${MONGO_DATABASE}
|
||||
|
||||
# Port on which Redis in-memory data structure store is running
|
||||
REDIS_PORT=${REDIS_PORT}
|
||||
|
||||
# Password to authenticate with the Redis service
|
||||
REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||
|
||||
# Port on which Kafka distributed streaming platform is running
|
||||
KAFKA_PORT=${KAFKA_PORT}
|
||||
|
||||
# Address or hostname for the Kafka service
|
||||
KAFKA_ADDR=${KAFKA_ADDR}
|
||||
|
||||
# Topic in Kafka for storing the latest messages in Redis
|
||||
KAFKA_LATESTMSG_REDIS_TOPIC=${KAFKA_LATESTMSG_REDIS_TOPIC}
|
||||
|
||||
# Topic in Kafka for pushing messages (e.g. notifications or updates)
|
||||
KAFKA_MSG_PUSH_TOPIC=${KAFKA_MSG_PUSH_TOPIC}
|
||||
|
||||
# Topic in Kafka for storing offline messages in MongoDB
|
||||
KAFKA_OFFLINEMSG_MONGO_TOPIC=${KAFKA_OFFLINEMSG_MONGO_TOPIC}
|
||||
|
||||
# Port on which MinIO object storage service is running
|
||||
MINIO_PORT=${MINIO_PORT}
|
||||
|
||||
# Access key to authenticate with the MinIO service
|
||||
MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY}
|
||||
|
||||
# Secret key corresponding to the access key for MinIO authentication
|
||||
MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
|
||||
|
||||
# ================== OpenIM Web ===========================
|
||||
OPENIM_WEB_DIST_PATH=${OPENIM_WEB_DIST_PATH}
|
||||
OPENIM_WEB_PPRT=${OPENIM_WEB_PPRT}
|
||||
|
||||
|
||||
# =================== BRANCH NAME =========================
|
||||
CHAT_BRANCH=${CHAT_BRANCH}
|
||||
SERVER_BRANCH=${SERVER_BRANCH}
|
||||
@@ -1,64 +1,60 @@
|
||||
#fixme Clone openIM Server project before using docker-compose,project address:https://github.com/OpenIMSDK/Open-IM-Server.git
|
||||
version: "3"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
ports:
|
||||
- 13306:3306
|
||||
- 23306:33060
|
||||
- "${MYSQL_PORT}:3306"
|
||||
container_name: mysql
|
||||
volumes:
|
||||
- ${DATA_DIR}/components/mysql/data:/var/lib/mysql
|
||||
- /etc/localtime:/etc/localtime
|
||||
- "${DATA_DIR}/components/mysql/data:/var/lib/mysql"
|
||||
- "/etc/localtime:/etc/localtime"
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${PASSWORD}
|
||||
MYSQL_ROOT_PASSWORD: "${MYSQL_PASSWORD}"
|
||||
restart: always
|
||||
|
||||
mongodb:
|
||||
image: mongo:6.0.2
|
||||
ports:
|
||||
- 37017:27017
|
||||
- "${MONGO_PORT}:27017"
|
||||
container_name: mongo
|
||||
command: --wiredTigerCacheSizeGB 1 --auth
|
||||
volumes:
|
||||
- ${DATA_DIR}/components/mongodb/data/db:/data/db
|
||||
- ${DATA_DIR}/components/mongodb/data/logs:/data/logs
|
||||
- ${DATA_DIR}/components/mongodb/data/conf:/etc/mongo
|
||||
- ./scripts/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro
|
||||
- "${DATA_DIR}/components/mongodb/data/db:/data/db"
|
||||
- "${DATA_DIR}/components/mongodb/data/logs:/data/logs"
|
||||
- "${DATA_DIR}/components/mongodb/data/conf:/etc/mongo"
|
||||
- "./scripts/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
# cache
|
||||
- wiredTigerCacheSizeGB=1
|
||||
- MONGO_INITDB_ROOT_USERNAME=${USER}
|
||||
- MONGO_INITDB_ROOT_PASSWORD=${PASSWORD}
|
||||
- MONGO_INITDB_DATABASE=openIM
|
||||
- MONGO_USERNAME=${USER}
|
||||
- MONGO_PASSWORD=${PASSWORD}
|
||||
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME}
|
||||
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}
|
||||
- MONGO_INITDB_DATABASE=${MONGO_DATABASE}
|
||||
restart: always
|
||||
|
||||
redis:
|
||||
image: redis:7.0.0
|
||||
ports:
|
||||
- 16379:6379
|
||||
- "${REDIS_PORT}:6379"
|
||||
container_name: redis
|
||||
volumes:
|
||||
- ${DATA_DIR}/components/redis/data:/data
|
||||
#redis config file
|
||||
- ${DATA_DIR}/components/redis/config/redis.conf:/usr/local/redis/config/redis.conf
|
||||
- "${DATA_DIR}/components/redis/data:/data"
|
||||
- "${DATA_DIR}/components/redis/config/redis.conf:/usr/local/redis/config/redis.conf"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
||||
sysctls:
|
||||
net.core.somaxconn: 1024
|
||||
command: redis-server --requirepass ${PASSWORD} --appendonly yes
|
||||
command: redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes
|
||||
|
||||
zookeeper:
|
||||
image: wurstmeister/zookeeper
|
||||
ports:
|
||||
- 2181:2181
|
||||
- "${ZOOKEEPER_PORT}:2181"
|
||||
container_name: zookeeper
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
- "/etc/localtime:/etc/localtime"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
||||
@@ -69,13 +65,13 @@ services:
|
||||
container_name: kafka
|
||||
restart: always
|
||||
ports:
|
||||
- 9092:9092
|
||||
- "${KAFKA_PORT}:9092"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
KAFKA_BROKER_ID: 0
|
||||
KAFKA_ZOOKEEPER_CONNECT: 127.0.0.1:2181
|
||||
KAFKA_CREATE_TOPICS: "latestMsgToRedis:8:1,msgToPush:8:1,offlineMsgToMongoMysql:8:1"
|
||||
KAFKA_ADVERTISED_LISTENERS: INSIDE://127.0.0.1:9092,OUTSIDE://103.116.45.174:9092
|
||||
KAFKA_ZOOKEEPER_CONNECT: "${ZOOKEEPER_ADDRESS}:${ZOOKEEPER_PORT}"
|
||||
KAFKA_CREATE_TOPICS: "${KAFKA_LATESTMSG_REDIS_TOPIC}:8:1,${KAFKA_MSG_PUSH_TOPIC}:8:1,${KAFKA_OFFLINEMSG_MONGO_TOPIC}:8:1"
|
||||
KAFKA_ADVERTISED_LISTENERS: INSIDE://${KAFKA_ADDR}:${KAFKA_PORT},OUTSIDE://CHANGE_TO_YOUR_EXTERNAL_IP:${KAFKA_PORT}
|
||||
KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9093
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT"
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
|
||||
@@ -86,28 +82,38 @@ services:
|
||||
minio:
|
||||
image: minio/minio
|
||||
ports:
|
||||
- 10005:9000
|
||||
- 9090:9090
|
||||
- "${MINIO_PORT}:9000"
|
||||
- "9090:9090"
|
||||
container_name: minio
|
||||
volumes:
|
||||
- ${DATA_DIR}/components/mnt/data:/data
|
||||
- ${DATA_DIR}/components/mnt/config:/root/.minio
|
||||
- "${DATA_DIR}/components/mnt/data:/data"
|
||||
- "${DATA_DIR}/components/mnt/config:/root/.minio"
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${USER}
|
||||
MINIO_ROOT_PASSWORD: ${PASSWORD}
|
||||
MINIO_ROOT_USER: "${MINIO_ACCESS_KEY}"
|
||||
MINIO_ROOT_PASSWORD: "${MINIO_SECRET_KEY}"
|
||||
restart: always
|
||||
command: minio server /data --console-address ':9090'
|
||||
|
||||
# openim-web:
|
||||
# image: ghcr.io/openimsdk/openim-web:main
|
||||
# container_name: openim-web
|
||||
# environment:
|
||||
# - OPENIM_WEB_DIST_PATH=${OPENIM_WEB_DIST_PATH}
|
||||
# - OPENIM_WEB_PPRT=${OPENIM_WEB_PPRT}
|
||||
# restart: always
|
||||
# ports:
|
||||
# - "${OPENIM_WEB_PPRT}:11001"
|
||||
|
||||
openim-server:
|
||||
image: ghcr.io/openimsdk/openim-server:main
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:main
|
||||
# image: openim/openim-server:main
|
||||
container_name: openim-server
|
||||
# healthcheck:
|
||||
# test: ["CMD-SHELL", "./scripts/check-all.sh"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 5
|
||||
healthcheck:
|
||||
test: ["CMD", "./scripts/check-all.sh"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
volumes:
|
||||
- ./logs:/openim/openim-server/logs
|
||||
- ./config:/openim/openim-server/config
|
||||
@@ -156,4 +162,4 @@ services:
|
||||
# container_name: node-exporter
|
||||
# restart: always
|
||||
# ports:
|
||||
# - "9100:9100"
|
||||
# - "9100:9100"
|
||||
@@ -37,7 +37,7 @@ require (
|
||||
require github.com/google/uuid v1.3.0
|
||||
|
||||
require (
|
||||
github.com/OpenIMSDK/protocol v0.0.15
|
||||
github.com/OpenIMSDK/protocol v0.0.17
|
||||
github.com/OpenIMSDK/tools v0.0.14
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible
|
||||
github.com/go-redis/redis v6.15.9+incompatible
|
||||
@@ -54,6 +54,7 @@ require (
|
||||
cloud.google.com/go/iam v1.1.1 // indirect
|
||||
cloud.google.com/go/longrunning v0.5.1 // indirect
|
||||
cloud.google.com/go/storage v1.30.1 // indirect
|
||||
github.com/NYTimes/gziphandler v1.1.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bytedance/sonic v1.9.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
|
||||
@@ -17,8 +17,8 @@ cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7Biccwk
|
||||
firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4=
|
||||
firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/OpenIMSDK/protocol v0.0.15 h1:KrrvdHH9kFF/tFYL2FXRPAr2e5F5DctSHfHq6MQjUI4=
|
||||
github.com/OpenIMSDK/protocol v0.0.15/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
||||
github.com/OpenIMSDK/protocol v0.0.17 h1:ixjKUVGlTW+jQK5cPaKV//6l4bk9DAlbjDhocztYSbU=
|
||||
github.com/OpenIMSDK/protocol v0.0.17/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
||||
github.com/OpenIMSDK/tools v0.0.14 h1:WLof/+WxyPyRST+QkoTKubYCiV73uCLiL8pgnpH/yKQ=
|
||||
github.com/OpenIMSDK/tools v0.0.14/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
|
||||
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
go 1.20.0
|
||||
go 1.18
|
||||
|
||||
use (
|
||||
.
|
||||
@@ -8,5 +8,6 @@ use (
|
||||
./tools/infra
|
||||
./tools/ncpu
|
||||
./tools/versionchecker
|
||||
./tools/openim-web
|
||||
./tools/yamlfmt
|
||||
)
|
||||
|
||||
+1
-2
@@ -20,7 +20,6 @@
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
|
||||
############################## OpenIM Github ##############################
|
||||
# ... rest of the script ...
|
||||
|
||||
@@ -537,7 +536,7 @@ O:::::::OOO:::::::O p:::::ppppp:::::::pe::::::::e n::::n n::::nII:
|
||||
# Set text color to yellow for the Slack link
|
||||
echo -e "\033[1;33m"
|
||||
|
||||
print_with_delay "Join our developer community on Slack: https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg" 0.01
|
||||
print_with_delay "Join our developer community on Slack: https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" 0.01
|
||||
|
||||
# Reset text color back to normal
|
||||
echo -e "\033[0m"
|
||||
|
||||
@@ -22,12 +22,7 @@ import (
|
||||
relationtb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||
)
|
||||
|
||||
func (s *groupServer) FindGroupMember(
|
||||
ctx context.Context,
|
||||
groupIDs []string,
|
||||
userIDs []string,
|
||||
roleLevels []int32,
|
||||
) ([]*relationtb.GroupMemberModel, error) {
|
||||
func (s *groupServer) FindGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) ([]*relationtb.GroupMemberModel, error) {
|
||||
members, err := s.GroupDatabase.FindGroupMember(ctx, groupIDs, userIDs, roleLevels)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -114,6 +114,24 @@ type groupServer struct {
|
||||
msgRpcClient rpcclient.MessageRpcClient
|
||||
}
|
||||
|
||||
func (s *groupServer) NotificationUserInfoUpdate(ctx context.Context, req *pbgroup.NotificationUserInfoUpdateReq) (*pbgroup.NotificationUserInfoUpdateResp, error) {
|
||||
defer log.ZDebug(ctx, "return")
|
||||
|
||||
members, err := s.GroupDatabase.FindGroupMember(ctx, nil, []string{req.UserID}, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, member := range members {
|
||||
if member.Nickname != "" && member.FaceURL != "" {
|
||||
continue
|
||||
}
|
||||
if err := s.Notification.GroupMemberInfoSetNotification(ctx, member.GroupID, member.UserID); err != nil {
|
||||
log.ZError(ctx, "setGroupMemberInfo notification failed", err, "member", member.UserID, "groupID", member.GroupID)
|
||||
}
|
||||
}
|
||||
return &pbgroup.NotificationUserInfoUpdateResp{}, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) CheckGroupAdmin(ctx context.Context, groupID string) error {
|
||||
if !authverify.IsAppManagerUid(ctx) {
|
||||
groupMember, err := s.GroupDatabase.TakeGroupMember(ctx, groupID, mcontext.GetOpUserID(ctx))
|
||||
|
||||
@@ -50,6 +50,7 @@ type userServer struct {
|
||||
friendNotificationSender *notification.FriendNotificationSender
|
||||
userNotificationSender *notification.UserNotificationSender
|
||||
friendRpcClient *rpcclient.FriendRpcClient
|
||||
groupRpcClient *rpcclient.GroupRpcClient
|
||||
RegisterCenter registry.SvcDiscoveryRegistry
|
||||
}
|
||||
|
||||
@@ -81,11 +82,13 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||
userMongoDB := unrelation.NewUserMongoDriver(mongo.GetDatabase())
|
||||
database := controller.NewUserDatabase(userDB, cache, tx.NewGorm(db), userMongoDB)
|
||||
friendRpcClient := rpcclient.NewFriendRpcClient(client)
|
||||
groupRpcClient := rpcclient.NewGroupRpcClient(client)
|
||||
msgRpcClient := rpcclient.NewMessageRpcClient(client)
|
||||
u := &userServer{
|
||||
UserDatabase: database,
|
||||
RegisterCenter: client,
|
||||
friendRpcClient: &friendRpcClient,
|
||||
groupRpcClient: &groupRpcClient,
|
||||
friendNotificationSender: notification.NewFriendNotificationSender(&msgRpcClient, notification.WithDBFunc(database.FindWithError)),
|
||||
userNotificationSender: notification.NewUserNotificationSender(&msgRpcClient, notification.WithUserFunc(database.FindWithError)),
|
||||
}
|
||||
@@ -125,6 +128,11 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req.UserInfo.Nickname != "" || req.UserInfo.FaceURL != "" {
|
||||
if err := s.groupRpcClient.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID); err != nil {
|
||||
log.ZError(ctx, "NotificationUserInfoUpdate", err)
|
||||
}
|
||||
}
|
||||
for _, friendID := range friends {
|
||||
s.friendNotificationSender.FriendInfoUpdatedNotification(ctx, req.UserInfo.UserID, friendID)
|
||||
}
|
||||
|
||||
@@ -41,83 +41,34 @@ type GroupDatabase interface {
|
||||
TakeGroup(ctx context.Context, groupID string) (group *relationtb.GroupModel, err error)
|
||||
FindGroup(ctx context.Context, groupIDs []string) (groups []*relationtb.GroupModel, err error)
|
||||
FindNotDismissedGroup(ctx context.Context, groupIDs []string) (groups []*relationtb.GroupModel, err error)
|
||||
SearchGroup(
|
||||
ctx context.Context,
|
||||
keyword string,
|
||||
pageNumber, showNumber int32,
|
||||
) (uint32, []*relationtb.GroupModel, error)
|
||||
SearchGroup(ctx context.Context, keyword string, pageNumber, showNumber int32) (uint32, []*relationtb.GroupModel, error)
|
||||
UpdateGroup(ctx context.Context, groupID string, data map[string]any) error
|
||||
DismissGroup(ctx context.Context, groupID string, deleteMember bool) error // 解散群,并删除群成员
|
||||
GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error)
|
||||
// GroupMember
|
||||
TakeGroupMember(
|
||||
ctx context.Context,
|
||||
groupID string,
|
||||
userID string,
|
||||
) (groupMember *relationtb.GroupMemberModel, err error)
|
||||
TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relationtb.GroupMemberModel, err error)
|
||||
TakeGroupOwner(ctx context.Context, groupID string) (*relationtb.GroupMemberModel, error)
|
||||
FindGroupMember(
|
||||
ctx context.Context,
|
||||
groupIDs []string,
|
||||
userIDs []string,
|
||||
roleLevels []int32,
|
||||
) ([]*relationtb.GroupMemberModel, error)
|
||||
FindGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) ([]*relationtb.GroupMemberModel, error)
|
||||
FindGroupMemberUserID(ctx context.Context, groupID string) ([]string, error)
|
||||
FindGroupMemberNum(ctx context.Context, groupID string) (uint32, error)
|
||||
FindUserManagedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)
|
||||
PageGroupRequest(
|
||||
ctx context.Context,
|
||||
groupIDs []string,
|
||||
pageNumber, showNumber int32,
|
||||
) (uint32, []*relationtb.GroupRequestModel, error)
|
||||
// PageGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber,
|
||||
// showNumber int32) (uint32, []*relationtb.GroupMemberModel, error)
|
||||
PageGetJoinGroup(
|
||||
ctx context.Context,
|
||||
userID string,
|
||||
pageNumber, showNumber int32,
|
||||
) (total uint32, totalGroupMembers []*relationtb.GroupMemberModel, err error)
|
||||
PageGetGroupMember(
|
||||
ctx context.Context,
|
||||
groupID string,
|
||||
pageNumber, showNumber int32,
|
||||
) (total uint32, totalGroupMembers []*relationtb.GroupMemberModel, err error)
|
||||
SearchGroupMember(
|
||||
ctx context.Context,
|
||||
keyword string,
|
||||
groupIDs []string,
|
||||
userIDs []string,
|
||||
roleLevels []int32,
|
||||
pageNumber, showNumber int32,
|
||||
) (uint32, []*relationtb.GroupMemberModel, error)
|
||||
HandlerGroupRequest(
|
||||
ctx context.Context,
|
||||
groupID string,
|
||||
userID string,
|
||||
handledMsg string,
|
||||
handleResult int32,
|
||||
member *relationtb.GroupMemberModel,
|
||||
) error
|
||||
PageGroupRequest(ctx context.Context, groupIDs []string, pageNumber, showNumber int32) (uint32, []*relationtb.GroupRequestModel, error)
|
||||
|
||||
PageGetJoinGroup(ctx context.Context, userID string, pageNumber, showNumber int32) (total uint32, totalGroupMembers []*relationtb.GroupMemberModel, err error)
|
||||
PageGetGroupMember(ctx context.Context, groupID string, pageNumber, showNumber int32) (total uint32, totalGroupMembers []*relationtb.GroupMemberModel, err error)
|
||||
SearchGroupMember(ctx context.Context, keyword string, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (uint32, []*relationtb.GroupMemberModel, error)
|
||||
HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relationtb.GroupMemberModel) error
|
||||
DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error
|
||||
MapGroupMemberUserID(ctx context.Context, groupIDs []string) (map[string]*relationtb.GroupSimpleUserID, error)
|
||||
MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error)
|
||||
TransferGroupOwner(
|
||||
ctx context.Context,
|
||||
groupID string,
|
||||
oldOwnerUserID, newOwnerUserID string,
|
||||
roleLevel int32,
|
||||
) error // 转让群
|
||||
TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string, roleLevel int32) error // 转让群
|
||||
UpdateGroupMember(ctx context.Context, groupID string, userID string, data map[string]any) error
|
||||
UpdateGroupMembers(ctx context.Context, data []*relationtb.BatchUpdateGroupMember) error
|
||||
// GroupRequest
|
||||
CreateGroupRequest(ctx context.Context, requests []*relationtb.GroupRequestModel) error
|
||||
TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relationtb.GroupRequestModel, error)
|
||||
FindGroupRequests(ctx context.Context, groupID string, userIDs []string) (int64, []*relationtb.GroupRequestModel, error)
|
||||
PageGroupRequestUser(
|
||||
ctx context.Context,
|
||||
userID string,
|
||||
pageNumber, showNumber int32,
|
||||
) (uint32, []*relationtb.GroupRequestModel, error)
|
||||
PageGroupRequestUser(ctx context.Context, userID string, pageNumber, showNumber int32) (uint32, []*relationtb.GroupRequestModel, error)
|
||||
// SuperGroupModelInterface
|
||||
FindSuperGroup(ctx context.Context, groupIDs []string) ([]*unrelationtb.SuperGroupModel, error)
|
||||
FindJoinSuperGroup(ctx context.Context, userID string) ([]string, error)
|
||||
@@ -310,12 +261,22 @@ func (g *groupDatabase) PageGroupRequest(
|
||||
return g.groupRequestDB.PageGroup(ctx, groupIDs, pageNumber, showNumber)
|
||||
}
|
||||
|
||||
func (g *groupDatabase) FindGroupMember(
|
||||
ctx context.Context,
|
||||
groupIDs []string,
|
||||
userIDs []string,
|
||||
roleLevels []int32,
|
||||
) (totalGroupMembers []*relationtb.GroupMemberModel, err error) {
|
||||
func (g *groupDatabase) FindGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) (totalGroupMembers []*relationtb.GroupMemberModel, err error) {
|
||||
if len(groupIDs) == 0 && len(roleLevels) == 0 && len(userIDs) == 1 {
|
||||
gIDs, err := g.cache.GetJoinedGroupIDs(ctx, userIDs[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var res []*relationtb.GroupMemberModel
|
||||
for _, groupID := range gIDs {
|
||||
v, err := g.cache.GetGroupMemberInfo(ctx, groupID, userIDs[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = append(res, v)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
if len(roleLevels) == 0 {
|
||||
for _, groupID := range groupIDs {
|
||||
groupMembers, err := g.cache.GetGroupMembersInfo(ctx, groupID, userIDs)
|
||||
@@ -451,13 +412,8 @@ func (g *groupDatabase) MapGroupMemberNum(ctx context.Context, groupIDs []string
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (g *groupDatabase) TransferGroupOwner(
|
||||
ctx context.Context,
|
||||
groupID string,
|
||||
oldOwnerUserID, newOwnerUserID string,
|
||||
roleLevel int32,
|
||||
) error {
|
||||
if err := g.tx.Transaction(func(tx any) error {
|
||||
func (g *groupDatabase) TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string, roleLevel int32) error {
|
||||
return g.tx.Transaction(func(tx any) error {
|
||||
rowsAffected, err := g.groupMemberDB.NewTx(tx).UpdateRoleLevel(ctx, groupID, oldOwnerUserID, roleLevel)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -472,11 +428,8 @@ func (g *groupDatabase) TransferGroupOwner(
|
||||
if rowsAffected != 1 {
|
||||
return utils.Wrap(fmt.Errorf("newOwnerUserID %s rowsAffected = %d", newOwnerUserID, rowsAffected), "")
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return g.cache.DelGroupMembersInfo(groupID, oldOwnerUserID, newOwnerUserID).ExecDel(ctx)
|
||||
return g.cache.DelGroupMembersInfo(groupID, oldOwnerUserID, newOwnerUserID).DelGroupMembersHash(groupID).ExecDel(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
func (g *groupDatabase) UpdateGroupMember(
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// 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.
|
||||
|
||||
package kafka
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// 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.
|
||||
|
||||
package tls
|
||||
|
||||
import (
|
||||
|
||||
@@ -208,3 +208,10 @@ func (g *GroupRpcClient) DismissGroup(ctx context.Context, groupID string) error
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (g *GroupRpcClient) NotificationUserInfoUpdate(ctx context.Context, userID string) error {
|
||||
_, err := g.Client.NotificationUserInfoUpdate(ctx, &group.NotificationUserInfoUpdateReq{
|
||||
UserID: userID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -147,7 +147,10 @@ func (u *UserRpcClient) GetUserGlobalMsgRecvOpt(ctx context.Context, userID stri
|
||||
resp, err := u.Client.GetGlobalRecvMessageOpt(ctx, &user.GetGlobalRecvMessageOptReq{
|
||||
UserID: userID,
|
||||
})
|
||||
return resp.GlobalRecvMsgOpt, err
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return resp.GlobalRecvMsgOpt, nil
|
||||
}
|
||||
|
||||
// Access verifies the access rights for the provided user ID.
|
||||
|
||||
@@ -100,7 +100,7 @@ O:::::::OOO:::::::O p:::::ppppp:::::::pe::::::::e n::::n n::::nII:
|
||||
# Set text color to yellow for the Slack link
|
||||
echo -e "\033[1;33m"
|
||||
|
||||
print_with_delay "Join our developer community on Slack: https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg" 0.01
|
||||
print_with_delay "Join our developer community on Slack: https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" 0.01
|
||||
|
||||
# Reset text color back to normal
|
||||
echo -e "\033[0m"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# package, the build will produce executable files under $(OUT_DIR)/bin/platforms OR $(OUT_DIR)/bin—tools/platforms.
|
||||
# If not specified, "everything" will be built.
|
||||
# Usage: `scripts/build-all-service.sh`.
|
||||
# Example: `hack/build-go.sh WHAT=cmd/kubelet`.
|
||||
# Example: `scripts/build-go.sh WHAT=cmd/kubelet`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
@@ -28,6 +28,8 @@ source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
OPENIM_VERBOSE=4
|
||||
|
||||
openim::log::info "\n# Begin to check all openim service"
|
||||
|
||||
# OpenIM status
|
||||
# Elegant printing function
|
||||
print_services_and_ports() {
|
||||
@@ -55,7 +57,7 @@ print_services_and_ports OPENIM_DEPENDENCY_TARGETS OPENIM_DEPENDENCY_PORT_TARGET
|
||||
|
||||
# OpenIM check
|
||||
echo "++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
echo "## Check all dependent service ports"
|
||||
openim::log::info "\n## Check all dependent service ports"
|
||||
echo "+++ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}"
|
||||
|
||||
set +e
|
||||
@@ -69,10 +71,10 @@ else
|
||||
fi
|
||||
set -e
|
||||
|
||||
echo -e "\n## Check OpenIM service name"
|
||||
openim::log::info "\n## Check OpenIM service name"
|
||||
. $(dirname ${BASH_SOURCE})/install/openim-msgtransfer.sh openim::msgtransfer::check
|
||||
|
||||
echo -e "\n## Check all OpenIM service ports"
|
||||
openim::log::info "\n## Check all OpenIM service ports"
|
||||
echo "+++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
openim::util::check_ports ${OPENIM_SERVER_PORT_LISTARIES[@]}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
|
||||
@@ -14,18 +14,24 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
#fixme This scripts is the total startup scripts
|
||||
#fixme The full name of the shell scripts that needs to be started is placed in the need_to_start_server_shell array
|
||||
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
openim::log::info "\n# Use Docker to start all openim service"
|
||||
|
||||
trap 'openim::util::onCtrlC' INT
|
||||
|
||||
nohup "${OPENIM_ROOT}"/scripts/start-all.sh >> ${LOG_FILE} 2>&1 &
|
||||
"${OPENIM_ROOT}"/scripts/start-all.sh
|
||||
|
||||
sleep 15
|
||||
sleep 5
|
||||
|
||||
nohup "${OPENIM_ROOT}"/scripts/check-all.sh >> ${LOG_FILE} 2>&1 &
|
||||
"${OPENIM_ROOT}"/scripts/check-all.sh
|
||||
|
||||
tail -f ${LOG_FILE}
|
||||
+16
-13
@@ -24,27 +24,30 @@ OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
|
||||
# 定义一个配置文件数组,其中包含需要生成的配置文件的名称路径 (en: Define a profile array that contains the name path of the profile to be generated.)
|
||||
readonly ENV_FILE=${ENV_FILE:-"${OPENIM_ROOT}"/scripts/install/environment.sh}
|
||||
# 定义一个配置文件数组,其中包含需要生成的配置文件的名称路径
|
||||
# (en: Define a profile array that contains the name path of the profile to be generated.)
|
||||
readonly ENV_FILE=${ENV_FILE:-"${OPENIM_ROOT}/scripts/install/environment.sh"}
|
||||
|
||||
# 定义关联数组,其中键是模板文件,值是对应的输出文件 (en: Defines an associative array where the keys are the template files and the values are the corresponding output files.)
|
||||
# 定义关联数组,其中键是模板文件,值是对应的输出文件
|
||||
# (en: Defines an associative array where the keys are the template files and the values are the corresponding output files.)
|
||||
declare -A TEMPLATES=(
|
||||
[""${OPENIM_ROOT}"/deployments/templates/env_template.yaml"]=""${OPENIM_ROOT}"/.env"
|
||||
[""${OPENIM_ROOT}"/deployments/templates/openim.yaml"]=""${OPENIM_ROOT}"/config/config.yaml"
|
||||
["${OPENIM_ROOT}/deployments/templates/env_template.yaml"]="${OPENIM_ROOT}/.env"
|
||||
["${OPENIM_ROOT}/deployments/templates/openim.yaml"]="${OPENIM_ROOT}/config/config.yaml"
|
||||
)
|
||||
|
||||
for template in "${!TEMPLATES[@]}"; do
|
||||
output_file=${TEMPLATES[$template]}
|
||||
|
||||
if [[ ! -f "${template}" ]]; then
|
||||
openim::log::error_exit "template file ${template} does not exist..."
|
||||
fi
|
||||
|
||||
openim::log::info "⌚ Working with template file: ${template} to ${output_file}..."
|
||||
""${OPENIM_ROOT}"/scripts/genconfig.sh" "${ENV_FILE}" "${template}" > "${output_file}" || {
|
||||
openim::log::error "Error processing template file ${template}"
|
||||
exit 1
|
||||
}
|
||||
IFS=';' read -ra OUTPUT_FILES <<< "${TEMPLATES[$template]}"
|
||||
for output_file in "${OUTPUT_FILES[@]}"; do
|
||||
openim::log::info "⌚ Working with template file: ${template} to ${output_file}..."
|
||||
"${OPENIM_ROOT}/scripts/genconfig.sh" "${ENV_FILE}" "${template}" > "${output_file}" || {
|
||||
openim::log::error "Error processing template file ${template}"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
done
|
||||
|
||||
openim::log::success "✨ All configuration files have been successfully generated!"
|
||||
openim::log::success "✨ All configuration files have been successfully generated!"
|
||||
|
||||
@@ -22,6 +22,8 @@ set -o pipefail
|
||||
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd -P)
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
openim::log::info "\n# Begin Install OpenIM Config"
|
||||
|
||||
for file in "${OPENIM_SERVER_TARGETS[@]}"; do
|
||||
VARNAME="$(echo $file | tr '[:lower:]' '[:upper:]' | tr '.' '_' | tr '-' '_')"
|
||||
VARVALUE="$OPENIM_OUTPUT_HOSTBIN/$file"
|
||||
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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.
|
||||
#
|
||||
# -----------------------------------------------------------------------------
|
||||
# init-githooks.sh
|
||||
#
|
||||
# This script assists in managing Git hooks for the OpenIM project.
|
||||
# When executed:
|
||||
# 1. It prompts the user to enable git hooks.
|
||||
# 2. If the user accepts, it copies predefined hook scripts to the appropriate
|
||||
# Git directory, making them executable.
|
||||
# 3. If requested, it can delete the added hooks.
|
||||
#
|
||||
# This script equal runs `make init-githooks` command.
|
||||
# Usage:
|
||||
# ./init-githooks.sh Prompt to enable git hooks.
|
||||
# ./init-githooks.sh --delete Delete previously added git hooks.
|
||||
# ./init-githooks.sh --help Show the help message.
|
||||
#
|
||||
# Example: `scripts/build-go.sh --help`.
|
||||
# Documentation & related context can be found at:
|
||||
# https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694
|
||||
#
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
HOOKS_DIR=".git/hooks"
|
||||
|
||||
help_info() {
|
||||
echo "Usage: $0 [options]"
|
||||
echo
|
||||
echo "This script helps to manage git hooks."
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -h, --help Show this help message and exit."
|
||||
echo " -d, --delete Delete the hooks that have been added."
|
||||
echo " By default, it will prompt to enable git hooks."
|
||||
}
|
||||
|
||||
delete_hooks() {
|
||||
for file in scripts/githooks/*.sh; do
|
||||
hook_name=$(basename "$file" .sh)
|
||||
rm -f "$HOOKS_DIR/$hook_name"
|
||||
done
|
||||
echo "Git hooks have been deleted."
|
||||
}
|
||||
|
||||
enable_hooks() {
|
||||
echo "Would you like to enable git hooks mode? [y/n]"
|
||||
read -r choice
|
||||
|
||||
if [[ $choice == "y" || $choice == "Y" ]]; then
|
||||
for file in scripts/githooks/*.sh; do
|
||||
cp -f "$file" "$HOOKS_DIR/$(basename "$file" .sh)"
|
||||
done
|
||||
|
||||
chmod +x $HOOKS_DIR/*
|
||||
|
||||
echo "Git hooks mode has been enabled."
|
||||
echo "With git hooks enabled, every time you perform a git action (e.g. git commit), the corresponding hooks script will be triggered automatically."
|
||||
echo "This means that if the size of the file you're committing exceeds the set limit (e.g. 42MB), the commit will be rejected."
|
||||
else
|
||||
echo "Git hooks mode remains disabled."
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
help_info
|
||||
;;
|
||||
-d|--delete)
|
||||
delete_hooks
|
||||
;;
|
||||
*)
|
||||
enable_hooks
|
||||
;;
|
||||
esac
|
||||
@@ -27,7 +27,7 @@ source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
#TODO
|
||||
# IP=http://127.0.0.1
|
||||
if [ -z "${IP}" ]; then
|
||||
IP=$(openim::util::get_server_ip)
|
||||
IP=$(openim::util::get_server_ip)
|
||||
fi
|
||||
|
||||
function def() {
|
||||
@@ -38,6 +38,8 @@ function def() {
|
||||
|
||||
# app要能访问到此ip和端口或域名
|
||||
def "API_URL" "http://${IP}:10002"
|
||||
|
||||
# OpenIM Docker Compose 数据存储的默认路径
|
||||
def "DATA_DIR" "${OPENIM_ROOT}"
|
||||
|
||||
# 设置统一的用户名,方便记忆
|
||||
@@ -59,6 +61,11 @@ mkdir -p ${INSTALL_DIR}
|
||||
|
||||
def "ENV_FILE" ""${OPENIM_ROOT}"/scripts/install/environment.sh"
|
||||
|
||||
###################### Docker compose ###################
|
||||
# OPENIM AND CHAT
|
||||
def "CHAT_BRANCH" "main"
|
||||
def "SERVER_BRANCH" "main"
|
||||
|
||||
###################### openim 配置 ######################
|
||||
# read: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
def "OPENIM_DATA_DIR" "/data/openim"
|
||||
@@ -68,78 +75,83 @@ def "OPENIM_LOG_DIR" "/var/log/openim"
|
||||
def "CA_FILE" "${OPENIM_CONFIG_DIR}/cert/ca.pem"
|
||||
|
||||
def "OPNEIM_CONFIG" ""${OPENIM_ROOT}"/config"
|
||||
|
||||
# OpenIM Web
|
||||
def "OPENIM_WEB_DIST_PATH" "/app/dist"
|
||||
def "OPENIM_WEB_PPRT" "11001"
|
||||
|
||||
# TODO 注意: 一般的配置都可以使用 def 函数来定义,如果是包含特殊字符,比如说:
|
||||
# TODO readonly MSG_DESTRUCT_TIME=${MSG_DESTRUCT_TIME:-'0 2 * * *'}
|
||||
# TODO 使用 readonly 来定义合适,负责无法正常解析, 并且 yaml 模板需要加 "" 来包裹
|
||||
|
||||
###################### Zookeeper 配置信息 ######################
|
||||
def "ZOOKEEPER_SCHEMA" "openim" # Zookeeper的模式
|
||||
def "ZOOKEEPER_PORT" "2181" # Zookeeper的端口
|
||||
def "ZOOKEEPER_ADDRESS" "127.0.0.1" # Zookeeper的地址
|
||||
def "ZOOKEEPER_USERNAME" "" # Zookeeper的用户名
|
||||
def "ZOOKEEPER_PASSWORD" "" # Zookeeper的密码
|
||||
def "ZOOKEEPER_SCHEMA" "openim" # Zookeeper的模式
|
||||
def "ZOOKEEPER_PORT" "2181" # Zookeeper的端口
|
||||
def "ZOOKEEPER_ADDRESS" "127.0.0.1" # Zookeeper的地址
|
||||
def "ZOOKEEPER_USERNAME" "" # Zookeeper的用户名
|
||||
def "ZOOKEEPER_PASSWORD" "" # Zookeeper的密码
|
||||
|
||||
###################### MySQL 配置信息 ######################
|
||||
def "MYSQL_PORT" "13306" # MySQL的端口
|
||||
def "MYSQL_ADDRESS" "127.0.0.1" # MySQL的地址
|
||||
def "MYSQL_USERNAME" "${USER}" # MySQL的用户名
|
||||
def "MYSQL_PASSWORD" "${PASSWORD}" # MySQL的密码
|
||||
def "MYSQL_DATABASE" "${DATABASE_NAME}" # MySQL的数据库名
|
||||
def "MYSQL_MAX_OPEN_CONN" "1000" # 最大打开的连接数
|
||||
def "MYSQL_MAX_IDLE_CONN" "100" # 最大空闲连接数
|
||||
def "MYSQL_MAX_LIFETIME" "60" # 连接可以重用的最大生命周期(秒)
|
||||
def "MYSQL_LOG_LEVEL" "4" # 日志级别
|
||||
def "MYSQL_SLOW_THRESHOLD" "500" # 慢查询阈值(毫秒)
|
||||
def "MYSQL_PORT" "13306" # MySQL的端口
|
||||
def "MYSQL_ADDRESS" "127.0.0.1" # MySQL的地址
|
||||
def "MYSQL_USERNAME" "${USER}" # MySQL的用户名
|
||||
def "MYSQL_PASSWORD" "${PASSWORD}" # MySQL的密码
|
||||
def "MYSQL_DATABASE" "${DATABASE_NAME}" # MySQL的数据库名
|
||||
def "MYSQL_MAX_OPEN_CONN" "1000" # 最大打开的连接数
|
||||
def "MYSQL_MAX_IDLE_CONN" "100" # 最大空闲连接数
|
||||
def "MYSQL_MAX_LIFETIME" "60" # 连接可以重用的最大生命周期(秒)
|
||||
def "MYSQL_LOG_LEVEL" "4" # 日志级别
|
||||
def "MYSQL_SLOW_THRESHOLD" "500" # 慢查询阈值(毫秒)
|
||||
|
||||
###################### MongoDB 配置信息 ######################
|
||||
def "MONGO_URI" # MongoDB的URI
|
||||
def "MONGO_PORT" "37017" # MongoDB的端口
|
||||
def "MONGO_ADDRESS" "127.0.0.1" # MongoDB的地址
|
||||
def "MONGO_DATABASE" "${DATABASE_NAME}" # MongoDB的数据库名
|
||||
def "MONGO_USERNAME" "${USER}" # MongoDB的用户名
|
||||
def "MONGO_PASSWORD" "${PASSWORD}" # MongoDB的密码
|
||||
def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小
|
||||
def "MONGO_URI" # MongoDB的URI
|
||||
def "MONGO_PORT" "37017" # MongoDB的端口
|
||||
def "MONGO_ADDRESS" "127.0.0.1" # MongoDB的地址
|
||||
def "MONGO_DATABASE" "${DATABASE_NAME}" # MongoDB的数据库名
|
||||
def "MONGO_USERNAME" "${USER}" # MongoDB的用户名
|
||||
def "MONGO_PASSWORD" "${PASSWORD}" # MongoDB的密码
|
||||
def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小
|
||||
|
||||
###################### Object 配置信息 ######################
|
||||
def "OBJECT_ENABLE" "minio" # 对象是否启用
|
||||
def "OBJECT_APIURL" "http://${IP}:10002" # 对象的API地址
|
||||
def "MINIO_BUCKET" "openim" # MinIO的存储桶名称
|
||||
def "MINIO_PORT" "10005" # MinIO的端口
|
||||
def "OBJECT_ENABLE" "minio" # 对象是否启用
|
||||
def "OBJECT_APIURL" "http://${IP}:10002" # 对象的API地址
|
||||
def "MINIO_BUCKET" "openim" # MinIO的存储桶名称
|
||||
def "MINIO_PORT" "10005" # MinIO的端口
|
||||
# MinIO的端点URL
|
||||
readonly MINIO_ENDPOINT=${MINIO_ENDPOINT:-"http://127.0.0.1:${MINIO_PORT}"}
|
||||
def "MINIO_ACCESS_KEY" "${USER}" # MinIO的访问密钥ID
|
||||
def "MINIO_SECRET_KEY" "${PASSWORD}" # MinIO的密钥
|
||||
def "MINIO_SESSION_TOKEN" # MinIO的会话令牌
|
||||
def "MINIO_ACCESS_KEY" "${USER}" # MinIO的访问密钥ID
|
||||
def "MINIO_SECRET_KEY" "${PASSWORD}" # MinIO的密钥
|
||||
def "MINIO_SESSION_TOKEN" # MinIO的会话令牌
|
||||
readonly MINIO_SIGN_ENDPOINT=${MINIO_SIGN_ENDPOINT:-"http://${IP}:${MINIO_PORT}"} # signEndpoint为minio公网地址 # MinIO的会话令牌
|
||||
def "COS_BUCKET_URL" "https://temp-1252357374.cos.ap-chengdu.myqcloud.com" # 腾讯云COS的存储桶URL
|
||||
def "COS_SECRET_ID" # 腾讯云COS的密钥ID
|
||||
def "COS_SECRET_KEY" # 腾讯云COS的密钥
|
||||
def "COS_SESSION_TOKEN" # 腾讯云COS的会话令牌
|
||||
def "OSS_ENDPOINT" "https://oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的端点URL
|
||||
def "OSS_BUCKET" "demo-9999999" # 阿里云OSS的存储桶名称
|
||||
def "OSS_BUCKET_URL" "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的存储桶URL
|
||||
def "OSS_ACCESS_KEY_ID" # 阿里云OSS的访问密钥ID
|
||||
def "OSS_ACCESS_KEY_SECRET" # 阿里云OSS的密钥
|
||||
def "OSS_SESSION_TOKEN" # 阿里云OSS的会话令牌
|
||||
def "COS_BUCKET_URL" "https://temp-1252357374.cos.ap-chengdu.myqcloud.com" # 腾讯云COS的存储桶URL
|
||||
def "COS_SECRET_ID" # 腾讯云COS的密钥ID
|
||||
def "COS_SECRET_KEY" # 腾讯云COS的密钥
|
||||
def "COS_SESSION_TOKEN" # 腾讯云COS的会话令牌
|
||||
def "OSS_ENDPOINT" "https://oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的端点URL
|
||||
def "OSS_BUCKET" "demo-9999999" # 阿里云OSS的存储桶名称
|
||||
def "OSS_BUCKET_URL" "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的存储桶URL
|
||||
def "OSS_ACCESS_KEY_ID" # 阿里云OSS的访问密钥ID
|
||||
def "OSS_ACCESS_KEY_SECRET" # 阿里云OSS的密钥
|
||||
def "OSS_SESSION_TOKEN" # 阿里云OSS的会话令牌
|
||||
|
||||
###################### Redis 配置信息 ######################
|
||||
def "REDIS_PORT" "16379" # Redis的端口
|
||||
def "REDIS_PORT" "16379" # Redis的端口
|
||||
def "REDIS_ADDRESS" "127.0.0.1" # Redis的地址
|
||||
def "REDIS_USERNAME" # Redis的用户名
|
||||
def "REDIS_PASSWORD" "${PASSWORD}" # Redis的密码
|
||||
|
||||
###################### Kafka 配置信息 ######################
|
||||
def "KAFKA_USERNAME" # Kafka的用户名
|
||||
def "KAFKA_PASSWORD" # Kafka的密码
|
||||
def "KAFKA_PORT" "9092" # Kafka的端口
|
||||
def "KAFKA_ADDR" "127.0.0.1" # Kafka的地址
|
||||
def "KAFKA_LATESTMSG_REDIS_TOPIC" "latestMsgToRedis" # Kafka的最新消息到Redis的主题
|
||||
def "KAFKA_OFFLINEMSG_MONGO_TOPIC" "offlineMsgToMongoMysql" # Kafka的离线消息到Mongo的主题
|
||||
def "KAFKA_MSG_PUSH_TOPIC" "msgToPush" # Kafka的消息到推送的主题
|
||||
def "KAFKA_CONSUMERGROUPID_REDIS" "redis" # Kafka的消费组ID到Redis
|
||||
def "KAFKA_CONSUMERGROUPID_MONGO" "mongo" # Kafka的消费组ID到Mongo
|
||||
def "KAFKA_CONSUMERGROUPID_MYSQL" "mysql" # Kafka的消费组ID到MySql
|
||||
def "KAFKA_CONSUMERGROUPID_PUSH" "push" # Kafka的消费组ID到推送
|
||||
def "KAFKA_USERNAME" # `Kafka` 的用户名
|
||||
def "KAFKA_PASSWORD" # `Kafka` 的密码
|
||||
def "KAFKA_PORT" "9092" # `Kafka` 的端口
|
||||
def "KAFKA_ADDR" "127.0.0.1" # `Kafka` 的地址
|
||||
def "KAFKA_LATESTMSG_REDIS_TOPIC" "latestMsgToRedis" # `Kafka` 的最新消息到Redis的主题
|
||||
def "KAFKA_OFFLINEMSG_MONGO_TOPIC" "offlineMsgToMongoMysql" # `Kafka` 的离线消息到Mongo的主题
|
||||
def "KAFKA_MSG_PUSH_TOPIC" "msgToPush" # `Kafka` 的消息到推送的主题
|
||||
def "KAFKA_CONSUMERGROUPID_REDIS" "redis" # `Kafka` 的消费组ID到Redis
|
||||
def "KAFKA_CONSUMERGROUPID_MONGO" "mongo" # `Kafka` 的消费组ID到Mongo
|
||||
def "KAFKA_CONSUMERGROUPID_MYSQL" "mysql" # `Kafka` 的消费组ID到MySql
|
||||
def "KAFKA_CONSUMERGROUPID_PUSH" "push" # `Kafka` 的消费组ID到推送
|
||||
|
||||
###################### RPC 配置信息 ######################
|
||||
def "RPC_REGISTER_IP" # RPC的注册IP
|
||||
@@ -175,24 +187,24 @@ readonly OPENIM_CONVERSATION_PORT=${OPENIM_CONVERSATION_PORT:-'10180'}
|
||||
readonly OPENIM_THIRD_PORT=${OPENIM_THIRD_PORT:-'10190'}
|
||||
|
||||
###################### RPC Register Name Variables ######################
|
||||
def "OPENIM_USER_NAME" "User" # OpenIM用户服务名称
|
||||
def "OPENIM_FRIEND_NAME" "Friend" # OpenIM朋友服务名称
|
||||
def "OPENIM_MSG_NAME" "Msg" # OpenIM消息服务名称
|
||||
def "OPENIM_PUSH_NAME" "Push" # OpenIM推送服务名称
|
||||
def "OPENIM_MESSAGE_GATEWAY_NAME" "MessageGateway" # OpenIM消息网关服务名称
|
||||
def "OPENIM_GROUP_NAME" "Group" # OpenIM组服务名称
|
||||
def "OPENIM_AUTH_NAME" "Auth" # OpenIM授权服务名称
|
||||
def "OPENIM_CONVERSATION_NAME" "Conversation" # OpenIM对话服务名称
|
||||
def "OPENIM_THIRD_NAME" "Third" # OpenIM第三方服务名称
|
||||
def "OPENIM_USER_NAME" "User" # OpenIM用户服务名称
|
||||
def "OPENIM_FRIEND_NAME" "Friend" # OpenIM朋友服务名称
|
||||
def "OPENIM_MSG_NAME" "Msg" # OpenIM消息服务名称
|
||||
def "OPENIM_PUSH_NAME" "Push" # OpenIM推送服务名称
|
||||
def "OPENIM_MESSAGE_GATEWAY_NAME" "MessageGateway" # OpenIM消息网关服务名称
|
||||
def "OPENIM_GROUP_NAME" "Group" # OpenIM组服务名称
|
||||
def "OPENIM_AUTH_NAME" "Auth" # OpenIM授权服务名称
|
||||
def "OPENIM_CONVERSATION_NAME" "Conversation" # OpenIM对话服务名称
|
||||
def "OPENIM_THIRD_NAME" "Third" # OpenIM第三方服务名称
|
||||
|
||||
###################### Log Configuration Variables ######################
|
||||
def "LOG_STORAGE_LOCATION" ""${OPENIM_ROOT}"/logs/" # 日志存储位置
|
||||
def "LOG_ROTATION_TIME" "24" # 日志轮替时间
|
||||
def "LOG_REMAIN_ROTATION_COUNT" "2" # 保留的日志轮替数量
|
||||
def "LOG_REMAIN_LOG_LEVEL" "6" # 保留的日志级别
|
||||
def "LOG_IS_STDOUT" "false" # 是否将日志输出到标准输出
|
||||
def "LOG_IS_JSON" "false" # 日志是否为JSON格式
|
||||
def "LOG_WITH_STACK" "false" # 日志是否带有堆栈信息
|
||||
def "LOG_ROTATION_TIME" "24" # 日志轮替时间
|
||||
def "LOG_REMAIN_ROTATION_COUNT" "2" # 保留的日志轮替数量
|
||||
def "LOG_REMAIN_LOG_LEVEL" "6" # 保留的日志级别
|
||||
def "LOG_IS_STDOUT" "false" # 是否将日志输出到标准输出
|
||||
def "LOG_IS_JSON" "false" # 日志是否为JSON格式
|
||||
def "LOG_WITH_STACK" "false" # 日志是否带有堆栈信息
|
||||
|
||||
###################### Variables definition ######################
|
||||
# OpenIM WS端口
|
||||
@@ -224,15 +236,15 @@ def "RETAIN_CHAT_RECORDS" "365" # 保留聊天记录
|
||||
readonly CHAT_RECORDS_CLEAR_TIME=${CHAT_RECORDS_CLEAR_TIME:-'0 2 * * 3'}
|
||||
# 消息销毁时间
|
||||
readonly MSG_DESTRUCT_TIME=${MSG_DESTRUCT_TIME:-'0 2 * * *'}
|
||||
def "SECRET" "${PASSWORD}" # 密钥
|
||||
def "TOKEN_EXPIRE" "90" # Token到期时间
|
||||
def "FRIEND_VERIFY" "false" # 朋友验证
|
||||
def "IOS_PUSH_SOUND" "xxx" # IOS推送声音
|
||||
def "IOS_BADGE_COUNT" "true" # IOS徽章计数
|
||||
def "IOS_PRODUCTION" "false" # IOS生产
|
||||
def "SECRET" "${PASSWORD}" # 密钥
|
||||
def "TOKEN_EXPIRE" "90" # Token到期时间
|
||||
def "FRIEND_VERIFY" "false" # 朋友验证
|
||||
def "IOS_PUSH_SOUND" "xxx" # IOS推送声音
|
||||
def "IOS_BADGE_COUNT" "true" # IOS徽章计数
|
||||
def "IOS_PRODUCTION" "false" # IOS生产
|
||||
|
||||
###################### Prometheus 配置信息 ######################
|
||||
def "PROMETHEUS_ENABLE" "false" # 是否启用 Prometheus
|
||||
def "PROMETHEUS_ENABLE" "false" # 是否启用 Prometheus
|
||||
# User 服务的 Prometheus 端口
|
||||
readonly USER_PROM_PORT=${USER_PROM_PORT:-'20110'}
|
||||
# Friend 服务的 Prometheus 端口
|
||||
@@ -260,7 +272,7 @@ readonly MSG_TRANSFER_PROM_PORT=${MSG_TRANSFER_PROM_PORT:-'21400, 21401, 21402,
|
||||
###################### OpenIM openim-api ######################
|
||||
def "OPENIM_API_HOST" "127.0.0.1"
|
||||
def "OPENIM_API_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-api" # OpenIM openim-api 二进制文件路径
|
||||
def "OPENIM_API_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-api 配置文件路径
|
||||
def "OPENIM_API_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-api 配置文件路径
|
||||
def "OPENIM_API_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-api" # OpenIM openim-api 日志存储路径
|
||||
def "OPENIM_API_LOG_LEVEL" "info" # OpenIM openim-api 日志级别
|
||||
def "OPENIM_API_LOG_MAX_SIZE" "100" # OpenIM openim-api 日志最大大小(MB)
|
||||
@@ -272,7 +284,7 @@ def "OPENIM_API_LOG_WITH_STACK" "${LOG_WITH_STACK}" # OpenIM openim-ap
|
||||
###################### OpenIM openim-cmdutils ######################
|
||||
def "OPENIM_CMDUTILS_HOST" "127.0.0.1"
|
||||
def "OPENIM_CMDUTILS_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-cmdutils" # OpenIM openim-cmdutils 二进制文件路径
|
||||
def "OPENIM_CMDUTILS_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-cmdutils 配置文件路径
|
||||
def "OPENIM_CMDUTILS_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-cmdutils 配置文件路径
|
||||
def "OPENIM_CMDUTILS_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-cmdutils" # OpenIM openim-cmdutils 日志存储路径
|
||||
def "OPENIM_CMDUTILS_LOG_LEVEL" "info" # OpenIM openim-cmdutils 日志级别
|
||||
def "OPENIM_CMDUTILS_LOG_MAX_SIZE" "100" # OpenIM openim-cmdutils 日志最大大小(MB)
|
||||
@@ -284,7 +296,7 @@ def "OPENIM_CMDUTILS_LOG_WITH_STACK" "${LOG_WITH_STACK}" # OpenIM
|
||||
###################### OpenIM openim-crontask ######################
|
||||
def "OPENIM_CRONTASK_HOST" "127.0.0.1"
|
||||
def "OPENIM_CRONTASK_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-crontask" # OpenIM openim-crontask 二进制文件路径
|
||||
def "OPENIM_CRONTASK_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-crontask 配置文件路径
|
||||
def "OPENIM_CRONTASK_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-crontask 配置文件路径
|
||||
def "OPENIM_CRONTASK_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-crontask" # OpenIM openim-crontask 日志存储路径
|
||||
def "OPENIM_CRONTASK_LOG_LEVEL" "info" # OpenIM openim-crontask 日志级别
|
||||
def "OPENIM_CRONTASK_LOG_MAX_SIZE" "100" # OpenIM openim-crontask 日志最大大小(MB)
|
||||
@@ -311,7 +323,7 @@ readonly OPENIM_MSGGATEWAY_NUM=${OPENIM_MSGGATEWAY_NUM:-'4'}
|
||||
###################### OpenIM openim-msgtransfer ######################
|
||||
def "OPENIM_MSGTRANSFER_HOST" "127.0.0.1"
|
||||
def "OPENIM_MSGTRANSFER_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-msgtransfer" # OpenIM openim-msgtransfer 二进制文件路径
|
||||
def "OPENIM_MSGTRANSFER_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-msgtransfer 配置文件路径
|
||||
def "OPENIM_MSGTRANSFER_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-msgtransfer 配置文件路径
|
||||
def "OPENIM_MSGTRANSFER_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-msgtransfer" # OpenIM openim-msgtransfer 日志存储路径
|
||||
def "OPENIM_MSGTRANSFER_LOG_LEVEL" "info" # OpenIM openim-msgtransfer 日志级别
|
||||
def "OPENIM_MSGTRANSFER_LOG_MAX_SIZE" "100" # OpenIM openim-msgtransfer 日志最大大小(MB)
|
||||
@@ -323,7 +335,7 @@ def "OPENIM_MSGTRANSFER_LOG_WITH_STACK" "${LOG_WITH_STACK}" #
|
||||
###################### OpenIM openim-push ######################
|
||||
def "OPENIM_PUSH_HOST" "127.0.0.1"
|
||||
def "OPENIM_PUSH_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-push" # OpenIM openim-push 二进制文件路径
|
||||
def "OPENIM_PUSH_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-push 配置文件路径
|
||||
def "OPENIM_PUSH_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-push 配置文件路径
|
||||
def "OPENIM_PUSH_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-push" # OpenIM openim-push 日志存储路径
|
||||
def "OPENIM_PUSH_LOG_LEVEL" "info" # OpenIM openim-push 日志级别
|
||||
def "OPENIM_PUSH_LOG_MAX_SIZE" "100" # OpenIM openim-push 日志最大大小(MB)
|
||||
@@ -335,7 +347,7 @@ def "OPENIM_PUSH_LOG_WITH_STACK" "${LOG_WITH_STACK}" # OpenIM openim-
|
||||
###################### OpenIM openim-rpc-auth ######################
|
||||
def "OPENIM_RPC_AUTH_HOST" "127.0.0.1"
|
||||
def "OPENIM_RPC_AUTH_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-rpc-auth" # OpenIM openim-rpc-auth 二进制文件路径
|
||||
def "OPENIM_RPC_AUTH_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-auth 配置文件路径
|
||||
def "OPENIM_RPC_AUTH_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-auth 配置文件路径
|
||||
def "OPENIM_RPC_AUTH_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-rpc-auth" # OpenIM openim-rpc-auth 日志存储路径
|
||||
def "OPENIM_RPC_AUTH_LOG_LEVEL" "info" # OpenIM openim-rpc-auth 日志级别
|
||||
def "OPENIM_RPC_AUTH_LOG_MAX_SIZE" "100" # OpenIM openim-rpc-auth 日志最大大小(MB)
|
||||
@@ -347,7 +359,7 @@ def "OPENIM_RPC_AUTH_LOG_WITH_STACK" "${LOG_WITH_STACK}" # OpenIM
|
||||
###################### OpenIM openim-rpc-conversation ######################
|
||||
def "OPENIM_RPC_CONVERSATION_HOST" "127.0.0.1"
|
||||
def "OPENIM_RPC_CONVERSATION_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-rpc-conversation" # OpenIM openim-rpc-conversation 二进制文件路径
|
||||
def "OPENIM_RPC_CONVERSATION_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-conversation 配置文件路径
|
||||
def "OPENIM_RPC_CONVERSATION_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-conversation 配置文件路径
|
||||
def "OPENIM_RPC_CONVERSATION_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-rpc-conversation" # OpenIM openim-rpc-conversation 日志存储路径
|
||||
def "OPENIM_RPC_CONVERSATION_LOG_LEVEL" "info" # OpenIM openim-rpc-conversation 日志级别
|
||||
def "OPENIM_RPC_CONVERSATION_LOG_MAX_SIZE" "100" # OpenIM openim-rpc-conversation 日志最大大小(MB)
|
||||
@@ -359,7 +371,7 @@ def "OPENIM_RPC_CONVERSATION_LOG_WITH_STACK" "${LOG_WITH_STACK}"
|
||||
###################### OpenIM openim-rpc-friend ######################
|
||||
def "OPENIM_RPC_FRIEND_HOST" "127.0.0.1"
|
||||
def "OPENIM_RPC_FRIEND_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-rpc-friend" # OpenIM openim-rpc-friend 二进制文件路径
|
||||
def "OPENIM_RPC_FRIEND_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-friend 配置文件路径
|
||||
def "OPENIM_RPC_FRIEND_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-friend 配置文件路径
|
||||
def "OPENIM_RPC_FRIEND_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-rpc-friend" # OpenIM openim-rpc-friend 日志存储路径
|
||||
def "OPENIM_RPC_FRIEND_LOG_LEVEL" "info" # OpenIM openim-rpc-friend 日志级别
|
||||
def "OPENIM_RPC_FRIEND_LOG_MAX_SIZE" "100" # OpenIM openim-rpc-friend 日志最大大小(MB)
|
||||
@@ -371,7 +383,7 @@ def "OPENIM_RPC_FRIEND_LOG_WITH_STACK" "${LOG_WITH_STACK}" # Op
|
||||
###################### OpenIM openim-rpc-group ######################
|
||||
def "OPENIM_RPC_GROUP_HOST" "127.0.0.1"
|
||||
def "OPENIM_RPC_GROUP_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-rpc-group" # OpenIM openim-rpc-group 二进制文件路径
|
||||
def "OPENIM_RPC_GROUP_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-group 配置文件路径
|
||||
def "OPENIM_RPC_GROUP_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-group 配置文件路径
|
||||
def "OPENIM_RPC_GROUP_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-rpc-group" # OpenIM openim-rpc-group 日志存储路径
|
||||
def "OPENIM_RPC_GROUP_LOG_LEVEL" "info" # OpenIM openim-rpc-group 日志级别
|
||||
def "OPENIM_RPC_GROUP_LOG_MAX_SIZE" "100" # OpenIM openim-rpc-group 日志最大大小(MB)
|
||||
@@ -383,7 +395,7 @@ def "OPENIM_RPC_GROUP_LOG_WITH_STACK" "${LOG_WITH_STACK}" # Open
|
||||
###################### OpenIM openim-rpc-msg ######################
|
||||
def "OPENIM_RPC_MSG_HOST" "127.0.0.1"
|
||||
def "OPENIM_RPC_MSG_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-rpc-msg" # OpenIM openim-rpc-msg 二进制文件路径
|
||||
def "OPENIM_RPC_MSG_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-msg 配置文件路径
|
||||
def "OPENIM_RPC_MSG_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-msg 配置文件路径
|
||||
def "OPENIM_RPC_MSG_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-rpc-msg" # OpenIM openim-rpc-msg 日志存储路径
|
||||
def "OPENIM_RPC_MSG_LOG_LEVEL" "info" # OpenIM openim-rpc-msg 日志级别
|
||||
def "OPENIM_RPC_MSG_LOG_MAX_SIZE" "100" # OpenIM openim-rpc-msg 日志最大大小(MB)
|
||||
@@ -395,7 +407,7 @@ def "OPENIM_RPC_MSG_LOG_WITH_STACK" "${LOG_WITH_STACK}" # OpenIM o
|
||||
###################### OpenIM openim-rpc-third ######################
|
||||
def "OPENIM_RPC_THIRD_HOST" "127.0.0.1"
|
||||
def "OPENIM_RPC_THIRD_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-rpc-third" # OpenIM openim-rpc-third 二进制文件路径
|
||||
def "OPENIM_RPC_THIRD_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-third 配置文件路径
|
||||
def "OPENIM_RPC_THIRD_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-third 配置文件路径
|
||||
def "OPENIM_RPC_THIRD_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-rpc-third" # OpenIM openim-rpc-third 日志存储路径
|
||||
def "OPENIM_RPC_THIRD_LOG_LEVEL" "info" # OpenIM openim-rpc-third 日志级别
|
||||
def "OPENIM_RPC_THIRD_LOG_MAX_SIZE" "100" # OpenIM openim-rpc-third 日志最大大小(MB)
|
||||
@@ -407,7 +419,7 @@ def "OPENIM_RPC_THIRD_LOG_WITH_STACK" "${LOG_WITH_STACK}" # Open
|
||||
###################### OpenIM openim-rpc-user ######################
|
||||
def "OPENIM_RPC_USER_HOST" "127.0.0.1"
|
||||
def "OPENIM_RPC_USER_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-rpc-user" # OpenIM openim-rpc-user 二进制文件路径
|
||||
def "OPENIM_RPC_USER_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-user 配置文件路径
|
||||
def "OPENIM_RPC_USER_CONFIG" ""${OPENIM_ROOT}"/config/" # OpenIM openim-rpc-user 配置文件路径
|
||||
def "OPENIM_RPC_USER_LOG_DIR" "${LOG_STORAGE_LOCATION}/openim-rpc-user" # OpenIM openim-rpc-user 日志存储路径
|
||||
def "OPENIM_RPC_USER_LOG_LEVEL" "info" # OpenIM openim-rpc-user 日志级别
|
||||
def "OPENIM_RPC_USER_LOG_MAX_SIZE" "100" # OpenIM openim-rpc-user 日志最大大小(MB)
|
||||
|
||||
@@ -135,10 +135,11 @@ function openim::rpc::start() {
|
||||
for ((j = 0; j < ${#OPENIM_RPC_SERVICE_PORTS_ARRAY[@]}; j++)); do
|
||||
openim::log::info "Starting ${OPENIM_RPC_SERVICE_LISTARIES[$i]} service, port: ${OPENIM_RPC_SERVICE_PORTS[j]}, prometheus port: ${OPENIM_RPC_PROM_PORTS[j]}, binary root: ${OPENIM_OUTPUT_HOSTBIN}/${OPENIM_RPC_SERVICE_LISTARIES[$i]}"
|
||||
openim::rpc::start_service "${OPENIM_RPC_SERVICE_LISTARIES[$i]}" "${OPENIM_RPC_SERVICE_PORTS[j]}" "${OPENIM_RPC_PROM_PORTS[j]}"
|
||||
sleep 0.5
|
||||
done
|
||||
done
|
||||
|
||||
sleep 0.5
|
||||
|
||||
openim::util::check_ports ${OPENIM_RPC_PORT_TARGETS[@]}
|
||||
# openim::util::check_ports ${OPENIM_RPC_PROM_PORT_TARGETS[@]}
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ readonly OPENIM_TOOLS_PRE_START_NAME_LISTARIES=("${OPENIM_TOOLS_PRE_START_NAME_T
|
||||
openim::tools::post_start_name() {
|
||||
local targets=(
|
||||
infra
|
||||
versionchecker
|
||||
)
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
@@ -102,7 +103,7 @@ function openim::tools::start_service() {
|
||||
cmd="${cmd} --prometheus_port ${prometheus_port}"
|
||||
fi
|
||||
openim::log::info "Starting ${binary_name}..."
|
||||
${cmd} >> "${LOG_FILE}" 2>&1 &
|
||||
${cmd}
|
||||
}
|
||||
|
||||
function openim::tools::start() {
|
||||
|
||||
@@ -212,11 +212,11 @@ openim::log::success()
|
||||
|
||||
function openim::log::test_log() {
|
||||
echo_log "test log"
|
||||
openim::log::error "openim::log::error"
|
||||
openim::log::info "openim::log::info"
|
||||
openim::log::progress "openim::log::progress"
|
||||
openim::log::status "openim::log::status"
|
||||
openim::log::success "openim::log::success"
|
||||
openim::log::error "openim::log::error"
|
||||
openim::log::error_exit "openim::log::error_exit"
|
||||
}
|
||||
|
||||
|
||||
+20
-14
@@ -267,25 +267,29 @@ openim::util::check_ports() {
|
||||
openim::log::info "Checking ports: $*"
|
||||
# Iterate over each given port.
|
||||
for port in "$@"; do
|
||||
# Use the `lsof` command to find process information related to the given port.
|
||||
local info=$(lsof -i :$port -n -P | grep LISTEN || true)
|
||||
# Use the `ss` command to find process information related to the given port.
|
||||
local info=$(ss -ltnp | grep -w ":$port" || true)
|
||||
|
||||
# If there's no process information, it means the process associated with the port is not running.
|
||||
if [[ -z $info ]]; then
|
||||
not_started+=($port)
|
||||
else
|
||||
# If there's process information, extract relevant details:
|
||||
# Process ID, Command Name, and Start Time.
|
||||
local pid=$(echo $info | awk '{print $2}')
|
||||
local command=$(echo $info | awk '{print $1}')
|
||||
local start_time=$(ps -o lstart= -p $pid)
|
||||
started+=("Port $port - Command: $command, PID: $pid, Start time: $start_time")
|
||||
# Extract relevant details: Process Name, PID, and FD.
|
||||
local details=$(echo $info | sed -n 's/.*users:(("\([^"]*\)",pid=\([^,]*\),fd=\([^)]*\))).*/\1 \2 \3/p')
|
||||
local command=$(echo $details | awk '{print $1}')
|
||||
local pid=$(echo $details | awk '{print $2}')
|
||||
local fd=$(echo $details | awk '{print $3}')
|
||||
|
||||
# Get the start time of the process using the PID
|
||||
local start_time=$(ps -p $pid -o lstart=)
|
||||
|
||||
started+=("Port $port - Command: $command, PID: $pid, FD: $fd, Started: $start_time")
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
||||
# Print information about ports whose processes are not running.
|
||||
if [[ ${#not_started[@]} -ne 0 ]]; then
|
||||
openim::log::info "### Not started ports:"
|
||||
openim::log::info "\n### Not started ports:"
|
||||
for port in "${not_started[@]}"; do
|
||||
openim::log::error "Port $port is not started."
|
||||
done
|
||||
@@ -293,8 +297,7 @@ openim::util::check_ports() {
|
||||
|
||||
# Print information about ports whose processes are running.
|
||||
if [[ ${#started[@]} -ne 0 ]]; then
|
||||
echo
|
||||
openim::log::info "### Started ports:"
|
||||
openim::log::info "\n### Started ports:"
|
||||
for info in "${started[@]}"; do
|
||||
openim::log::info "$info"
|
||||
done
|
||||
@@ -305,11 +308,14 @@ openim::util::check_ports() {
|
||||
echo "++++ OpenIM Log >> cat ${LOG_FILE}"
|
||||
return 1
|
||||
else
|
||||
openim::log::success "started[@] processes are running."
|
||||
openim::log::success "All specified processes are running."
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
# openim::util::check_ports 10002 1004
|
||||
# set +o errexit
|
||||
# Sample call for testing:
|
||||
# openim::util::check_ports 10002 1004 12345 13306
|
||||
# set -o errexit
|
||||
|
||||
# The `openim::util::check_process_names` function analyzes the state of processes based on given names.
|
||||
# It accepts multiple process names as arguments and prints:
|
||||
|
||||
@@ -140,10 +140,6 @@ ifndef V
|
||||
MAKEFLAGS += --no-print-directory
|
||||
endif
|
||||
|
||||
# Copy githook scripts when execute makefile
|
||||
# TODO! GIT_FILE_SIZE_LIMIT=42000000 git commit -m "This commit is allowed file sizes up to 42MB"
|
||||
COPY_GITHOOK:=$(shell cp -f scripts/githooks/* .git/hooks/; chmod +x .git/hooks/*)
|
||||
|
||||
# COMMA: Concatenate multiple strings to form a list of strings
|
||||
COMMA := ,
|
||||
# SPACE: Used to separate strings
|
||||
|
||||
@@ -28,6 +28,12 @@ gen.init:
|
||||
@echo "===========> Initializing openim server project"
|
||||
@${ROOT_DIR}/scripts/init-config.sh
|
||||
|
||||
## gen.init-githooks: Initialize git hooks ✨
|
||||
.PHONY: gen.init-githooks
|
||||
gen.init-githooks:
|
||||
@echo "===========> Initializing git hooks"
|
||||
@${ROOT_DIR}/scripts/init-githooks.sh
|
||||
|
||||
## gen.run: Generate necessary files and docs ✨
|
||||
.PHONY: gen.run
|
||||
#gen.run: gen.errcode gen.docgo
|
||||
|
||||
@@ -22,6 +22,8 @@ set -o pipefail
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
openim::log::info "\n# Begin to start all openim service scripts"
|
||||
|
||||
set +o errexit
|
||||
openim::golang::check_openim_binaries
|
||||
if [[ $? -ne 0 ]]; then
|
||||
@@ -61,16 +63,21 @@ function execute_scripts() {
|
||||
else
|
||||
openim::log::errexit "Script ${script_path##*/} is missing or not executable."
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
sleep 0.5
|
||||
}
|
||||
|
||||
|
||||
# TODO Prelaunch tools, simple for now, can abstract functions later
|
||||
TOOLS_START_SCRIPTS_PATH=${START_SCRIPTS_PATH}/openim-tools.sh
|
||||
|
||||
openim::log::info "\n## Pre Starting OpenIM services"
|
||||
${TOOLS_START_SCRIPTS_PATH} openim::tools::pre-start
|
||||
|
||||
openim::log::info "\n## Starting OpenIM services"
|
||||
execute_scripts
|
||||
|
||||
openim::log::info "\n## Post Starting OpenIM services"
|
||||
${TOOLS_START_SCRIPTS_PATH} openim::tools::post-start
|
||||
|
||||
openim::log::success "✨ All OpenIM services have been successfully started!"
|
||||
@@ -26,6 +26,8 @@ OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
openim::log::info "\n# Begin to stop all openim service"
|
||||
|
||||
echo "++ Ready to stop port: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
|
||||
openim::util::stop_services_on_ports ${OPENIM_SERVER_PORT_LISTARIES[@]}
|
||||
|
||||
@@ -8,7 +8,7 @@ If you encounter any problems during its usage, please create an issue in the [G
|
||||
|
||||
**Here are some ways to get involved with the OpenIM community:**
|
||||
|
||||
📢 **Slack Channel**: Join our Slack channels for discussions, communication, and support. Click [here](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) to join the Open-IM-Server Slack team channel.
|
||||
📢 **Slack Channel**: Join our Slack channels for discussions, communication, and support. Click [here](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) to join the Open-IM-Server Slack team channel.
|
||||
|
||||
📧 **Gmail Contact**: If you have any questions, suggestions, or feedback for our open-source projects, please feel free to [contact us via email](https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=winxu81@gmail.com).
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/test/typecheck
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
require golang.org/x/tools v0.12.0
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/changelog
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// 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.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCheckMysql(t *testing.T) {
|
||||
err := mockInitCfg()
|
||||
assert.NoError(t, err, "Initialization should not produce errors")
|
||||
|
||||
err = checkMysql()
|
||||
if err != nil {
|
||||
// You might expect an error if MySQL isn't running locally with the mock credentials.
|
||||
t.Logf("Expected error due to mock configuration: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Mock for initCfg for testing purpose
|
||||
func mockInitCfg() error {
|
||||
config.Config.Mysql.Username = "root"
|
||||
config.Config.Mysql.Password = "openIM123"
|
||||
config.Config.Mysql.Address = []string{"127.0.0.1:13306"}
|
||||
return nil
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/component
|
||||
|
||||
go 1.19
|
||||
go 1.18
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/imctl
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/MakeNowJust/heredoc/v2 v2.0.1
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/infra
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/ncpu
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
require go.uber.org/automaxprocs v1.5.3
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# 使用官方Go镜像作为基础镜像
|
||||
FROM golang:1.21 AS build-env
|
||||
ENV CGO_ENABLED=0
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 安装curl和unzip工具
|
||||
#RUN apt-get update && apt-get install -y curl unzip
|
||||
|
||||
# 从GitHub下载并解压dist.zip
|
||||
#RUN curl -LO https://github.com/OpenIMSDK/dist.zip \
|
||||
# && unzip dist.zip -d ./ \
|
||||
# && rm dist.zip
|
||||
|
||||
# 复制Go代码到容器
|
||||
COPY . .
|
||||
|
||||
# 编译Go代码
|
||||
RUN go build -o openim-web
|
||||
|
||||
# 使用轻量级的基础镜像
|
||||
FROM debian:buster-slim
|
||||
|
||||
# 将编译好的二进制文件和dist资源复制到新的容器
|
||||
WORKDIR /app
|
||||
COPY --from=build-env /app/openim-web /app/openim-web
|
||||
COPY --from=build-env /app/dist /app/dist
|
||||
|
||||
# 开放容器的20001端口
|
||||
EXPOSE 20001
|
||||
|
||||
# 指定容器启动命令
|
||||
ENTRYPOINT ["/app/openim-web"]
|
||||
@@ -0,0 +1,79 @@
|
||||
# OpenIM Web Service
|
||||
|
||||
- [OpenIM Web Service](#openim-web-service)
|
||||
- [Overview](#overview)
|
||||
- [User](#user)
|
||||
- [Docker Deployment](#docker-deployment)
|
||||
- [Build the Docker Image](#build-the-docker-image)
|
||||
- [Run the Docker Container](#run-the-docker-container)
|
||||
- [Configuration](#configuration)
|
||||
- [Contributions](#contributions)
|
||||
|
||||
|
||||
OpenIM Web Service is a lightweight containerized service built with Go. The service serves static files and allows customization via environment variables.
|
||||
|
||||
## Overview
|
||||
|
||||
- Built using Go.
|
||||
- Deployed as a Docker container.
|
||||
- Serves static files from a directory which can be set via an environment variable.
|
||||
- The default port for the service is `20001`, but it can be customized using an environment variable.
|
||||
|
||||
## User
|
||||
|
||||
example:
|
||||
|
||||
```bash
|
||||
$ ./openim-web -h
|
||||
Usage of ./openim-web:
|
||||
-distPath string
|
||||
Path to the distribution (default "/app/dist")
|
||||
-port string
|
||||
Port to run the server on (default "20001")
|
||||
```
|
||||
|
||||
Variables can be set as above, Environment variables can also be set
|
||||
|
||||
example:
|
||||
|
||||
```bash
|
||||
$ export OPENIM_WEB_DIST_PATH="/app/dist"
|
||||
$ export OPENIM_WEB_PPRT="11001"
|
||||
```
|
||||
|
||||
Initialize the env configuration file:
|
||||
|
||||
```bash
|
||||
$ make init
|
||||
```
|
||||
|
||||
## Docker Deployment
|
||||
|
||||
### Build the Docker Image
|
||||
|
||||
Even though we've implemented automation, it's to make the developer experience easier:
|
||||
|
||||
To build the Docker image for OpenIM Web Service:
|
||||
|
||||
```bash
|
||||
$ docker build -t openim-web .
|
||||
```
|
||||
|
||||
### Run the Docker Container
|
||||
|
||||
To run the service:
|
||||
|
||||
```bash
|
||||
$ docker run -e DIST_PATH=/app/dist -e PORT=20001 -p 20001:20001 openim-web
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
You can configure the OpenIM Web Service using the following environment variables:
|
||||
|
||||
- **DIST_PATH**: The path to the directory containing the static files. Default: `/app/dist`.
|
||||
- **PORT**: The port on which the service listens. Default: `11001`.
|
||||
|
||||
## Contributions
|
||||
|
||||
We welcome contributions from the community. If you find any bugs or have feature suggestions, please create an issue or send a pull request.
|
||||
@@ -0,0 +1,7 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/openim-web
|
||||
|
||||
go 1.18
|
||||
|
||||
require gopkg.in/yaml.v2 v2.4.0
|
||||
|
||||
require github.com/NYTimes/gziphandler v1.1.1 // indirect
|
||||
@@ -0,0 +1,10 @@
|
||||
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
|
||||
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
@@ -0,0 +1,49 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/NYTimes/gziphandler"
|
||||
)
|
||||
|
||||
var (
|
||||
distPathFlag string
|
||||
portFlag string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&distPathFlag, "distPath", "/app/dist", "Path to the distribution")
|
||||
flag.StringVar(&portFlag, "port", "11001", "Port to run the server on")
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
distPath := getConfigValue("DIST_PATH", distPathFlag, "/app/dist")
|
||||
fs := http.FileServer(http.Dir(distPath))
|
||||
|
||||
withGzip := gziphandler.GzipHandler(fs)
|
||||
|
||||
http.Handle("/", withGzip)
|
||||
|
||||
port := getConfigValue("PORT", portFlag, "11001")
|
||||
log.Printf("Server listening on port %s in %s...", port, distPath)
|
||||
err := http.ListenAndServe(":"+port, nil)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func getConfigValue(envKey, flagValue, fallback string) string {
|
||||
envVal := os.Getenv(envKey)
|
||||
if envVal != "" {
|
||||
return envVal
|
||||
}
|
||||
if flagValue != "" {
|
||||
return flagValue
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetConfigValue(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
envKey string
|
||||
envValue string
|
||||
flagValue string
|
||||
fallback string
|
||||
wantResult string
|
||||
}{
|
||||
{
|
||||
name: "environment variable set",
|
||||
envKey: "TEST_KEY",
|
||||
envValue: "envValue",
|
||||
flagValue: "",
|
||||
fallback: "default",
|
||||
wantResult: "envValue",
|
||||
},
|
||||
{
|
||||
name: "flag set and environment variable not set",
|
||||
envKey: "TEST_KEY",
|
||||
envValue: "",
|
||||
flagValue: "flagValue",
|
||||
fallback: "default",
|
||||
wantResult: "flagValue",
|
||||
},
|
||||
{
|
||||
name: "nothing set, use fallback",
|
||||
envKey: "TEST_KEY",
|
||||
envValue: "",
|
||||
flagValue: "",
|
||||
fallback: "default",
|
||||
wantResult: "default",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if tt.envValue != "" {
|
||||
os.Setenv(tt.envKey, tt.envValue)
|
||||
defer os.Unsetenv(tt.envKey)
|
||||
}
|
||||
|
||||
got := getConfigValue(tt.envKey, tt.flagValue, tt.fallback)
|
||||
|
||||
if got != tt.wantResult {
|
||||
t.Errorf("getConfigValue(%s, %s, %s) = %s; want %s", tt.envKey, tt.flagValue, tt.fallback, got, tt.wantResult)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/versionchecker
|
||||
|
||||
go 1.20.0
|
||||
go 1.18
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// 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.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/yamlfmt
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/likexian/gokit v0.25.13
|
||||
|
||||
Reference in New Issue
Block a user