mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-26 13:12:12 +08:00
Compare commits
No commits in common. "main" and "v3.8.1-rc.4" have entirely different histories.
main
...
v3.8.1-rc.
21
.env
21
.env
@ -1,24 +1,19 @@
|
||||
MONGO_IMAGE=mongo:7.0
|
||||
MONGO_IMAGE=mongo:6.0.2
|
||||
REDIS_IMAGE=redis:7.0.0
|
||||
KAFKA_IMAGE=bitnamilegacy/kafka:3.5.1
|
||||
ZOOKEEPER_IMAGE=bitnami/zookeeper:3.8
|
||||
KAFKA_IMAGE=bitnami/kafka:3.5.1
|
||||
MINIO_IMAGE=minio/minio:RELEASE.2024-01-11T07-46-16Z
|
||||
ETCD_IMAGE=bitnamilegacy/etcd:3.5.13
|
||||
ETCD_IMAGE=quay.io/coreos/etcd:v3.5.13
|
||||
PROMETHEUS_IMAGE=prom/prometheus:v2.45.6
|
||||
ALERTMANAGER_IMAGE=prom/alertmanager:v0.27.0
|
||||
GRAFANA_IMAGE=grafana/grafana:11.0.1
|
||||
NODE_EXPORTER_IMAGE=prom/node-exporter:v1.7.0
|
||||
|
||||
OPENIM_WEB_FRONT_IMAGE=openim/openim-web-front:release-v3.8.3
|
||||
OPENIM_ADMIN_FRONT_IMAGE=openim/openim-admin-front:release-v1.8.4
|
||||
OPENIM_WEB_FRONT_IMAGE=openim/openim-web-front:release-v3.8.0
|
||||
OPENIM_ADMIN_FRONT_IMAGE=openim/openim-admin-front:release-v1.8.0
|
||||
|
||||
#FRONT_IMAGE: use aliyun images
|
||||
#OPENIM_WEB_FRONT_IMAGE=registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-web-front:release-v3.8.3
|
||||
#OPENIM_ADMIN_FRONT_IMAGE=registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-admin-front:release-v1.8.4
|
||||
#OPENIM_WEB_FRONT_IMAGE=registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-web-front:release-v3.5.1
|
||||
#OPENIM_ADMIN_FRONT_IMAGE=registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-admin-front:release-v1.7
|
||||
|
||||
DATA_DIR=./
|
||||
|
||||
MONGO_BACKUP_DIR=${DATA_DIR}components/backup/mongo/
|
||||
|
||||
PROMETHEUS_PORT=19091
|
||||
ALERTMANAGER_PORT=19093
|
||||
GRAFANA_PORT=13000
|
||||
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -4,7 +4,7 @@ contact_links:
|
||||
# description: "Report a bug in the project"
|
||||
# file: "bug-report.yml"
|
||||
- name: 📢 Connect on slack
|
||||
url: https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A
|
||||
url: https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg
|
||||
about: Support OpenIM-related requests or issues, get in touch with developers and help on slack
|
||||
- name: 🌐 OpenIM Blog
|
||||
url: https://www.openim.io/
|
||||
|
||||
3
.github/ISSUE_TEMPLATE/other.yml
vendored
3
.github/ISSUE_TEMPLATE/other.yml
vendored
@ -4,6 +4,7 @@ title: "[Other]: <give this problem a name>"
|
||||
labels: ["other"]
|
||||
# assignees: []
|
||||
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
@ -25,5 +26,5 @@ body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
You can also join our Discord community [here](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A)
|
||||
You can also join our Discord community [here](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg)
|
||||
Feel free to check out other cool repositories of the openim Community [here](https://github.com/openimsdk)
|
||||
|
||||
5
.github/workflows/auto-invite-comment.yml
vendored
5
.github/workflows/auto-invite-comment.yml
vendored
@ -11,6 +11,7 @@ jobs:
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
|
||||
- name: Invite user to join OpenIM Community
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
@ -19,11 +20,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-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A). 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-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A" 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-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A) 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=info@openim.io" 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.
|
||||
|
||||
78
.github/workflows/changelog.yml
vendored
78
.github/workflows/changelog.yml
vendored
@ -1,78 +0,0 @@
|
||||
name: Release Changelog
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
update-changelog:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run Go Changelog Generator
|
||||
run: |
|
||||
# Run the Go changelog generator, passing the release tag if available
|
||||
if [ "${{ github.event.release.tag_name }}" = "latest" ]; then
|
||||
go run tools/changelog/changelog.go > "${{ github.event.release.tag_name }}-changelog.md"
|
||||
else
|
||||
go run tools/changelog/changelog.go "${{ github.event.release.tag_name }}" > "${{ github.event.release.tag_name }}-changelog.md"
|
||||
fi
|
||||
|
||||
- name: Handle changelog files
|
||||
run: |
|
||||
# Ensure that the CHANGELOG directory exists
|
||||
mkdir -p CHANGELOG
|
||||
|
||||
# Extract Major.Minor version by removing the 'v' prefix from the tag name
|
||||
TAG_NAME=${{ github.event.release.tag_name }}
|
||||
CHANGELOG_VERSION_NUMBER=$(echo "$TAG_NAME" | sed 's/^v//' | grep -oP '^\d+\.\d+')
|
||||
|
||||
# Define the new changelog file path
|
||||
CHANGELOG_FILENAME="CHANGELOG-$CHANGELOG_VERSION_NUMBER.md"
|
||||
CHANGELOG_PATH="CHANGELOG/$CHANGELOG_FILENAME"
|
||||
|
||||
# Check if the changelog file for the current release already exists
|
||||
if [ -f "$CHANGELOG_PATH" ]; then
|
||||
# If the file exists, append the new changelog to the existing one
|
||||
cat "$CHANGELOG_PATH" >> "${TAG_NAME}-changelog.md"
|
||||
# Overwrite the existing changelog with the updated content
|
||||
mv "${TAG_NAME}-changelog.md" "$CHANGELOG_PATH"
|
||||
else
|
||||
# If the changelog file doesn't exist, rename the temp changelog file to the new changelog file
|
||||
mv "${TAG_NAME}-changelog.md" "$CHANGELOG_PATH"
|
||||
|
||||
# Ensure that README.md exists
|
||||
if [ ! -f "CHANGELOG/README.md" ]; then
|
||||
echo -e "# CHANGELOGs\n\n" > CHANGELOG/README.md
|
||||
fi
|
||||
|
||||
# Add the new changelog entry at the top of the README.md
|
||||
if ! grep -q "\[$CHANGELOG_FILENAME\]" CHANGELOG/README.md; then
|
||||
sed -i "3i- [$CHANGELOG_FILENAME](./$CHANGELOG_FILENAME)" CHANGELOG/README.md
|
||||
# Remove the extra newline character added by sed
|
||||
# sed -i '4d' CHANGELOG/README.md
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Clean up
|
||||
run: |
|
||||
# Remove any temporary files that were created during the process
|
||||
rm -f "${{ github.event.release.tag_name }}-changelog.md"
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7.0.5
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: "Update CHANGELOG for release ${{ github.event.release.tag_name }}"
|
||||
title: "Update CHANGELOG for release ${{ github.event.release.tag_name }}"
|
||||
body: "This PR updates the CHANGELOG files for release ${{ github.event.release.tag_name }}"
|
||||
branch: changelog-${{ github.event.release.tag_name }}
|
||||
base: main
|
||||
delete-branch: true
|
||||
labels: changelog
|
||||
@ -1,65 +0,0 @@
|
||||
name: Cleanup After Milestone PRs Merged
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
handle_pr:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4.2.0
|
||||
|
||||
- name: Get the PR title and extract PR numbers
|
||||
id: extract_pr_numbers
|
||||
run: |
|
||||
# Get the PR title
|
||||
PR_TITLE="${{ github.event.pull_request.title }}"
|
||||
|
||||
echo "PR Title: $PR_TITLE"
|
||||
|
||||
# Extract PR numbers from the title
|
||||
PR_NUMBERS=$(echo "$PR_TITLE" | grep -oE "#[0-9]+" | tr -d '#' | tr '\n' ' ')
|
||||
echo "Extracted PR Numbers: $PR_NUMBERS"
|
||||
|
||||
# Save PR numbers to a file
|
||||
echo "$PR_NUMBERS" > pr_numbers.txt
|
||||
echo "Saved PR Numbers to pr_numbers.txt"
|
||||
|
||||
# Check if the title matches a specific pattern
|
||||
if echo "$PR_TITLE" | grep -qE "^deps: Merge( #[0-9]+)+ PRs into .+"; then
|
||||
echo "proceed=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "proceed=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Use extracted PR numbers and label PRs
|
||||
if: (steps.extract_pr_numbers.outputs.proceed == 'true' || contains(github.event.pull_request.labels.*.name, 'milestone-merge')) && github.event.pull_request.merged == true
|
||||
run: |
|
||||
# Read the previously saved PR numbers
|
||||
PR_NUMBERS=$(cat pr_numbers.txt)
|
||||
echo "Using extracted PR Numbers: $PR_NUMBERS"
|
||||
|
||||
# Loop through each PR number and add label
|
||||
for PR_NUMBER in $PR_NUMBERS; do
|
||||
echo "Adding 'cherry-picked' label to PR #$PR_NUMBER"
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels \
|
||||
-d '{"labels":["cherry-picked"]}'
|
||||
done
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Delete branch after PR close
|
||||
if: steps.extract_pr_numbers.outputs.proceed == 'true' || contains(github.event.pull_request.labels.*.name, 'milestone-merge')
|
||||
run: |
|
||||
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
|
||||
echo "Branch to delete: $BRANCH_NAME"
|
||||
git push origin --delete "$BRANCH_NAME"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@ -1,91 +0,0 @@
|
||||
name: Build and release services Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release-*
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Tag version to be used for Docker image"
|
||||
required: true
|
||||
default: "v3.8.3"
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3.8.0
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3.3.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3.3.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Log in to Aliyun Container Registry
|
||||
uses: docker/login-action@v3.3.0
|
||||
with:
|
||||
registry: registry.cn-hangzhou.aliyuncs.com
|
||||
username: ${{ secrets.ALIREGISTRY_USERNAME }}
|
||||
password: ${{ secrets.ALIREGISTRY_TOKEN }}
|
||||
|
||||
- name: Extract metadata for Docker (tags, labels)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5.6.0
|
||||
with:
|
||||
tags: |
|
||||
type=ref,event=tag
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern=v{{version}}
|
||||
type=semver,pattern=release-{{raw}}
|
||||
type=sha
|
||||
type=raw,value=${{ github.event.inputs.tag }}
|
||||
|
||||
- name: Build and push Docker images
|
||||
run: |
|
||||
IMG_DIR="build/images"
|
||||
for dir in "$IMG_DIR"/*/; do
|
||||
# Find Dockerfile or *.dockerfile in a case-insensitive manner
|
||||
dockerfile=$(find "$dir" -maxdepth 1 -type f \( -iname 'dockerfile' -o -iname '*.dockerfile' \) | head -n 1)
|
||||
|
||||
if [ -n "$dockerfile" ] && [ -f "$dockerfile" ]; then
|
||||
IMAGE_NAME=$(basename "$dir")
|
||||
echo "Building Docker image for $IMAGE_NAME with tags:"
|
||||
|
||||
# Initialize tag arguments
|
||||
tag_args=()
|
||||
|
||||
# Read each tag and append --tag arguments
|
||||
while IFS= read -r tag; do
|
||||
tag_args+=(--tag "${{ secrets.DOCKER_USERNAME }}/$IMAGE_NAME:$tag")
|
||||
tag_args+=(--tag "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$tag")
|
||||
tag_args+=(--tag "registry.cn-hangzhou.aliyuncs.com/openimsdk/$IMAGE_NAME:$tag")
|
||||
done <<< "${{ steps.meta.outputs.tags }}"
|
||||
|
||||
# Build and push the Docker image with all tags
|
||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||
--file "$dockerfile" \
|
||||
"${tag_args[@]}" \
|
||||
--push \
|
||||
"."
|
||||
else
|
||||
echo "No valid Dockerfile found in $dir"
|
||||
fi
|
||||
done
|
||||
142
.github/workflows/go-build-test.yml
vendored
142
.github/workflows/go-build-test.yml
vendored
@ -2,9 +2,13 @@ name: Go Build Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- "**/*.md"
|
||||
- '**/*.md'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
@ -12,17 +16,13 @@ jobs:
|
||||
go-build:
|
||||
name: Test with go ${{ matrix.go_version }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
env:
|
||||
SHARE_CONFIG_PATH: config/share.yml
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
go_version: ["1.22.x"]
|
||||
go_version: ["1.21.x", "1.22.x"]
|
||||
|
||||
steps:
|
||||
- name: Checkout Server repository
|
||||
@ -41,12 +41,15 @@ jobs:
|
||||
|
||||
- name: Set up infra services
|
||||
uses: hoverkraft-tech/compose-action@v2.0.1
|
||||
# Uncomment and set the correct path to your docker-compose file
|
||||
with:
|
||||
compose-file: "./docker-compose.yml"
|
||||
|
||||
- name: Modify Server Configuration
|
||||
run: |
|
||||
yq e '.secret = 123456' -i ${{ env.SHARE_CONFIG_PATH }}
|
||||
# run: |
|
||||
# sudo docker compose up -d
|
||||
# sudo sleep 30 # Increased sleep time for better stability
|
||||
# timeout-minutes: 60 # Increased timeout for Docker setup
|
||||
|
||||
|
||||
# - name: Get Internal IP Address
|
||||
# id: get-ip
|
||||
@ -79,11 +82,6 @@ jobs:
|
||||
go mod download
|
||||
go install github.com/magefile/mage@latest
|
||||
|
||||
- name: Modify Chat Configuration
|
||||
run: |
|
||||
cd ${{ github.workspace }}/chat-repo
|
||||
yq e '.openIM.secret = 123456' -i ${{ env.SHARE_CONFIG_PATH }}
|
||||
|
||||
- name: Build and test Chat Services
|
||||
run: |
|
||||
cd ${{ github.workspace }}/chat-repo
|
||||
@ -91,90 +89,6 @@ jobs:
|
||||
mage start
|
||||
mage check
|
||||
|
||||
- name: Test Server and Chat
|
||||
run: |
|
||||
check_error() {
|
||||
echo "Response: $1"
|
||||
errCode=$(echo $1 | jq -r '.errCode')
|
||||
if [ "$errCode" != "0" ]; then
|
||||
errMsg=$(echo $1 | jq -r '.errMsg')
|
||||
echo "Error: $errMsg"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Test register
|
||||
response1=$(curl -X POST -H "Content-Type: application/json" -H "operationID: imAdmin" -d '{
|
||||
"verifyCode": "666666",
|
||||
"platform": 3,
|
||||
"autoLogin": true,
|
||||
"user":{
|
||||
"nickname": "test12312",
|
||||
"areaCode":"+86",
|
||||
"phoneNumber": "12345678190",
|
||||
"password":"test123456"
|
||||
}
|
||||
}' http://127.0.0.1:10008/account/register)
|
||||
check_error "$response1"
|
||||
userID1=$(echo $response1 | jq -r '.data.userID')
|
||||
echo "userID1: $userID1"
|
||||
|
||||
response2=$(curl -X POST -H "Content-Type: application/json" -H "operationID: imAdmin" -d '{
|
||||
"verifyCode": "666666",
|
||||
"platform": 3,
|
||||
"autoLogin": true,
|
||||
"user":{
|
||||
"nickname": "test22312",
|
||||
"areaCode":"+86",
|
||||
"phoneNumber": "12345678290",
|
||||
"password":"test123456"
|
||||
}
|
||||
}' http://127.0.0.1:10008/account/register)
|
||||
check_error "$response2"
|
||||
userID2=$(echo $response2 | jq -r '.data.userID')
|
||||
echo "userID2: $userID2"
|
||||
|
||||
# Test login
|
||||
login_response=$(curl -X POST -H "Content-Type: application/json" -H "operationID: imAdmin" -d '{
|
||||
"platform": 3,
|
||||
"areaCode":"+86",
|
||||
"phoneNumber": "12345678190",
|
||||
"password":"test123456"
|
||||
}' http://localhost:10008/account/login)
|
||||
check_error "$login_response"
|
||||
|
||||
# Test get admin token
|
||||
get_admin_token_response=$(curl -X POST -H "Content-Type: application/json" -H "operationID: imAdmin" -d '{
|
||||
"secret": "123456",
|
||||
"platformID": 2,
|
||||
"userID": "imAdmin"
|
||||
}' http://127.0.0.1:10002/auth/get_admin_token)
|
||||
check_error "$get_admin_token_response"
|
||||
adminToken=$(echo $get_admin_token_response | jq -r '.data.token')
|
||||
echo "adminToken: $adminToken"
|
||||
|
||||
# Test send message
|
||||
send_msg_response=$(curl -X POST -H "Content-Type: application/json" -H "operationID: imAdmin" -H "token: $adminToken" -d '{
|
||||
"sendID": "'$userID1'",
|
||||
"recvID": "'$userID2'",
|
||||
"senderPlatformID": 3,
|
||||
"content": {
|
||||
"content": "hello!!"
|
||||
},
|
||||
"contentType": 101,
|
||||
"sessionType": 1
|
||||
}' http://127.0.0.1:10002/msg/send_msg)
|
||||
check_error "$send_msg_response"
|
||||
|
||||
# Test get users
|
||||
get_users_response=$(curl -X POST -H "Content-Type: application/json" -H "operationID: imAdmin" -H "token: $adminToken" -d '{
|
||||
"pagination": {
|
||||
"pageNumber": 1,
|
||||
"showNumber": 100
|
||||
}
|
||||
}' http://127.0.0.1:10002/user/get_users)
|
||||
check_error "$get_users_response"
|
||||
|
||||
go-test:
|
||||
name: Benchmark Test with go ${{ matrix.go_version }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
@ -182,13 +96,12 @@ jobs:
|
||||
contents: write
|
||||
env:
|
||||
SDK_DIR: openim-sdk-core
|
||||
NOTIFICATION_CONFIG_PATH: config/notification.yml
|
||||
SHARE_CONFIG_PATH: config/share.yml
|
||||
|
||||
CONFIG_PATH: config/notification.yml
|
||||
# pull-requests: write
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
go_version: ["1.22.x"]
|
||||
os: [ ubuntu-latest ]
|
||||
go_version: [ "1.22.x" ]
|
||||
|
||||
steps:
|
||||
- name: Checkout Server repository
|
||||
@ -197,8 +110,7 @@ jobs:
|
||||
- name: Checkout SDK repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: "openimsdk/openim-sdk-core"
|
||||
ref: "main"
|
||||
repository: 'openimsdk/openim-sdk-core'
|
||||
path: ${{ env.SDK_DIR }}
|
||||
|
||||
- name: Set up Go ${{ matrix.go_version }}
|
||||
@ -211,11 +123,15 @@ jobs:
|
||||
go install github.com/magefile/mage@latest
|
||||
go mod download
|
||||
|
||||
- name: Install yq
|
||||
run: |
|
||||
sudo wget https://github.com/mikefarah/yq/releases/download/v4.34.1/yq_linux_amd64 -O /usr/bin/yq
|
||||
sudo chmod +x /usr/bin/yq
|
||||
|
||||
- name: Modify Server Configuration
|
||||
run: |
|
||||
yq e '.groupCreated.isSendMsg = true' -i ${{ env.NOTIFICATION_CONFIG_PATH }}
|
||||
yq e '.friendApplicationApproved.isSendMsg = true' -i ${{ env.NOTIFICATION_CONFIG_PATH }}
|
||||
yq e '.secret = 123456' -i ${{ env.SHARE_CONFIG_PATH }}
|
||||
yq e '.groupCreated.unreadCount = true' -i ${{ env.CONFIG_PATH }}
|
||||
yq e '.friendApplicationApproved.unreadCount = true' -i ${{ env.CONFIG_PATH }}
|
||||
|
||||
- name: Start Server Services
|
||||
run: |
|
||||
@ -237,7 +153,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go_version: ["1.22"]
|
||||
go_version: ["1.21"]
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
@ -271,3 +187,11 @@ jobs:
|
||||
run: |
|
||||
CONTAINER_NAME="${{ github.event.repository.name }}-container"
|
||||
docker logs $CONTAINER_NAME
|
||||
|
||||
# - name: Cleanup Docker Container
|
||||
# run: |
|
||||
# CONTAINER_NAME="${{ github.event.repository.name }}-container"
|
||||
# IMAGE_NAME="${{ github.event.repository.name }}-test"
|
||||
# docker stop $CONTAINER_NAME
|
||||
# docker rm $CONTAINER_NAME
|
||||
# docker rmi $IMAGE_NAME
|
||||
|
||||
2
.github/workflows/help-comment-issue.yml
vendored
2
.github/workflows/help-comment-issue.yml
vendored
@ -32,5 +32,5 @@ jobs:
|
||||
token: ${{ secrets.BOT_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-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A) 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`.🎯
|
||||
|
||||
181
.github/workflows/merge-from-milestone.yml
vendored
181
.github/workflows/merge-from-milestone.yml
vendored
@ -1,181 +0,0 @@
|
||||
name: Create Individual PRs from Milestone
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
milestone_name:
|
||||
description: "Milestone name to collect closed PRs from"
|
||||
required: true
|
||||
default: "v3.8.4"
|
||||
target_branch:
|
||||
description: "Target branch to merge the consolidated PR"
|
||||
required: true
|
||||
default: "pre-release-v3.8.4"
|
||||
|
||||
env:
|
||||
MILESTONE_NAME: ${{ github.event.inputs.milestone_name || 'v3.8.4' }}
|
||||
TARGET_BRANCH: ${{ github.event.inputs.target_branch || 'pre-release-v3.8.4' }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||
LABEL_NAME: cherry-picked
|
||||
TEMP_DIR: /tmp
|
||||
|
||||
jobs:
|
||||
merge_milestone_prs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup temp directory
|
||||
run: |
|
||||
# Create the temporary directory and initialize necessary files
|
||||
mkdir -p ${{ env.TEMP_DIR }}
|
||||
touch ${{ env.TEMP_DIR }}/pr_numbers.txt
|
||||
touch ${{ env.TEMP_DIR }}/commit_hashes.txt
|
||||
touch ${{ env.TEMP_DIR }}/pr_title.txt
|
||||
touch ${{ env.TEMP_DIR }}/pr_body.txt
|
||||
touch ${{ env.TEMP_DIR }}/created_pr_number.txt
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
|
||||
- name: Setup Git User for OpenIM-Robot
|
||||
run: |
|
||||
git config --global user.email "OpenIM-Robot@users.noreply.github.com"
|
||||
git config --global user.name "OpenIM-Robot"
|
||||
|
||||
- name: Fetch Milestone ID and Filter PR Numbers
|
||||
env:
|
||||
MILESTONE_NAME: ${{ env.MILESTONE_NAME }}
|
||||
run: |
|
||||
# Fetch milestone details and extract milestone ID
|
||||
milestones=$(curl -s -H "Authorization: token $BOT_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/milestones")
|
||||
milestone_id=$(echo "$milestones" | grep -B3 "\"title\": \"$MILESTONE_NAME\"" | grep '"number":' | head -n1 | grep -o '[0-9]\+')
|
||||
if [ -z "$milestone_id" ]; then
|
||||
echo "Milestone '$MILESTONE_NAME' not found. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
echo "Milestone ID: $milestone_id"
|
||||
echo "MILESTONE_ID=$milestone_id" >> $GITHUB_ENV
|
||||
|
||||
# Fetch issues for the milestone
|
||||
issues=$(curl -s -H "Authorization: token $BOT_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/issues?milestone=$milestone_id&state=closed&per_page=100")
|
||||
|
||||
> ${{ env.TEMP_DIR }}/pr_numbers.txt
|
||||
|
||||
# Filter PRs that do not have the 'cherry-picked' label
|
||||
for pr_number in $(echo "$issues" | jq -r '.[] | select(.pull_request != null) | .number'); do
|
||||
labels=$(curl -s -H "Authorization: token $BOT_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/issues/$pr_number/labels" | jq -r '.[].name')
|
||||
|
||||
if ! echo "$labels" | grep -q "${LABEL_NAME}"; then
|
||||
echo "PR #$pr_number does not have the 'cherry-picked' label. Adding to the list."
|
||||
echo "$pr_number" >> ${{ env.TEMP_DIR }}/pr_numbers.txt
|
||||
fi
|
||||
done
|
||||
|
||||
sort -n ${{ env.TEMP_DIR }}/pr_numbers.txt -o ${{ env.TEMP_DIR }}/pr_numbers.txt
|
||||
|
||||
- name: Create Individual PRs
|
||||
run: |
|
||||
for pr_number in $(cat ${{ env.TEMP_DIR }}/pr_numbers.txt); do
|
||||
pr_details=$(curl -s -H "Authorization: token $BOT_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/pulls/$pr_number")
|
||||
pr_title=$(echo "$pr_details" | jq -r '.title')
|
||||
pr_body=$(echo "$pr_details" | jq -r '.body')
|
||||
pr_creator=$(echo "$pr_details" | jq -r '.user.login')
|
||||
merge_commit=$(echo "$pr_details" | jq -r '.merge_commit_sha')
|
||||
short_commit_hash=$(echo "$merge_commit" | cut -c 1-7)
|
||||
|
||||
if [ "$merge_commit" != "null" ]; then
|
||||
git fetch origin
|
||||
|
||||
echo "Checking out target branch: $TARGET_BRANCH"
|
||||
git checkout $TARGET_BRANCH
|
||||
|
||||
echo "Pulling latest changes from target branch: $TARGET_BRANCH"
|
||||
git pull origin $TARGET_BRANCH
|
||||
|
||||
cherry_pick_branch="cherry-pick-${short_commit_hash}"
|
||||
git checkout -b $cherry_pick_branch
|
||||
|
||||
echo "Cherry-picking commit: $merge_commit"
|
||||
if ! git cherry-pick "$merge_commit" --strategy=recursive -X theirs; then
|
||||
echo "Conflict detected for $merge_commit. Resolving with incoming changes."
|
||||
conflict_files=$(git diff --name-only --diff-filter=U)
|
||||
echo "Conflicting files:"
|
||||
echo "$conflict_files"
|
||||
|
||||
for file in $conflict_files; do
|
||||
if [ -f "$file" ]; then
|
||||
echo "Resolving conflict for $file"
|
||||
git add "$file"
|
||||
else
|
||||
echo "File $file has been deleted. Skipping."
|
||||
git rm "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Conflicts resolved. Continuing cherry-pick."
|
||||
git cherry-pick --continue || { echo "Cherry-pick failed, but continuing to create PR."; }
|
||||
else
|
||||
echo "Cherry-pick successful for commit $merge_commit."
|
||||
fi
|
||||
|
||||
git remote set-url origin "https://${BOT_TOKEN}@github.com/${{ github.repository }}.git"
|
||||
|
||||
echo "Pushing branch: $cherry_pick_branch"
|
||||
if ! git push origin $cherry_pick_branch --force; then
|
||||
echo "Push failed, but continuing to create PR..."
|
||||
fi
|
||||
|
||||
new_pr_title="$pr_title [Created by @$pr_creator from #$pr_number]"
|
||||
new_pr_body="$pr_body
|
||||
> This PR is created from original PR #$pr_number."
|
||||
|
||||
response=$(curl -s -X POST -H "Authorization: token $BOT_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
https://api.github.com/repos/${{ github.repository }}/pulls \
|
||||
-d "$(jq -n --arg title "$new_pr_title" \
|
||||
--arg head "$cherry_pick_branch" \
|
||||
--arg base "$TARGET_BRANCH" \
|
||||
--arg body "$new_pr_body" \
|
||||
'{title: $title, head: $head, base: $base, body: $body}')")
|
||||
|
||||
new_pr_number=$(echo "$response" | jq -r '.number')
|
||||
|
||||
if [[ "$new_pr_number" == "null" || -z "$new_pr_number" ]]; then
|
||||
echo "Failed to create PR. Response: $response"
|
||||
|
||||
git checkout $TARGET_BRANCH
|
||||
|
||||
git branch -D $cherry_pick_branch
|
||||
|
||||
echo "Deleted branch: $cherry_pick_branch"
|
||||
git push origin --delete $cherry_pick_branch
|
||||
else
|
||||
echo "Created PR #$new_pr_number"
|
||||
|
||||
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-d '{"labels": ["milestone-merge"]}' \
|
||||
"https://api.github.com/repos/${{ github.repository }}/issues/$new_pr_number/labels"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "----------------------------------------"
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
96
.github/workflows/publish-docker-image.yml
vendored
96
.github/workflows/publish-docker-image.yml
vendored
@ -4,8 +4,6 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- release-*
|
||||
# tags:
|
||||
# - 'v*'
|
||||
|
||||
release:
|
||||
types: [published]
|
||||
@ -17,29 +15,29 @@ on:
|
||||
required: true
|
||||
default: "v3.8.0"
|
||||
|
||||
# env:
|
||||
# GO_VERSION: "1.21"
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
publish-docker-images:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: main-repo
|
||||
|
||||
# - name: Set up QEMU
|
||||
# uses: docker/setup-qemu-action@v3.3.0
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3.8.0
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build Docker image
|
||||
id: build
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./main-repo
|
||||
load: true
|
||||
tags: "openim/openim-server:local"
|
||||
cache-from: type=gha,scope=build
|
||||
cache-to: type=gha,mode=max,scope=build
|
||||
|
||||
- name: Checkout compose repository
|
||||
uses: actions/checkout@v4
|
||||
@ -63,48 +61,81 @@ jobs:
|
||||
run: |
|
||||
cd ${{ github.workspace }}/compose-repo
|
||||
docker compose up -d
|
||||
sleep 60
|
||||
|
||||
docker compose ps
|
||||
- name: Check openim-server health
|
||||
run: |
|
||||
timeout=300
|
||||
interval=30
|
||||
elapsed=0
|
||||
while [[ $elapsed -le $timeout ]]; do
|
||||
if ! docker exec openim-server mage check; then
|
||||
echo "openim-server is not ready, waiting..."
|
||||
sleep $interval
|
||||
elapsed=$(($elapsed + $interval))
|
||||
else
|
||||
echo "Health check successful"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
echo "Health check failed after 5 minutes"
|
||||
exit 1
|
||||
|
||||
- name: Extract metadata for Docker (tags, labels)
|
||||
- name: Check openim-chat health
|
||||
if: success()
|
||||
run: |
|
||||
if ! docker exec openim-chat mage check; then
|
||||
echo "openim-chat check failed"
|
||||
exit 1
|
||||
else
|
||||
echo "Health check successful"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
- name: Extract metadata for Docker # (tags, labels)
|
||||
if: success()
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5.6.0
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
with:
|
||||
images: |
|
||||
openim/openim-server
|
||||
ghcr.io/openimsdk/openim-server
|
||||
registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server
|
||||
|
||||
# generate Docker tags based on the following events/attributes
|
||||
tags: |
|
||||
type=ref,event=tag
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
# type=semver,pattern={{version}}
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern=v{{version}}
|
||||
type=semver,pattern=release-{{raw}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
type=raw,value=${{ github.event.inputs.tag }}
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3.3.0
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3.3.0
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Log in to Aliyun Container Registry
|
||||
uses: docker/login-action@v3.3.0
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: registry.cn-hangzhou.aliyuncs.com
|
||||
username: ${{ secrets.ALIREGISTRY_USERNAME }}
|
||||
password: ${{ secrets.ALIREGISTRY_TOKEN }}
|
||||
|
||||
- name: Push Docker images
|
||||
- name: Build and push Docker images
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./main-repo
|
||||
@ -112,28 +143,3 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha,scope=build
|
||||
cache-to: type=gha,mode=max,scope=build
|
||||
|
||||
- name: Verify multi-platform support
|
||||
run: |
|
||||
images=("openim/openim-server" "ghcr.io/openimsdk/openim-server" "registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server")
|
||||
for image in "${images[@]}"; do
|
||||
for tag in $(echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n'); do
|
||||
manifest=$(docker manifest inspect "$image:$tag" || echo "error")
|
||||
if [[ "$manifest" == "error" ]]; then
|
||||
echo "Manifest not found for $image:$tag"
|
||||
exit 1
|
||||
fi
|
||||
amd64_found=$(echo "$manifest" | jq '.manifests[] | select(.platform.architecture == "amd64")')
|
||||
arm64_found=$(echo "$manifest" | jq '.manifests[] | select(.platform.architecture == "arm64")')
|
||||
if [[ -z "$amd64_found" ]]; then
|
||||
echo "Multi-platform support check failed for $image:$tag - missing amd64"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "$arm64_found" ]]; then
|
||||
echo "Multi-platform support check failed for $image:$tag - missing arm64"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
119
.github/workflows/update-version-file-on-release.yml
vendored
119
.github/workflows/update-version-file-on-release.yml
vendored
@ -1,119 +0,0 @@
|
||||
name: Update Version File on Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
update-version:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TAG_VERSION: ${{ github.event.release.tag_name }}
|
||||
steps:
|
||||
# Step 1: Checkout the original repository's code
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
# submodules: "recursive"
|
||||
|
||||
- name: Safe submodule initialization
|
||||
run: |
|
||||
echo "Checking for submodules..."
|
||||
if [ -f .gitmodules ]; then
|
||||
if [ -s .gitmodules ]; then
|
||||
echo "Initializing submodules..."
|
||||
if git submodule sync --recursive 2>/dev/null; then
|
||||
git submodule update --init --force --recursive || {
|
||||
echo "Warning: Some submodules failed to initialize, continuing anyway..."
|
||||
}
|
||||
else
|
||||
echo "Warning: Submodule sync failed, continuing without submodules..."
|
||||
fi
|
||||
else
|
||||
echo ".gitmodules exists but is empty, skipping submodule initialization"
|
||||
fi
|
||||
else
|
||||
echo "No .gitmodules file found, no submodules to initialize"
|
||||
fi
|
||||
|
||||
# Step 2: Set up Git with official account
|
||||
- name: Set up Git
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
# Step 3: Check and delete existing tag
|
||||
- name: Check and delete existing tag
|
||||
run: |
|
||||
if git rev-parse ${{ env.TAG_VERSION }} >/dev/null 2>&1; then
|
||||
git tag -d ${{ env.TAG_VERSION }}
|
||||
git push --delete origin ${{ env.TAG_VERSION }}
|
||||
fi
|
||||
|
||||
# Step 4: Update version file
|
||||
- name: Update version file
|
||||
run: |
|
||||
mkdir -p version
|
||||
echo -n "${{ env.TAG_VERSION }}" > version/version
|
||||
|
||||
# Step 5: Commit and push changes
|
||||
- name: Commit and push changes
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
git add version/version
|
||||
git commit -m "Update version to ${{ env.TAG_VERSION }}"
|
||||
|
||||
# Step 6: Update tag
|
||||
- name: Update tag
|
||||
run: |
|
||||
git tag -fa ${{ env.TAG_VERSION }} -m "Update version to ${{ env.TAG_VERSION }}"
|
||||
git push origin ${{ env.TAG_VERSION }} --force
|
||||
|
||||
# Step 7: Find and Publish Draft Release
|
||||
- name: Find and Publish Draft Release
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const { owner, repo } = context.repo;
|
||||
const tagName = process.env.TAG_VERSION;
|
||||
|
||||
try {
|
||||
let release;
|
||||
try {
|
||||
const response = await github.rest.repos.getReleaseByTag({
|
||||
owner,
|
||||
repo,
|
||||
tag: tagName
|
||||
});
|
||||
release = response.data;
|
||||
} catch (tagError) {
|
||||
core.info(`Release not found by tag, searching all releases...`);
|
||||
const releases = await github.rest.repos.listReleases({
|
||||
owner,
|
||||
repo,
|
||||
per_page: 100
|
||||
});
|
||||
|
||||
release = releases.data.find(r => r.draft && r.tag_name === tagName);
|
||||
if (!release) {
|
||||
throw new Error(`No release found with tag ${tagName}`);
|
||||
}
|
||||
}
|
||||
|
||||
await github.rest.repos.updateRelease({
|
||||
owner,
|
||||
repo,
|
||||
release_id: release.id,
|
||||
draft: false,
|
||||
prerelease: release.prerelease
|
||||
});
|
||||
|
||||
const status = release.draft ? "was draft" : "was already published";
|
||||
core.info(`Release ${tagName} ensured to be published (${status}).`);
|
||||
|
||||
} catch (error) {
|
||||
core.warning(`Could not find or update release for tag ${tagName}: ${error.message}`);
|
||||
}
|
||||
4
.github/workflows/user-first-interaction.yml
vendored
4
.github/workflows/user-first-interaction.yml
vendored
@ -22,7 +22,7 @@ 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-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A) 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.
|
||||
|
||||
@ -31,5 +31,5 @@ jobs:
|
||||
|
||||
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-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A) 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
|
||||
@ -28,8 +28,6 @@ run:
|
||||
# - util
|
||||
# - .*~
|
||||
# - api/swagger/docs
|
||||
|
||||
|
||||
# - server/docs
|
||||
# - components/mnt/config/certs
|
||||
# - logs
|
||||
|
||||
62
CHANGELOG/.chglog/CHANGELOG.tpl.md
Normal file
62
CHANGELOG/.chglog/CHANGELOG.tpl.md
Normal file
@ -0,0 +1,62 @@
|
||||
# Version logging for OpenIM
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
|
||||
|
||||
<!-- END MUNGE: GENERATED_TOC -->
|
||||
|
||||
{{ if .Versions -}}
|
||||
<a name="unreleased"></a>
|
||||
## [Unreleased]
|
||||
|
||||
{{ if .Unreleased.CommitGroups -}}
|
||||
{{ range .Unreleased.CommitGroups -}}
|
||||
### {{ .Title }}
|
||||
{{ range .Commits -}}
|
||||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ range .Versions }}
|
||||
<a name="{{ .Tag.Name }}"></a>
|
||||
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
|
||||
{{ range .CommitGroups -}}
|
||||
### {{ .Title }}
|
||||
{{ range .Commits -}}
|
||||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if .RevertCommits -}}
|
||||
### Reverts
|
||||
{{ range .RevertCommits -}}
|
||||
- {{ .Revert.Header }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if .MergeCommits -}}
|
||||
### Pull Requests
|
||||
{{ range .MergeCommits -}}
|
||||
- {{ .Header }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if .NoteGroups -}}
|
||||
{{ range .NoteGroups -}}
|
||||
### {{ .Title }}
|
||||
{{ range .Notes }}
|
||||
{{ .Body }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if .Versions }}
|
||||
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
|
||||
{{ range .Versions -}}
|
||||
{{ if .Tag.Previous -}}
|
||||
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
67
CHANGELOG/.chglog/config.yml
Normal file
67
CHANGELOG/.chglog/config.yml
Normal file
@ -0,0 +1,67 @@
|
||||
bin: git
|
||||
style: github
|
||||
template: CHANGELOG.tpl.md
|
||||
info:
|
||||
title: CHANGELOG
|
||||
repository_url: https://github.com/openimsdk/open-im-server
|
||||
options:
|
||||
tag_filter_pattern: '^v'
|
||||
sort: "date"
|
||||
|
||||
commits:
|
||||
filters:
|
||||
Type:
|
||||
- feat
|
||||
- fix
|
||||
- perf
|
||||
- refactor
|
||||
- docs
|
||||
- test
|
||||
- chore
|
||||
- ci
|
||||
- build
|
||||
sort_by: Scope
|
||||
|
||||
commit_groups:
|
||||
group_by: Type
|
||||
sort_by: Title
|
||||
title_order:
|
||||
- feat
|
||||
- fix
|
||||
- perf
|
||||
- refactor
|
||||
- docs
|
||||
- test
|
||||
- chore
|
||||
- ci
|
||||
- build
|
||||
title_maps:
|
||||
feat: Features
|
||||
|
||||
header:
|
||||
pattern: "<regexp>"
|
||||
pattern_maps:
|
||||
- PropName
|
||||
|
||||
issues:
|
||||
prefix:
|
||||
- #
|
||||
|
||||
refs:
|
||||
actions:
|
||||
- Closes
|
||||
- Fixes
|
||||
|
||||
merges:
|
||||
pattern: "^Merge branch '(\\w+)'$"
|
||||
pattern_maps:
|
||||
- Source
|
||||
|
||||
reverts:
|
||||
pattern: "^Revert \"([\\s\\S]*)\"$"
|
||||
pattern_maps:
|
||||
- Header
|
||||
|
||||
notes:
|
||||
keywords:
|
||||
- BREAKING CHANGE
|
||||
@ -1,70 +0,0 @@
|
||||
## [v3.8.3-patch.6](https://github.com/openimsdk/open-im-server/releases/tag/v3.8.3-patch.6) (2025-07-23)
|
||||
|
||||
### Bug Fixes
|
||||
* fix: Add friend DB in notification sender [#3438](https://github.com/openimsdk/open-im-server/pull/3438)
|
||||
* fix: remove update version file workflows have new line in 3.8.3-patch branch. [#3452](https://github.com/openimsdk/open-im-server/pull/3452)
|
||||
* fix: s3 aws init [#3454](https://github.com/openimsdk/open-im-server/pull/3454)
|
||||
* fix: use safe submodule init in workflows in v3.8.3-patch. [#3469](https://github.com/openimsdk/open-im-server/pull/3469)
|
||||
|
||||
**Full Changelog**: [v3.8.3-patch.5...v3.8.3-patch.6](https://github.com/openimsdk/open-im-server/compare/v3.8.3-patch.5...v3.8.3-patch.6)
|
||||
|
||||
## [v3.8.3-patch.5](https://github.com/openimsdk/open-im-server/releases/tag/v3.8.3-patch.5) (2025-06-10)
|
||||
|
||||
### New Features
|
||||
* feat: optimize friend and group applications [#3396](https://github.com/openimsdk/open-im-server/pull/3396)
|
||||
|
||||
### Bug Fixes
|
||||
* fix: solve unocrrect invite notification [Created [#3219](https://github.com/openimsdk/open-im-server/pull/3219)
|
||||
|
||||
### Builds
|
||||
* build: update gomake version in dockerfile.[Patch branch] [#3416](https://github.com/openimsdk/open-im-server/pull/3416)
|
||||
|
||||
**Full Changelog**: [v3.8.3...v3.8.3-patch.5](https://github.com/openimsdk/open-im-server/compare/v3.8.3...v3.8.3-patch.5)
|
||||
|
||||
## [v3.8.3-patch.4](https://github.com/openimsdk/open-im-server/releases/tag/v3.8.3-patch.4) (2025-03-13)
|
||||
|
||||
### Bug Fixes
|
||||
* fix: solve unocrrect invite notificationfrom #3213
|
||||
|
||||
**Full Changelog**: [v3.8.3-patch.3...v3.8.3-patch.4](https://github.com/openimsdk/open-im-server/compare/v3.8.3-patch.3...v3.8.3-patch.4)
|
||||
|
||||
## [v3.8.3-patch.3](https://github.com/openimsdk/open-im-server/releases/tag/v3.8.3-patch.3) (2025-03-07)
|
||||
|
||||
### New Features
|
||||
* feat: optimizing BatchGetIncrementalGroupMember #3180
|
||||
|
||||
### Bug Fixes
|
||||
* fix: solve uncorrect notification when set group info #3172
|
||||
* fix: the sorting is wrong after canceling the administrator in group settings #3185
|
||||
* fix: solve uncorrect GroupMember enter group notification type. #3188
|
||||
|
||||
### Refactors
|
||||
* refactor: change sendNotification to sendMessage to avoid ambiguity regarding message sending behavior. #3173
|
||||
|
||||
**Full Changelog**: [v3.8.3-patch.2...v3.8.3-patch.3](https://github.com/openimsdk/open-im-server/compare/v3.8.3-patch.2...v3.8.3-patch.3)
|
||||
|
||||
## [v3.8.3-patch.2](https://github.com/openimsdk/open-im-server/releases/tag/v3.8.3-patch.2) (2025-02-28)
|
||||
|
||||
### Bug Fixes
|
||||
* fix: Offline push does not have a badge && Android offline push (#3146) [#3174](https://github.com/openimsdk/open-im-server/pull/3174)
|
||||
|
||||
**Full Changelog**: [v3.8.3-patch.1...v3.8.3-patch.2](https://github.com/openimsdk/open-im-server/compare/v3.8.3-patch.1...v3.8.3-patch.2)
|
||||
|
||||
## [v3.8.3-patch.1](https://github.com/openimsdk/open-im-server/releases/tag/v3.8.3-patch.1) (2025-02-25)
|
||||
|
||||
### New Features
|
||||
* feat: add backup volume && optimize log print [Created [#3121](https://github.com/openimsdk/open-im-server/pull/3121)
|
||||
|
||||
### Bug Fixes
|
||||
* fix: seq conversion failed without exiting [Created [#3120](https://github.com/openimsdk/open-im-server/pull/3120)
|
||||
* fix: check error in BatchSetTokenMapByUidPid [Created [#3123](https://github.com/openimsdk/open-im-server/pull/3123)
|
||||
* fix: DeleteDoc crash [Created [#3124](https://github.com/openimsdk/open-im-server/pull/3124)
|
||||
* fix: the abnormal message has no sending time, causing the SDK to be abnormal [Created [#3126](https://github.com/openimsdk/open-im-server/pull/3126)
|
||||
* fix: crash caused [#3127](https://github.com/openimsdk/open-im-server/pull/3127)
|
||||
* fix: the user sets the conversation timer cleanup timestamp unit incorrectly [Created [#3128](https://github.com/openimsdk/open-im-server/pull/3128)
|
||||
* fix: seq conversion not reading env in docker environment [Created [#3131](https://github.com/openimsdk/open-im-server/pull/3131)
|
||||
|
||||
### Builds
|
||||
* build: improve workflows contents. [Created [#3125](https://github.com/openimsdk/open-im-server/pull/3125)
|
||||
|
||||
**Full Changelog**: [v3.8.3-e-v1.1.5...v3.8.3-patch.1-e-v1.1.5](https://github.com/openimsdk/open-im-server-enterprise/compare/v3.8.3-e-v1.1.5...v3.8.3-patch.1-e-v1.1.5)
|
||||
@ -1,4 +0,0 @@
|
||||
# CHANGELOGs
|
||||
|
||||
- [CHANGELOG-3.8.md](./CHANGELOG-3.8.md)
|
||||
|
||||
10
Dockerfile
10
Dockerfile
@ -1,5 +1,5 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Use Go 1.21 Alpine as the base image for building the application
|
||||
FROM golang:1.21-alpine as builder
|
||||
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
@ -8,7 +8,7 @@ ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# ENV GOPROXY=https://goproxy.io,direct
|
||||
ENV GOPROXY=https://goproxy.io,direct
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
@ -22,7 +22,7 @@ RUN go install github.com/magefile/mage@v1.15.0
|
||||
RUN mage build
|
||||
|
||||
# Using Alpine Linux with Go environment for the final image
|
||||
FROM golang:1.22-alpine
|
||||
FROM golang:1.21-alpine
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
@ -43,7 +43,7 @@ COPY --from=builder $SERVER_DIR/start-config.yml $SERVER_DIR/
|
||||
COPY --from=builder $SERVER_DIR/go.mod $SERVER_DIR/
|
||||
COPY --from=builder $SERVER_DIR/go.sum $SERVER_DIR/
|
||||
|
||||
RUN go get github.com/openimsdk/gomake@v0.0.15-alpha.1
|
||||
RUN go get github.com/openimsdk/gomake@v0.0.14-alpha.5
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]
|
||||
|
||||
40
README.md
40
README.md
@ -12,11 +12,11 @@
|
||||
[](https://goreportcard.com/report/github.com/openimsdk/open-im-server)
|
||||
[](https://pkg.go.dev/github.com/openimsdk/open-im-server/v3)
|
||||
[](https://github.com/openimsdk/open-im-server/blob/main/LICENSE)
|
||||
[](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A)
|
||||
[](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q)
|
||||
[](https://www.bestpractices.dev/projects/8045)
|
||||
[](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22)
|
||||
[](https://golang.org/)
|
||||
[](https://gurubase.io/g/openim)
|
||||
|
||||
|
||||
<p align="center">
|
||||
<a href="./README.md">English</a> ·
|
||||
@ -46,15 +46,16 @@
|
||||
<a href="./docs/readme/README_tr.md">Türkçe</a>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</p>
|
||||
|
||||
## :busts_in_silhouette: Join Our Community
|
||||
|
||||
- 💬 [Follow us on Twitter](https://twitter.com/founder_im63606)
|
||||
- 🚀 [Join our Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A)
|
||||
- :eyes: [Join our WeChat Group](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
|
||||
+ 💬 [Follow us on Twitter](https://twitter.com/founder_im63606)
|
||||
+ 🚀 [Join our Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A)
|
||||
+ :eyes: [Join our WeChat Group](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
|
||||
|
||||
## Ⓜ️ About OpenIM
|
||||
|
||||
@ -66,14 +67,13 @@ Unlike standalone chat applications such as Telegram, Signal, and Rocket.Chat, O
|
||||
|
||||
**OpenIMSDK**, designed for **OpenIMServer**, is an IM SDK created specifically for integration into client applications. It supports various functionalities and modules:
|
||||
|
||||
- 🌟 Main Features:
|
||||
|
||||
+ 🌟 Main Features:
|
||||
- 📦 Local Storage
|
||||
- 🔔 Listener Callbacks
|
||||
- 🛡️ API Wrapping
|
||||
- 🌐 Connection Management
|
||||
|
||||
- 📚 Main Modules:
|
||||
+ 📚 Main Modules:
|
||||
1. 🚀 Initialization and Login
|
||||
2. 👤 User Management
|
||||
3. 👫 Friends Management
|
||||
@ -86,16 +86,16 @@ Built with Golang and supports cross-platform deployment to ensure a consistent
|
||||
|
||||
## 🌐 Introduction to OpenIMServer
|
||||
|
||||
- **OpenIMServer** features include:
|
||||
+ **OpenIMServer** features include:
|
||||
- 🌐 Microservices Architecture: Supports cluster mode, including a gateway and multiple rpc services.
|
||||
- 🚀 Diverse Deployment Options: Supports source code, Kubernetes, or Docker deployment.
|
||||
- Massive User Support: Supports large-scale groups with hundreds of thousands, millions of users, and billions of messages.
|
||||
|
||||
### Enhanced Business Functions:
|
||||
|
||||
- **REST API**: Provides a REST API for business systems to enhance functionality, such as group creation and message pushing through backend interfaces.
|
||||
+ **REST API**: Provides a REST API for business systems to enhance functionality, such as group creation and message pushing through backend interfaces.
|
||||
|
||||
- **Webhooks**: Expands business forms through callbacks, sending requests to business servers before or after certain events.
|
||||
+ **Webhooks**: Expands business forms through callbacks, sending requests to business servers before or after certain events.
|
||||
|
||||

|
||||
|
||||
@ -107,8 +107,8 @@ Experience online for iOS/Android/H5/PC/Web:
|
||||
|
||||
To facilitate user experience, we offer various deployment solutions. You can choose your preferred deployment method from the list below:
|
||||
|
||||
- **[Source Code Deployment Guide](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
||||
- **[Docker Deployment Guide](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
||||
+ **[Source Code Deployment Guide](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
||||
+ **[Docker Deployment Guide](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
||||
|
||||
## System Support
|
||||
|
||||
@ -116,22 +116,24 @@ Supports Linux, Windows, Mac systems, and ARM and AMD CPU architectures.
|
||||
|
||||
## :link: Links
|
||||
|
||||
- **[Developer Manual](https://docs.openim.io/)**
|
||||
- **[Changelog](https://github.com/openimsdk/open-im-server/blob/main/CHANGELOG.md)**
|
||||
+ **[Developer Manual](https://docs.openim.io/)**
|
||||
+ **[Changelog](https://github.com/openimsdk/open-im-server/blob/main/CHANGELOG.md)**
|
||||
|
||||
## :writing_hand: How to Contribute
|
||||
|
||||
We welcome contributions of any kind! Please make sure to read our [Contributor Documentation](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md) before submitting a Pull Request.
|
||||
|
||||
- **[Report a Bug](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=bug&template=bug_report.md&title=)**
|
||||
- **[Suggest a Feature](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)**
|
||||
- **[Submit a Pull Request](https://github.com/openimsdk/open-im-server/pulls)**
|
||||
+ **[Report a Bug](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=bug&template=bug_report.md&title=)**
|
||||
+ **[Suggest a Feature](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)**
|
||||
+ **[Submit a Pull Request](https://github.com/openimsdk/open-im-server/pulls)**
|
||||
|
||||
Thank you for contributing to building a powerful instant messaging solution!
|
||||
|
||||
## :closed_book: License
|
||||
|
||||
This software is licensed under the Apache License 2.0
|
||||
OpenIMSDK is available under the Apache License 2.0. See the [LICENSE file](https://github.com/openimsdk/open-im-server/blob/main/LICENSE) for more information.
|
||||
|
||||
|
||||
|
||||
## 🔮 Thanks to our contributors!
|
||||
|
||||
|
||||
@ -12,11 +12,12 @@
|
||||
[](https://goreportcard.com/report/github.com/openimsdk/open-im-server)
|
||||
[](https://pkg.go.dev/github.com/openimsdk/open-im-server/v3)
|
||||
[](https://github.com/openimsdk/open-im-server/blob/main/LICENSE)
|
||||
[](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A)
|
||||
[](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q)
|
||||
[](https://www.bestpractices.dev/projects/8045)
|
||||
[](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22)
|
||||
[](https://golang.org/)
|
||||
|
||||
|
||||
<p align="center">
|
||||
<a href="./README.md">English</a> ·
|
||||
<a href="./README_zh_CN.md">中文</a> ·
|
||||
@ -45,34 +46,34 @@
|
||||
<a href="./docs/readme/README_tr.md">Türkçe</a>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</p>
|
||||
|
||||
## :busts_in_silhouette: 加入我们的社区
|
||||
|
||||
- 💬 [关注我们的 Twitter](https://twitter.com/founder_im63606)
|
||||
- 🚀 [加入我们的 Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-2hljfom5u-9ZuzP3NfEKW~BJKbpLm0Hw)
|
||||
- :eyes: [加入我们的微信群](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
|
||||
+ 💬 [关注我们的 Twitter](https://twitter.com/founder_im63606)
|
||||
+ 🚀 [加入我们的 Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-2hljfom5u-9ZuzP3NfEKW~BJKbpLm0Hw)
|
||||
+ :eyes: [加入我们的微信群](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
|
||||
|
||||
## Ⓜ️ 关于 OpenIM
|
||||
|
||||
与 Telegram、Signal、Rocket.Chat 等独立聊天应用不同,OpenIM 提供了专为开发者设计的开源即时通讯解决方案,而不是直接安装使用的独立聊天应用。OpenIM 由 OpenIM SDK 和 OpenIM Server 两大部分组成,为开发者提供了一整套集成即时通讯功能的工具和服务,包括消息发送接收、用户管理和群组管理等。总体来说,OpenIM 旨在为开发者提供必要的工具和框架,帮助他们在自己的应用中实现高效的即时通讯解决方案。
|
||||
与Telegram、Signal、Rocket.Chat等独立聊天应用不同,OpenIM提供了专为开发者设计的开源即时通讯解决方案,而不是直接安装使用的独立聊天应用。OpenIM由OpenIM SDK和OpenIM Server两大部分组成,为开发者提供了一整套集成即时通讯功能的工具和服务,包括消息发送接收、用户管理和群组管理等。总体来说,OpenIM旨在为开发者提供必要的工具和框架,帮助他们在自己的应用中实现高效的即时通讯解决方案。
|
||||
|
||||

|
||||
|
||||
## 🚀 OpenIMSDK 介绍
|
||||
|
||||
**OpenIMSDK** 是为 **OpenIMServer** 设计的 IM SDK,专为集成到客户端应用而生。它支持多种功能和模块:
|
||||
|
||||
- 🌟 主要功能:
|
||||
**OpenIMSDK** 是为 **OpenIMServer** 设计的IM SDK,专为集成到客户端应用而生。它支持多种功能和模块:
|
||||
|
||||
+ 🌟 主要功能:
|
||||
- 📦 本地存储
|
||||
- 🔔 监听器回调
|
||||
- 🛡️ API 封装
|
||||
- 🛡️ API封装
|
||||
- 🌐 连接管理
|
||||
|
||||
- 📚 主要模块:
|
||||
+ 📚 主要模块:
|
||||
1. 🚀 初始化及登录
|
||||
2. 👤 用户管理
|
||||
3. 👫 好友管理
|
||||
@ -85,29 +86,31 @@
|
||||
|
||||
## 🌐 OpenIMServer 介绍
|
||||
|
||||
- **OpenIMServer** 的特点包括:
|
||||
- 🌐 微服务架构:支持集群模式,包括网关(gateway)和多个 rpc 服务。
|
||||
- 🚀 多样的部署方式:支持源代码、Kubernetes 或 Docker 部署。
|
||||
+ **OpenIMServer** 的特点包括:
|
||||
- 🌐 微服务架构:支持集群模式,包括网关(gateway)和多个rpc服务。
|
||||
- 🚀 多样的部署方式:支持源代码、Kubernetes或Docker部署。
|
||||
- 海量用户支持:支持十万级超大群组,千万级用户和百亿级消息。
|
||||
|
||||
### 增强的业务功能:
|
||||
|
||||
- **REST API**:为业务系统提供 REST API,增加群组创建、消息推送等后台接口功能。
|
||||
+ **REST API**:为业务系统提供REST API,增加群组创建、消息推送等后台接口功能。
|
||||
|
||||
- **Webhooks**:通过事件前后的回调,向业务服务器发送请求,扩展更多的业务形态。
|
||||
+ **Webhooks**:通过事件前后的回调,向业务服务器发送请求,扩展更多的业务形态。
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
## :rocket: 快速入门
|
||||
|
||||
在线体验 iOS/Android/H5/PC/Web:
|
||||
在线体验iOS/Android/H5/PC/Web:
|
||||
|
||||
👉 **[OpenIM 在线演示](https://www.openim.io/en/commercial)**
|
||||
👉 **[OpenIM在线演示](https://www.openim.io/en/commercial)**
|
||||
|
||||
为了便于用户体验,我们提供了多种部署解决方案,您可以根据以下列表选择适合您的部署方式:
|
||||
|
||||
- **[源代码部署指南](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
||||
- **[Docker 部署指南](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
||||
+ **[源代码部署指南](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
||||
+ **[Docker 部署指南](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
||||
|
||||
## 系统支持
|
||||
|
||||
@ -115,22 +118,22 @@
|
||||
|
||||
## :link: 相关链接
|
||||
|
||||
- **[开发手册](https://docs.openim.io/)**
|
||||
- **[更新日志](https://github.com/openimsdk/open-im-server/blob/main/CHANGELOG.md)**
|
||||
+ **[开发手册](https://docs.openim.io/)**
|
||||
+ **[更新日志](https://github.com/openimsdk/open-im-server/blob/main/CHANGELOG.md)**
|
||||
|
||||
## :writing_hand: 如何贡献
|
||||
|
||||
我们欢迎任何形式的贡献!在提交 Pull Request 之前,请确保阅读我们的[贡献者文档](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md)
|
||||
|
||||
- **[报告 Bug](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=bug&template=bug_report.md&title=)**
|
||||
- **[提出新特性](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)**
|
||||
- **[提交 Pull Request](https://github.com/openimsdk/open-im-server/pulls)**
|
||||
+ **[报告 Bug](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=bug&template=bug_report.md&title=)**
|
||||
+ **[提出新特性](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)**
|
||||
+ **[提交 Pull Request](https://github.com/openimsdk/open-im-server/pulls)**
|
||||
|
||||
感谢您的贡献,一起来打造强大的即时通讯解决方案!
|
||||
|
||||
## :closed_book: 开源许可证 License
|
||||
## :closed_book: 许可证
|
||||
|
||||
This software is licensed under the Apache License 2.0
|
||||
OpenIMSDK 在 Apache License 2.0 许可下可用。查看[LICENSE 文件](https://github.com/openimsdk/open-im-server/blob/main/LICENSE)了解更多信息。
|
||||
|
||||
## 🔮 Thanks to our contributors!
|
||||
|
||||
|
||||
@ -53,8 +53,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-cmdutils
|
||||
id: openim-cmdutils
|
||||
@ -64,8 +71,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-crontask
|
||||
id: openim-crontask
|
||||
@ -75,8 +89,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-msggateway
|
||||
id: openim-msggateway
|
||||
@ -86,8 +107,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-msgtransfer
|
||||
id: openim-msgtransfer
|
||||
@ -97,8 +125,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-push
|
||||
id: openim-push
|
||||
@ -108,8 +143,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-rpc-auth
|
||||
id: openim-rpc-auth
|
||||
@ -119,8 +161,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-rpc-conversation
|
||||
id: openim-rpc-conversation
|
||||
@ -130,8 +179,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-rpc-friend
|
||||
id: openim-rpc-friend
|
||||
@ -141,8 +197,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-rpc-group
|
||||
id: openim-rpc-group
|
||||
@ -152,8 +215,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-rpc-msg
|
||||
id: openim-rpc-msg
|
||||
@ -163,8 +233,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-rpc-third
|
||||
id: openim-rpc-third
|
||||
@ -174,8 +251,15 @@ builds:
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: openim-rpc-user
|
||||
id: openim-rpc-user
|
||||
@ -185,8 +269,15 @@ builds:
|
||||
- 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
|
||||
|
||||
@ -1,24 +1,24 @@
|
||||
# # 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.
|
||||
# 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.
|
||||
|
||||
# FROM BASE_IMAGE
|
||||
FROM BASE_IMAGE
|
||||
|
||||
# WORKDIR ${SERVER_WORKDIR}
|
||||
WORKDIR ${SERVER_WORKDIR}
|
||||
|
||||
# # Set HTTP proxy
|
||||
# ARG BINARY_NAME
|
||||
# Set HTTP proxy
|
||||
ARG BINARY_NAME
|
||||
|
||||
# COPY BINARY_NAME ./bin/BINARY_NAME
|
||||
COPY BINARY_NAME ./bin/BINARY_NAME
|
||||
|
||||
# ENTRYPOINT ["./bin/BINARY_NAME"]
|
||||
ENTRYPOINT ["./bin/BINARY_NAME"]
|
||||
@ -1,36 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# 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.
|
||||
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-api
|
||||
|
||||
RUN go build -o _output/openim-api ./cmd/openim-api
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-api /usr/bin/openim-api
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
COPY --from=builder /usr/bin/openim-api ./bin/openim-api
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-api"]
|
||||
ENTRYPOINT ["./bin/openim-api"]
|
||||
|
||||
44
build/images/openim-cmdutils/Dockerfile
Normal file
44
build/images/openim-cmdutils/Dockerfile
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN make build BINS=openim-cmdutils
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-cmdutils /usr/bin/openim-cmdutils
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-cmdutils ./bin/openim-cmdutils
|
||||
|
||||
ENTRYPOINT ["./bin/openim-cmdutils"]
|
||||
|
||||
CMD ["--help"]
|
||||
@ -1,39 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-crontask
|
||||
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-crontask /usr/bin/openim-crontask
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
RUN go build -o _output/openim-crontask ./cmd/openim-crontask
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-crontask ./bin/openim-crontask
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-crontask"]
|
||||
ENTRYPOINT ["./bin/openim-crontask"]
|
||||
|
||||
@ -1,39 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-msggateway
|
||||
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-msggateway /usr/bin/openim-msggateway
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
RUN go build -o _output/openim-msggateway ./cmd/openim-msggateway
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-msggateway ./bin/openim-msggateway
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-msggateway"]
|
||||
ENTRYPOINT ["./bin/openim-msggateway"]
|
||||
|
||||
@ -1,39 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-msgtransfer
|
||||
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-msgtransfer /usr/bin/openim-msgtransfer
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
RUN go build -o _output/openim-msgtransfer ./cmd/openim-msgtransfer
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-msgtransfer ./bin/openim-msgtransfer
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-msgtransfer"]
|
||||
ENTRYPOINT ["./bin/openim-msgtransfer"]
|
||||
|
||||
@ -1,39 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-push
|
||||
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-push /usr/bin/openim-push
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
RUN go build -o _output/openim-push ./cmd/openim-push
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-push ./bin/openim-push
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-push"]
|
||||
ENTRYPOINT ["./bin/openim-push"]
|
||||
|
||||
@ -1,39 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-rpc-auth
|
||||
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth /usr/bin/openim-rpc-auth
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
RUN go build -o _output/openim-rpc-auth ./cmd/openim-rpc/openim-rpc-auth
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-rpc-auth ./bin/openim-rpc-auth
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-auth"]
|
||||
ENTRYPOINT ["./bin/openim-rpc-auth"]
|
||||
|
||||
@ -1,39 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-rpc-conversation
|
||||
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation /usr/bin/openim-rpc-conversation
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
RUN go build -o _output/openim-rpc-conversation ./cmd/openim-rpc/openim-rpc-conversation
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-rpc-conversation ./bin/openim-rpc-conversation
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-conversation"]
|
||||
ENTRYPOINT ["./bin/openim-rpc-conversation"]
|
||||
|
||||
@ -1,39 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-rpc-friend
|
||||
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend /usr/bin/openim-rpc-friend
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
RUN go build -o _output/openim-rpc-friend ./cmd/openim-rpc/openim-rpc-friend
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-rpc-friend ./bin/openim-rpc-friend
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-friend"]
|
||||
ENTRYPOINT ["./bin/openim-rpc-friend"]
|
||||
|
||||
@ -1,39 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-rpc-group
|
||||
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group /usr/bin/openim-rpc-group
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
RUN go build -o _output/openim-rpc-group ./cmd/openim-rpc/openim-rpc-group
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-rpc-group ./bin/openim-rpc-group
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-group"]
|
||||
ENTRYPOINT ["./bin/openim-rpc-group"]
|
||||
|
||||
@ -1,39 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-rpc-msg
|
||||
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg /usr/bin/openim-rpc-msg
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
RUN go build -o _output/openim-rpc-msg ./cmd/openim-rpc/openim-rpc-msg
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-rpc-msg ./bin/openim-rpc-msg
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-msg"]
|
||||
ENTRYPOINT ["./bin/openim-rpc-msg"]
|
||||
|
||||
@ -1,39 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-rpc-third
|
||||
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third /usr/bin/openim-rpc-third
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
RUN go build -o _output/openim-rpc-third ./cmd/openim-rpc/openim-rpc-third
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /usr/bin/openim-rpc-third ./bin/openim-rpc-third
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-third"]
|
||||
ENTRYPOINT ["./bin/openim-rpc-third"]
|
||||
|
||||
@ -1,37 +1,44 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
# 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.
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod tidy
|
||||
RUN make build BINS=openim-rpc-user
|
||||
|
||||
RUN go build -o _output/openim-rpc-user ./cmd/openim-rpc/openim-rpc-user
|
||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user /usr/bin/openim-rpc-user
|
||||
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
COPY --from=builder /usr/bin/openim-rpc-user ./bin/openim-rpc-user
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
# COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-user"]
|
||||
ENTRYPOINT ["./bin/openim-rpc-user"]
|
||||
|
||||
@ -1,108 +1,48 @@
|
||||
# # 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
|
||||
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
|
||||
# WORKDIR /openim/openim-server
|
||||
|
||||
# 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
|
||||
#
|
||||
# ENV GOPROXY=$GOPROXY
|
||||
# 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.
|
||||
|
||||
# COPY go.mod go.sum ./
|
||||
# RUN go mod download
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# COPY . .
|
||||
# Set go mod installation source and proxy
|
||||
|
||||
# RUN make clean
|
||||
# RUN make build BINS=component
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
# # FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
ARG GO111MODULE=on
|
||||
|
||||
# WORKDIR /openim/openim-server
|
||||
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"]
|
||||
|
||||
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
|
||||
#ENV GOPROXY=https://goproxy.io,direct
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Install Mage to use for building the application
|
||||
RUN go install github.com/magefile/mage@v1.15.0
|
||||
COPY . .
|
||||
|
||||
# ENV BINS=openim-rpc-user
|
||||
RUN make clean
|
||||
RUN make build BINS=component
|
||||
|
||||
# Optionally build your application if needed
|
||||
# RUN mage build ${BINS} check-free-memory seq || true
|
||||
RUN mage build check-free-memory seq || true
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
# Using Alpine Linux with Go environment for the final image
|
||||
FROM golang:1.22-alpine
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add bash
|
||||
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
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
ENV OPENIM_SERVER_CONFIG_NAME=/openim/openim-server/config
|
||||
|
||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/component /usr/bin/component
|
||||
|
||||
# Copy the compiled binaries and mage from the builder image to the final image
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
|
||||
COPY --from=builder /go/bin/mage /usr/local/bin/mage
|
||||
COPY --from=builder $SERVER_DIR/magefile_windows.go $SERVER_DIR/
|
||||
COPY --from=builder $SERVER_DIR/magefile_unix.go $SERVER_DIR/
|
||||
COPY --from=builder $SERVER_DIR/magefile.go $SERVER_DIR/
|
||||
# COPY --from=builder $SERVER_DIR/start-config.yml $SERVER_DIR/
|
||||
COPY --from=builder $SERVER_DIR/go.mod $SERVER_DIR/
|
||||
COPY --from=builder $SERVER_DIR/go.sum $SERVER_DIR/
|
||||
|
||||
|
||||
RUN echo -e "serviceBinaries:\n \n" \
|
||||
> $SERVER_DIR/start-config.yml && \
|
||||
echo -e "toolBinaries:\n - check-free-memory\n - seq\n" >> $SERVER_DIR/start-config.yml && \
|
||||
echo "maxFileDescriptors: 10000" >> $SERVER_DIR/start-config.yml
|
||||
|
||||
RUN go get github.com/openimsdk/gomake@v0.0.15-alpha.1
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]
|
||||
ENTRYPOINT ["bash", "-c", "component -c $OPENIM_SERVER_CONFIG_NAME"]
|
||||
|
||||
406
cmd/main.go
406
cmd/main.go
@ -1,406 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/api"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/msggateway"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/msgtransfer"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/push"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/auth"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/conversation"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/group"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/msg"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/relation"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/third"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/user"
|
||||
"github.com/openimsdk/open-im-server/v3/internal/tools/cron"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
|
||||
"github.com/openimsdk/open-im-server/v3/version"
|
||||
"github.com/openimsdk/tools/discovery"
|
||||
"github.com/openimsdk/tools/discovery/standalone"
|
||||
"github.com/openimsdk/tools/log"
|
||||
"github.com/openimsdk/tools/system/program"
|
||||
"github.com/openimsdk/tools/utils/datautil"
|
||||
"github.com/spf13/viper"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func init() {
|
||||
config.SetStandalone()
|
||||
prommetrics.RegistryAll()
|
||||
}
|
||||
|
||||
func main() {
|
||||
var configPath string
|
||||
flag.StringVar(&configPath, "c", "", "config path")
|
||||
flag.Parse()
|
||||
if configPath == "" {
|
||||
_, _ = fmt.Fprintln(os.Stderr, "config path is empty")
|
||||
os.Exit(1)
|
||||
return
|
||||
}
|
||||
cmd := newCmds(configPath)
|
||||
putCmd(cmd, false, auth.Start)
|
||||
putCmd(cmd, false, conversation.Start)
|
||||
putCmd(cmd, false, relation.Start)
|
||||
putCmd(cmd, false, group.Start)
|
||||
putCmd(cmd, false, msg.Start)
|
||||
putCmd(cmd, false, third.Start)
|
||||
putCmd(cmd, false, user.Start)
|
||||
putCmd(cmd, false, push.Start)
|
||||
putCmd(cmd, true, msggateway.Start)
|
||||
putCmd(cmd, true, msgtransfer.Start)
|
||||
putCmd(cmd, true, api.Start)
|
||||
putCmd(cmd, true, cron.Start)
|
||||
ctx := context.Background()
|
||||
if err := cmd.run(ctx); err != nil {
|
||||
_, _ = fmt.Fprintf(os.Stderr, "server exit %s", err)
|
||||
os.Exit(1)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func newCmds(confPath string) *cmds {
|
||||
return &cmds{confPath: confPath}
|
||||
}
|
||||
|
||||
type cmdName struct {
|
||||
Name string
|
||||
Func func(ctx context.Context) error
|
||||
Block bool
|
||||
}
|
||||
type cmds struct {
|
||||
confPath string
|
||||
cmds []cmdName
|
||||
config config.AllConfig
|
||||
conf map[string]reflect.Value
|
||||
}
|
||||
|
||||
func (x *cmds) getTypePath(typ reflect.Type) string {
|
||||
return path.Join(typ.PkgPath(), typ.Name())
|
||||
}
|
||||
|
||||
func (x *cmds) initDiscovery() {
|
||||
x.config.Discovery.Enable = "standalone"
|
||||
vof := reflect.ValueOf(&x.config.Discovery.RpcService).Elem()
|
||||
tof := reflect.TypeOf(&x.config.Discovery.RpcService).Elem()
|
||||
num := tof.NumField()
|
||||
for i := 0; i < num; i++ {
|
||||
field := tof.Field(i)
|
||||
if !field.IsExported() {
|
||||
continue
|
||||
}
|
||||
if field.Type.Kind() != reflect.String {
|
||||
continue
|
||||
}
|
||||
vof.Field(i).SetString(field.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *cmds) initAllConfig() error {
|
||||
x.conf = make(map[string]reflect.Value)
|
||||
vof := reflect.ValueOf(&x.config).Elem()
|
||||
num := vof.NumField()
|
||||
for i := 0; i < num; i++ {
|
||||
field := vof.Field(i)
|
||||
for ptr := true; ptr; {
|
||||
if field.Kind() == reflect.Ptr {
|
||||
field = field.Elem()
|
||||
} else {
|
||||
ptr = false
|
||||
}
|
||||
}
|
||||
x.conf[x.getTypePath(field.Type())] = field
|
||||
val := field.Addr().Interface()
|
||||
name := val.(interface{ GetConfigFileName() string }).GetConfigFileName()
|
||||
confData, err := os.ReadFile(filepath.Join(x.confPath, name))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
v := viper.New()
|
||||
v.SetConfigType("yaml")
|
||||
if err := v.ReadConfig(bytes.NewReader(confData)); err != nil {
|
||||
return err
|
||||
}
|
||||
opt := func(conf *mapstructure.DecoderConfig) {
|
||||
conf.TagName = config.StructTagName
|
||||
}
|
||||
if err := v.Unmarshal(val, opt); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
x.initDiscovery()
|
||||
x.config.Redis.Disable = false
|
||||
x.config.LocalCache = config.LocalCache{}
|
||||
config.InitNotification(&x.config.Notification)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *cmds) parseConf(conf any) error {
|
||||
vof := reflect.ValueOf(conf)
|
||||
for {
|
||||
if vof.Kind() == reflect.Ptr {
|
||||
vof = vof.Elem()
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
tof := vof.Type()
|
||||
numField := vof.NumField()
|
||||
for i := 0; i < numField; i++ {
|
||||
typeField := tof.Field(i)
|
||||
if !typeField.IsExported() {
|
||||
continue
|
||||
}
|
||||
field := vof.Field(i)
|
||||
pkt := x.getTypePath(field.Type())
|
||||
val, ok := x.conf[pkt]
|
||||
if !ok {
|
||||
switch field.Interface().(type) {
|
||||
case config.Index:
|
||||
case config.Path:
|
||||
field.SetString(x.confPath)
|
||||
case config.AllConfig:
|
||||
field.Set(reflect.ValueOf(x.config))
|
||||
case *config.AllConfig:
|
||||
field.Set(reflect.ValueOf(&x.config))
|
||||
default:
|
||||
return fmt.Errorf("config field %s %s not found", vof.Type().Name(), typeField.Name)
|
||||
}
|
||||
continue
|
||||
}
|
||||
field.Set(val)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *cmds) add(name string, block bool, fn func(ctx context.Context) error) {
|
||||
x.cmds = append(x.cmds, cmdName{Name: name, Block: block, Func: fn})
|
||||
}
|
||||
|
||||
func (x *cmds) initLog() error {
|
||||
conf := x.config.Log
|
||||
if err := log.InitLoggerFromConfig(
|
||||
"openim-server",
|
||||
program.GetProcessName(),
|
||||
"", "",
|
||||
conf.RemainLogLevel,
|
||||
conf.IsStdout,
|
||||
conf.IsJson,
|
||||
conf.StorageLocation,
|
||||
conf.RemainRotationCount,
|
||||
conf.RotationTime,
|
||||
strings.TrimSpace(version.Version),
|
||||
conf.IsSimplify,
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (x *cmds) run(ctx context.Context) error {
|
||||
if len(x.cmds) == 0 {
|
||||
return fmt.Errorf("no command to run")
|
||||
}
|
||||
if err := x.initAllConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := x.initLog(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancelCause(ctx)
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
log.ZError(ctx, "context server exit cause", context.Cause(ctx))
|
||||
}()
|
||||
|
||||
if prometheus := x.config.API.Prometheus; prometheus.Enable {
|
||||
var (
|
||||
port int
|
||||
err error
|
||||
)
|
||||
if !prometheus.AutoSetPorts {
|
||||
port, err = datautil.GetElemByIndex(prometheus.Ports, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
|
||||
if err != nil {
|
||||
return fmt.Errorf("prometheus listen %d error %w", port, err)
|
||||
}
|
||||
defer listener.Close()
|
||||
log.ZDebug(ctx, "prometheus start", "addr", listener.Addr())
|
||||
go func() {
|
||||
err := prommetrics.Start(listener)
|
||||
if err == nil {
|
||||
err = fmt.Errorf("http done")
|
||||
}
|
||||
cancel(fmt.Errorf("prometheus %w", err))
|
||||
}()
|
||||
}
|
||||
|
||||
go func() {
|
||||
sigs := make(chan os.Signal, 1)
|
||||
signal.Notify(sigs, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case val := <-sigs:
|
||||
log.ZDebug(ctx, "recv signal", "signal", val.String())
|
||||
cancel(fmt.Errorf("signal %s", val.String()))
|
||||
}
|
||||
}()
|
||||
|
||||
for i := range x.cmds {
|
||||
cmd := x.cmds[i]
|
||||
if cmd.Block {
|
||||
continue
|
||||
}
|
||||
if err := cmd.Func(ctx); err != nil {
|
||||
cancel(fmt.Errorf("server %s exit %w", cmd.Name, err))
|
||||
return err
|
||||
}
|
||||
go func() {
|
||||
if cmd.Block {
|
||||
cancel(fmt.Errorf("server %s exit", cmd.Name))
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
var wait cmdManger
|
||||
for i := range x.cmds {
|
||||
cmd := x.cmds[i]
|
||||
if !cmd.Block {
|
||||
continue
|
||||
}
|
||||
wait.Start(cmd.Name)
|
||||
go func() {
|
||||
defer wait.Shutdown(cmd.Name)
|
||||
if err := cmd.Func(ctx); err != nil {
|
||||
cancel(fmt.Errorf("server %s exit %w", cmd.Name, err))
|
||||
return
|
||||
}
|
||||
cancel(fmt.Errorf("server %s exit", cmd.Name))
|
||||
}()
|
||||
}
|
||||
<-ctx.Done()
|
||||
exitCause := context.Cause(ctx)
|
||||
log.ZWarn(ctx, "notification of service closure", exitCause)
|
||||
done := wait.Wait()
|
||||
timeout := time.NewTimer(time.Second * 10)
|
||||
defer timeout.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-timeout.C:
|
||||
log.ZWarn(ctx, "server exit timeout", nil, "running", wait.Running())
|
||||
return exitCause
|
||||
case _, ok := <-done:
|
||||
if ok {
|
||||
log.ZWarn(ctx, "waiting for the service to exit", nil, "running", wait.Running())
|
||||
} else {
|
||||
log.ZInfo(ctx, "all server exit done")
|
||||
return exitCause
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func putCmd[C any](cmd *cmds, block bool, fn func(ctx context.Context, config *C, client discovery.SvcDiscoveryRegistry, server grpc.ServiceRegistrar) error) {
|
||||
name := path.Base(runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())
|
||||
if index := strings.Index(name, "."); index >= 0 {
|
||||
name = name[:index]
|
||||
}
|
||||
cmd.add(name, block, func(ctx context.Context) error {
|
||||
var conf C
|
||||
if err := cmd.parseConf(&conf); err != nil {
|
||||
return err
|
||||
}
|
||||
return fn(ctx, &conf, standalone.GetSvcDiscoveryRegistry(), standalone.GetServiceRegistrar())
|
||||
})
|
||||
}
|
||||
|
||||
type cmdManger struct {
|
||||
lock sync.Mutex
|
||||
done chan struct{}
|
||||
count int
|
||||
names map[string]struct{}
|
||||
}
|
||||
|
||||
func (x *cmdManger) Start(name string) {
|
||||
x.lock.Lock()
|
||||
defer x.lock.Unlock()
|
||||
if x.names == nil {
|
||||
x.names = make(map[string]struct{})
|
||||
}
|
||||
if x.done == nil {
|
||||
x.done = make(chan struct{}, 1)
|
||||
}
|
||||
if _, ok := x.names[name]; ok {
|
||||
panic(fmt.Errorf("cmd %s already exists", name))
|
||||
}
|
||||
x.count++
|
||||
x.names[name] = struct{}{}
|
||||
}
|
||||
|
||||
func (x *cmdManger) Shutdown(name string) {
|
||||
x.lock.Lock()
|
||||
defer x.lock.Unlock()
|
||||
if _, ok := x.names[name]; !ok {
|
||||
panic(fmt.Errorf("cmd %s not exists", name))
|
||||
}
|
||||
delete(x.names, name)
|
||||
x.count--
|
||||
if x.count == 0 {
|
||||
close(x.done)
|
||||
} else {
|
||||
select {
|
||||
case x.done <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *cmdManger) Wait() <-chan struct{} {
|
||||
x.lock.Lock()
|
||||
defer x.lock.Unlock()
|
||||
if x.count == 0 || x.done == nil {
|
||||
tmp := make(chan struct{})
|
||||
close(tmp)
|
||||
return tmp
|
||||
}
|
||||
return x.done
|
||||
}
|
||||
|
||||
func (x *cmdManger) Running() []string {
|
||||
x.lock.Lock()
|
||||
defer x.lock.Unlock()
|
||||
names := make([]string, 0, len(x.names))
|
||||
for name := range x.names {
|
||||
names = append(names, name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
@ -15,9 +15,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "net/http/pprof"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
"github.com/openimsdk/tools/system/program"
|
||||
_ "net/http/pprof"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
102
config/README.md
102
config/README.md
@ -1,66 +1,48 @@
|
||||
# OpenIM Configuration File Descriptions and Common Configuration Modifications
|
||||
---
|
||||
title: 'OpenIM Configuration Files and Common Configuration Item Modifications Guide'
|
||||
|
||||
## External Component Configurations
|
||||
## Configuration Files Explanation
|
||||
|
||||
| Configuration File | Description |
|
||||
| ------------------ |-------------------------------------------------------------|
|
||||
| **kafka.yml** | Configuration for Kafka username, password, address, etc. |
|
||||
| **redis.yml** | Configuration for Redis password, address, etc. |
|
||||
| **minio.yml** | Configuration for MinIO username, password, address, etc. |
|
||||
| **mongodb.yml** | Configuration for MongoDB username, password, address, etc. |
|
||||
| **discovery.yml** | Service discovery and etcd credentials and address. |
|
||||
| ------------------------------- | ------------------------------------------------------------ |
|
||||
| **kafka.yml** | Configurations for Kafka username, password, address, etc. |
|
||||
| **redis.yml** | Configurations for Redis password, address, etc. |
|
||||
| **minio.yml** | Configurations for MinIO username, password, address, and external IP/domain; failing to modify external IP or domain may cause image file sending failures |
|
||||
| **zookeeper.yml** | Configurations for ZooKeeper user, password, address, etc. |
|
||||
| **mongodb.yml** | Configurations for MongoDB username, password, address, etc. |
|
||||
| **log.yml** | Configurations for log level and storage directory. |
|
||||
| **notification.yml** | Configurations for events like adding friends, creating groups, etc. |
|
||||
| **share.yml** | Common configurations needed by various OpenIM services, such as secret. |
|
||||
| **webhooks.yml** | Configurations for URLs in Webhook. |
|
||||
| **local-cache.yml** | Local cache configurations. |
|
||||
| **openim-rpc-third.yml** | Configurations for listening IP, port, and storage settings for images and videos in openim-rpc-third service. |
|
||||
| **openim-rpc-user.yml** | Configurations for listening IP and port in openim-rpc-user service. |
|
||||
| **openim-api.yml** | Configurations for listening IP, port, etc., in openim-api service. |
|
||||
| **openim-crontask.yml** | Configurations for openim-crontask service. |
|
||||
| **openim-msggateway.yml** | Configurations for listening IP, port, etc., in openim-msggateway service. |
|
||||
| **openim-msgtransfer.yml** | Configurations for openim-msgtransfer service. |
|
||||
| **openim-push.yml** | Configurations for listening IP, port, and offline push settings in openim-push service. |
|
||||
| **openim-rpc-auth.yml** | Configurations for listening IP, port, and token expiration settings in openim-rpc-auth service. |
|
||||
| **openim-rpc-conversation.yml** | Configurations for listening IP, port, etc., in openim-rpc-conversation service. |
|
||||
| **openim-rpc-friend.yml** | Configurations for listening IP, port, etc., in openim-rpc-friend service. |
|
||||
| **openim-rpc-group.yml** | Configurations for listening IP, port, etc., in openim-rpc-group service. |
|
||||
| **openim-rpc-msg.yml** | Configurations for listening IP, port, and whether to verify friendship before sending messages in openim-rpc-msg service. |
|
||||
|
||||
## OpenIMServer Related Configurations
|
||||
| Configuration File | Description |
|
||||
| ------------------------------- | ---------------------------------------------- |
|
||||
| **log.yml** | Configuration for logging levels and storage directory |
|
||||
| **notification.yml** | Event notification settings (e.g., add friend, create group) |
|
||||
| **share.yml** | Common settings for all services (e.g., secrets) |
|
||||
| **webhooks.yml** | Webhook URLs and related settings |
|
||||
| **local-cache.yml** | Local cache settings (generally do not modify) |
|
||||
| **openim-rpc-third.yml** | openim-rpc-third listen IP, port, and object storage settings |
|
||||
| **openim-rpc-user.yml** | openim-rpc-user listen IP and port settings |
|
||||
| **openim-api.yml** | openim-api listen IP, port, and other settings |
|
||||
| **openim-crontask.yml** | openim-crontask scheduled task settings |
|
||||
| **openim-msggateway.yml** | openim-msggateway listen IP, port, and other settings |
|
||||
| **openim-msgtransfer.yml** | Settings for openim-msgtransfer service |
|
||||
| **openim-push.yml** | openim-push listen IP, port, and offline push settings |
|
||||
| **openim-rpc-auth.yml** | openim-rpc-auth listen IP, port, token validity settings |
|
||||
| **openim-rpc-conversation.yml** | openim-rpc-conversation listen IP and port settings |
|
||||
| **openim-rpc-friend.yml** | openim-rpc-friend listen IP and port settings |
|
||||
| **openim-rpc-group.yml** | openim-rpc-group listen IP and port settings |
|
||||
| **openim-rpc-msg.yml** | openim-rpc-msg listen IP and port settings |
|
||||
## Common Configuration Item Modifications
|
||||
|
||||
| Configuration Item Modification | Configuration File |
|
||||
| ----------------------------------------------------- | ----------------------- |
|
||||
| Using MinIO for image and video file object storage | `minio.yml` |
|
||||
| Adjusting production environment logs | `log.yml` |
|
||||
| Verifying friendship before sending messages | `openim-rpc-msg.yml` |
|
||||
| Modifying secret | `share.yml` |
|
||||
| Using OSS, COS, AWS, Kodo for image and video storage | `openim-rpc-third.yml` |
|
||||
| Setting multiple login policy | `openim-msggateway.yml` |
|
||||
| Setting up offline push | `openim-push.yml` |
|
||||
|
||||
## Monitoring and Alerting Related Configurations
|
||||
| Configuration File | Description |
|
||||
| ------------------------------ | --------------- |
|
||||
| **prometheus.yml** | Prometheus configuration |
|
||||
| **instance-down-rules.yml** | Alert rules |
|
||||
| **alertmanager.yml** | Alertmanager configuration |
|
||||
| **email.tmpl** | Email alert template |
|
||||
| **grefana-template/Demo.json** | Default Grafana dashboard |
|
||||
## Starting Multiple Instances of an OpenIM Service
|
||||
|
||||
## Common Configuration Modifications
|
||||
| Configuration Item | Configuration File |
|
||||
| -------------------------------------------------------- | ----------------------- |
|
||||
| Configure MinIO as object storage (focus on the externalAddress field) | `minio.yml` |
|
||||
| Adjust log level and number of log files | `log.yml` |
|
||||
| Enable or disable friend verification when sending messages | `openim-rpc-msg.yml` |
|
||||
| OpenIMServer secret | `share.yml` |
|
||||
| Configure OSS, COS, AWS, or Kodo as object storage | `openim-rpc-third.yml` |
|
||||
| Multi-end mutual kick strategy and max concurrent connections per gateway | `openim-msggateway.yml` |
|
||||
| Offline message push configuration | `openim-push.yml` |
|
||||
| Configure webhooks for callback notifications (e.g., before/after message send) | `webhooks.yml` |
|
||||
| Whether new group members can view historical messages | `openim-rpc-group.yml` |
|
||||
| Token expiration time settings | `openim-rpc-auth.yml` |
|
||||
| Scheduled task settings (e.g., how long to retain messages) | `openim-crontask.yml` |
|
||||
|
||||
## Starting Multiple Instances of a Service and Maximum File Descriptors
|
||||
|
||||
|
||||
To start multiple instances of an OpenIM service, simply add the corresponding port numbers and modify the `start-config.yml` file in the project’s root directory,
|
||||
then restart the service. For example, to start 2 instances of `openim-rpc-user`:
|
||||
To start multiple instances of an OpenIM service, simply increase the corresponding port numbers and modify the `start-config.yml` file in the project root directory. Restart the service to take effect. For example, the configuration to start 2 instances of `openim-rpc-user` is as follows:
|
||||
|
||||
```yaml
|
||||
rpc:
|
||||
@ -73,15 +55,9 @@ prometheus:
|
||||
ports: [ 20100, 20101 ]
|
||||
```
|
||||
|
||||
Modify`start-config.yml`:
|
||||
Modify `start-config.yml`:
|
||||
|
||||
```yaml
|
||||
serviceBinaries:
|
||||
openim-rpc-user: 2
|
||||
```
|
||||
|
||||
To set the maximum number of open file descriptors (typically one per online user):
|
||||
|
||||
```
|
||||
maxFileDescriptors: 10000
|
||||
```
|
||||
|
||||
@ -1,63 +1,45 @@
|
||||
# OpenIM配置文件说明以及常用配置修改说明
|
||||
|
||||
## 外部组件相关配置
|
||||
## 配置文件说明
|
||||
|
||||
| Configuration File | Description |
|
||||
| ------------------ | ---------------------------------- |
|
||||
| ------------------------------- | ------------------------------------------------------------ |
|
||||
| **kafka.yml** | Kafka用户名、密码、地址等配置 |
|
||||
| **redis.yml** | Redis密码、地址等配置 |
|
||||
| **minio.yml** | MinIO用户名、密码、地址等配置 |
|
||||
| **minio.yml** | MinIO用户名、密码、地址及外网IP域名等配置;未修改外网IP或域名可能导致图片文件发送失败 |
|
||||
| **zookeeper.yml** | ZooKeeper用户、密码、地址等配置 |
|
||||
| **mongodb.yml** | MongoDB用户名、密码、地址等配置 |
|
||||
| **discovery.yml** | 服务发现以及etcd用户名、密码、地址 |
|
||||
|
||||
## OpenIMServer相关配置
|
||||
| Configuration File | Description |
|
||||
| ------------------------------- | ---------------------------------------------- |
|
||||
| **log.yml** | 日志级别及存储目录等配置 |
|
||||
| **notification.yml** | 添加好友、创建群组等事件通知配置 |
|
||||
| **share.yml** | 各服务所需的公共配置,如secret等 |
|
||||
| **share.yml** | OpenIM各服务所需的公共配置,如secret等 |
|
||||
| **webhooks.yml** | Webhook中URL等配置 |
|
||||
| **local-cache.yml** | 本地缓存配置,一般不用修改 |
|
||||
| **openim-rpc-third.yml** | openim-rpc-third监听IP、端口及对象存储配置 |
|
||||
| **openim-rpc-user.yml** | openim-rpc-user监听IP、端口配置 |
|
||||
| **openim-api.yml** | openim-api监听IP、端口等配置 |
|
||||
| **openim-crontask.yml** | openim-crontask定时任务配置 |
|
||||
| **openim-msggateway.yml** | openim-msggateway监听IP、端口等配置 |
|
||||
| **local-cache.yml** | 本地缓存配置 |
|
||||
| **openim-rpc-third.yml** | openim-rpc-third服务的监听IP、端口及图片视频对象存储配置 |
|
||||
| **openim-rpc-user.yml** | openim-rpc-user服务的监听IP、端口配置 |
|
||||
| **openim-api.yml** | openim-api服务的监听IP、端口等配置项 |
|
||||
| **openim-crontask.yml** | openim-crontask服务配置 |
|
||||
| **openim-msggateway.yml** | openim-msggateway服务的监听IP、端口等配置 |
|
||||
| **openim-msgtransfer.yml** | openim-msgtransfer服务配置 |
|
||||
| **openim-push.yml** | openim-push监听IP、端口及离线推送配置 |
|
||||
| **openim-rpc-auth.yml** | openim-rpc-auth监听IP、端口及token有效期等配置 |
|
||||
| **openim-rpc-conversation.yml** | openim-rpc-conversation监听IP、端口等配置 |
|
||||
| **openim-rpc-friend.yml** | openim-rpc-friend监听IP、端口等配置 |
|
||||
| **openim-rpc-group.yml** | openim-rpc-group监听IP、端口等配置 |
|
||||
| **openim-rpc-msg.yml** | openim-rpc-msg服务的监听IP、端口等配置 |
|
||||
|
||||
|
||||
## 监控告警相关配置
|
||||
| Configuration File | Description |
|
||||
| ------------------------------ | --------------- |
|
||||
| **prometheus.yml** | prometheus配置 |
|
||||
| **instance-down-rules.yml** | 告警规则 |
|
||||
| **alertmanager.yml** | 告警管理配置 |
|
||||
| **email.tmpl** | 邮件告警模版 |
|
||||
| **grefana-template/Demo.json** | 默认的dashboard |
|
||||
| **openim-push.yml** | openim-push服务的监听IP、端口及离线推送配置 |
|
||||
| **openim-rpc-auth.yml** | openim-rpc-auth服务的监听IP、端口及token有效期等配置 |
|
||||
| **openim-rpc-conversation.yml** | openim-rpc-conversation服务的监听IP、端口等配置 |
|
||||
| **openim-rpc-friend.yml** | openim-rpc-friend服务的监听IP、端口等配置 |
|
||||
| **openim-rpc-group.yml** | openim-rpc-group服务的监听IP、端口等配置 |
|
||||
| **openim-rpc-msg.yml** | openim-rpc-msg服务的监听IP、端口及消息发送是否验证好友关系等配置 |
|
||||
|
||||
## 常用配置修改
|
||||
|
||||
| 修改配置项 | 配置文件 |
|
||||
| -------------------------------------------------------- | ----------------------- |
|
||||
| 使用minio作为对象存储时配置,重点关注externalAddress字段 | `minio.yml` |
|
||||
| 日志级别及日志文件数量调整 | `log.yml` |
|
||||
| 发送消息是否需要验证好友关系 | `openim-rpc-msg.yml` |
|
||||
| OpenIMServer秘钥 | `share.yml` |
|
||||
| 使用oss, cos, aws, kodo作为对象存储时配置 | `openim-rpc-third.yml` |
|
||||
| 多端互踢策略,单个gateway同时最大连接数 | `openim-msggateway.yml` |
|
||||
| 消息离线推送 | `openim-push.yml` |
|
||||
| 配置webhook来通知回调服务器,如消息发送前后回调 | `webhooks.yml` |
|
||||
| 新入群用户是否可以查看历史消息 | `openim-rpc-group.yml` |
|
||||
| token 过期时间设置 | `openim-rpc-auth.yml` |
|
||||
| 定时任务设置,例如消息保存多长时间 | `openim-crontask.yml` |
|
||||
|
||||
## 启动某个服务的多个实例和最大文件句柄数
|
||||
| ----------------------------------------------- | ----------------------- |
|
||||
| 使用minio作为图片视频文件对象存储 | `minio.yml` |
|
||||
| 生产环境日志调整 | `log.yml` |
|
||||
| 发送消息是否验证好友关系 | `openim-rpc-msg.yml` |
|
||||
| 修改secret | `share.yml` |
|
||||
| 使用oss, cos, aws, kodo作为图片视频文件对象存储 | `openim-rpc-third.yml` |
|
||||
| 设置多端互踢策略 | `openim-msggateway.yml` |
|
||||
| 设置离线推送 | `openim-push.yml` |
|
||||
|
||||
## 启动某个OpenIM服务的多个实例
|
||||
|
||||
若要启动某个OpenIM的多个实例,只需增加对应的端口数,并修改项目根目录下的`start-config.yml`文件,重启服务即可生效。例如,启动2个`openim-rpc-user`实例的配置如下:
|
||||
|
||||
@ -79,8 +61,5 @@ serviceBinaries:
|
||||
openim-rpc-user: 2
|
||||
```
|
||||
|
||||
修改最大同时打开的文件句柄数,一般是每个在线用户占用一个
|
||||
|
||||
```
|
||||
maxFileDescriptors: 10000
|
||||
```
|
||||
|
||||
|
||||
@ -1,22 +1,13 @@
|
||||
enable: etcd
|
||||
etcd:
|
||||
rootDirectory: openim
|
||||
address: [localhost:12379]
|
||||
## Attention: If you set auth in etcd
|
||||
## you must also update the username and password in Chat project.
|
||||
username:
|
||||
password:
|
||||
address: [ localhost:12379 ]
|
||||
username: ''
|
||||
password: ''
|
||||
|
||||
kubernetes:
|
||||
namespace: default
|
||||
zookeeper:
|
||||
schema: openim
|
||||
address: [ localhost:12181 ]
|
||||
username: ''
|
||||
password: ''
|
||||
|
||||
rpcService:
|
||||
user: user-rpc-service
|
||||
friend: friend-rpc-service
|
||||
msg: msg-rpc-service
|
||||
push: push-rpc-service
|
||||
messageGateway: messagegateway-rpc-service
|
||||
group: group-rpc-service
|
||||
auth: auth-rpc-service
|
||||
conversation: conversation-rpc-service
|
||||
third: third-rpc-service
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
## Kafka authentication
|
||||
username:
|
||||
password:
|
||||
|
||||
# Username for authentication
|
||||
username: ''
|
||||
# Password for authentication
|
||||
password: ''
|
||||
# Producer acknowledgment settings
|
||||
producerAck:
|
||||
# Compression type to use (e.g., none, gzip, snappy)
|
||||
compressType: none
|
||||
# List of Kafka broker addresses
|
||||
address: [localhost:19094]
|
||||
address: [ localhost:19094 ]
|
||||
# Kafka topic for Redis integration
|
||||
toRedisTopic: toRedis
|
||||
# Kafka topic for MongoDB integration
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
auth:
|
||||
topic: DELETE_CACHE_AUTH
|
||||
slotNum: 100
|
||||
slotSize: 2000
|
||||
successExpire: 300
|
||||
failedExpire: 5
|
||||
|
||||
user:
|
||||
topic: DELETE_CACHE_USER
|
||||
slotNum: 100
|
||||
|
||||
@ -1,51 +1,14 @@
|
||||
# URI for database connection, leave empty if using address and credential settings directly
|
||||
uri:
|
||||
# List of MongoDB server addresses
|
||||
address: [localhost:37017]
|
||||
address: [ localhost:37017 ]
|
||||
# Name of the database
|
||||
database: openim_v3
|
||||
# Username for database authentication
|
||||
username: openIM
|
||||
# Password for database authentication
|
||||
password: openIM123
|
||||
# Authentication source for database authentication, if use root user, set it to admin
|
||||
authSource: openim_v3
|
||||
# Maximum number of connections in the connection pool
|
||||
maxPoolSize: 100
|
||||
# Maximum number of retry attempts for a failed database connection
|
||||
maxRetry: 10
|
||||
# MongoDB Mode, including "standalone", "replicaSet"
|
||||
mongoMode: "standalone"
|
||||
|
||||
# The following configurations only take effect when mongoMode is set to "replicaSet"
|
||||
replicaSet:
|
||||
name: rs0
|
||||
hosts: [127.0.0.1:37017, 127.0.0.1:37018, 127.0.0.1:37019]
|
||||
# Read concern level: "local", "available", "majority", "linearizable", "snapshot"
|
||||
readConcern: majority
|
||||
# maximum staleness of data in seconds
|
||||
maxStaleness: 90s
|
||||
|
||||
# The following configurations only take effect when mongoMode is set to "replicaSet"
|
||||
readPreference:
|
||||
# Read preference mode, can be "primary", "primaryPreferred", "secondary", "secondaryPreferred", "nearest"
|
||||
mode: primary
|
||||
maxStaleness: 90s
|
||||
# TagSets is an array of maps with priority based on order, empty map must be placed last for fallback tagSets
|
||||
tagSets:
|
||||
- datacenter: "cn-east"
|
||||
rack: "1"
|
||||
storage: "ssd"
|
||||
- datacenter: "cn-east"
|
||||
storage: "ssd"
|
||||
- datacenter: "cn-east"
|
||||
- {} # Empty map, indicates any node
|
||||
|
||||
# The following configurations only take effect when mongoMode is set to "replicaSet"
|
||||
writeConcern:
|
||||
# Write node count or tag (int, "majority", or custom tag)
|
||||
w: majority
|
||||
# Whether to wait for journal confirmation
|
||||
j: true
|
||||
# Write timeout duration
|
||||
wtimeout: 30s
|
||||
|
||||
@ -1,8 +1,27 @@
|
||||
# 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.
|
||||
|
||||
# Determines if a message should be sent. If set to false, it triggers a silent sync without a message. If true, it requires triggering a conversation.
|
||||
# For rpc notification, send twice: once as a message and once as a notification.
|
||||
# The options field 'isNotification' indicates if it's a notification.
|
||||
groupCreated:
|
||||
isSendMsg: true
|
||||
# Deprecated. Fixed as 1.
|
||||
# Reliability level of the message sending.
|
||||
# Set to 1 to send only when online, 2 for guaranteed delivery.
|
||||
reliabilityLevel: 1
|
||||
# Deprecated. Fixed as false.
|
||||
# This setting is effective only when 'isSendMsg' is true.
|
||||
# It controls whether to count unread messages.
|
||||
unreadCount: false
|
||||
# Configuration for offline push notifications.
|
||||
offlinePush:
|
||||
@ -31,7 +50,7 @@ joinGroupApplication:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
enable: false
|
||||
title: joinGroupApplication title
|
||||
desc: joinGroupApplication desc
|
||||
ext: joinGroupApplication ext
|
||||
@ -51,7 +70,7 @@ groupApplicationAccepted:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
enable: false
|
||||
title: groupApplicationAccepted title
|
||||
desc: groupApplicationAccepted desc
|
||||
ext: groupApplicationAccepted ext
|
||||
@ -61,7 +80,7 @@ groupApplicationRejected:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
enable: false
|
||||
title: groupApplicationRejected title
|
||||
desc: groupApplicationRejected desc
|
||||
ext: groupApplicationRejected ext
|
||||
@ -198,7 +217,7 @@ friendApplicationAdded:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
enable: false
|
||||
title: Somebody applies to add you as a friend
|
||||
desc: Somebody applies to add you as a friend
|
||||
ext: Somebody applies to add you as a friend
|
||||
@ -228,7 +247,7 @@ friendAdded:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
enable: true
|
||||
title: We have become friends
|
||||
desc: We have become friends
|
||||
ext: We have become friends
|
||||
@ -238,7 +257,7 @@ friendDeleted:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
enable: true
|
||||
title: deleted a friend
|
||||
desc: deleted a friend
|
||||
ext: deleted a friend
|
||||
@ -248,7 +267,7 @@ friendRemarkSet:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
enable: true
|
||||
title: Your friend's profile has been changed
|
||||
desc: Your friend's profile has been changed
|
||||
ext: Your friend's profile has been changed
|
||||
@ -258,7 +277,7 @@ blackAdded:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
enable: true
|
||||
title: blocked a user
|
||||
desc: blocked a user
|
||||
ext: blocked a user
|
||||
@ -268,7 +287,7 @@ blackDeleted:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
enable: true
|
||||
title: Remove a blocked user
|
||||
desc: Remove a blocked user
|
||||
ext: Remove a blocked user
|
||||
@ -278,7 +297,7 @@ friendInfoUpdated:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
enable: true
|
||||
title: friend info updated
|
||||
desc: friend info updated
|
||||
ext: friend info updated
|
||||
@ -289,10 +308,10 @@ userInfoUpdated:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: userInfo updated
|
||||
desc: userInfo updated
|
||||
ext: userInfo updated
|
||||
enable: true
|
||||
title: Remove a blocked user
|
||||
desc: Remove a blocked user
|
||||
ext: Remove a blocked user
|
||||
|
||||
userStatusChanged:
|
||||
isSendMsg: false
|
||||
@ -310,7 +329,7 @@ conversationChanged:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
enable: true
|
||||
title: conversation changed
|
||||
desc: conversation changed
|
||||
ext: conversation changed
|
||||
@ -320,7 +339,7 @@ conversationSetPrivate:
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
enable: true
|
||||
title: burn after reading
|
||||
desc: burn after reading
|
||||
ext: burn after reading
|
||||
|
||||
@ -10,10 +10,7 @@ api:
|
||||
prometheus:
|
||||
# Whether to enable prometheus
|
||||
enable: true
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
autoSetPorts: true
|
||||
# Prometheus listening ports, must match the number of api.ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 12002 ]
|
||||
# This address can be accessed via a browser
|
||||
grafanaURL:
|
||||
grafanaURL: http://127.0.0.1:13000/
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
cronExecuteTime: 0 2 * * *
|
||||
retainChatRecords: 365
|
||||
fileExpireTime: 180
|
||||
deleteObjectType: ["msg-picture","msg-file", "msg-voice","msg-video","msg-video-snapshot","sdklog"]
|
||||
fileExpireTime: 90
|
||||
|
||||
@ -1,19 +1,15 @@
|
||||
rpc:
|
||||
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
|
||||
registerIP:
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
# if you use in kubernetes, set it to false
|
||||
autoSetPorts: true
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 10140, 10141, 10142, 10143, 10144, 10145, 10146, 10147, 10148, 10149, 10150, 10151, 10152, 10153, 10154, 10155 ]
|
||||
|
||||
prometheus:
|
||||
# Enable or disable Prometheus monitoring
|
||||
enable: true
|
||||
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 12140, 12141, 12142, 12143, 12144, 12145, 12146, 12147, 12148, 12149, 12150, 12151, 12152, 12153, 12154, 12155 ]
|
||||
|
||||
# IP address that the RPC/WebSocket service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
|
||||
@ -26,3 +22,5 @@ longConnSvr:
|
||||
websocketMaxMsgLen: 4096
|
||||
# WebSocket connection handshake timeout in seconds
|
||||
websocketTimeout: 10
|
||||
|
||||
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
prometheus:
|
||||
# Enable or disable Prometheus monitoring
|
||||
enable: true
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
autoSetPorts: true
|
||||
# List of ports that Prometheus listens on; each port corresponds to an instance of monitoring. Ensure these are managed accordingly
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
# Because four instances have been launched, four ports need to be specified
|
||||
ports: [ 12020, 12021, 12022, 12023, 12024, 12025, 12026, 12027, 12028, 12029, 12030, 12031, 12032, 12033, 12034, 12035 ]
|
||||
|
||||
@ -3,25 +3,19 @@ rpc:
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
# if you use in kubernetes, set it to false
|
||||
autoSetPorts: true
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
|
||||
ports: [ 10170, 10171, 10172, 10173, 10174, 10175, 10176, 10177, 10178, 10179, 10180, 10181, 10182, 10183, 10184, 10185 ]
|
||||
|
||||
prometheus:
|
||||
# Enable or disable Prometheus monitoring
|
||||
enable: true
|
||||
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 12170, 12171, 12172, 12173, 12174, 12175, 12176, 12177, 12178, 12179, 12180, 12182, 12183, 12184, 12185, 12186 ]
|
||||
|
||||
maxConcurrentWorkers: 3
|
||||
#Use geTui for offline push notifications, or choose fcm or jpns; corresponding configuration settings must be specified.
|
||||
enable:
|
||||
getui:
|
||||
enable: geTui
|
||||
geTui:
|
||||
pushUrl: https://restapi.getui.com/v2/$appId
|
||||
masterSecret:
|
||||
appKey:
|
||||
@ -32,7 +26,7 @@ fcm:
|
||||
# Prioritize using file paths. If the file path is empty, use URL
|
||||
filePath: # File path is concatenated with the parameters passed in through - c(`mage` default pass in `config/`) and filePath.
|
||||
authURL: # Must start with https or http.
|
||||
jpush:
|
||||
jpns:
|
||||
appKey:
|
||||
masterSecret:
|
||||
pushURL:
|
||||
|
||||
@ -3,19 +3,14 @@ rpc:
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
# if you use in kubernetes, set it to false
|
||||
autoSetPorts: true
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 10200 ]
|
||||
|
||||
prometheus:
|
||||
# Enable or disable Prometheus monitoring
|
||||
enable: true
|
||||
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 12200 ]
|
||||
|
||||
tokenPolicy:
|
||||
# Token validity period, in days
|
||||
|
||||
@ -3,16 +3,11 @@ rpc:
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
# if you use in kubernetes, set it to false
|
||||
autoSetPorts: true
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 10220 ]
|
||||
|
||||
prometheus:
|
||||
# Enable or disable Prometheus monitoring
|
||||
enable: true
|
||||
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 12220 ]
|
||||
|
||||
@ -3,16 +3,11 @@ rpc:
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
# if you use in kubernetes, set it to false
|
||||
autoSetPorts: true
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 10240 ]
|
||||
|
||||
prometheus:
|
||||
# Enable or disable Prometheus monitoring
|
||||
enable: true
|
||||
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 12240 ]
|
||||
|
||||
@ -3,19 +3,14 @@ rpc:
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
# if you use in kubernetes, set it to false
|
||||
autoSetPorts: true
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 10260 ]
|
||||
|
||||
prometheus:
|
||||
# Enable or disable Prometheus monitoring
|
||||
enable: true
|
||||
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 12260 ]
|
||||
|
||||
|
||||
enableHistoryForNewMembers: true
|
||||
|
||||
@ -3,19 +3,14 @@ rpc:
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
# if you use in kubernetes, set it to false
|
||||
autoSetPorts: true
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 10280 ]
|
||||
|
||||
prometheus:
|
||||
# Enable or disable Prometheus monitoring
|
||||
enable: true
|
||||
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 12280 ]
|
||||
|
||||
|
||||
# Does sending messages require friend verification
|
||||
|
||||
@ -3,19 +3,14 @@ rpc:
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
# if you use in kubernetes, set it to false
|
||||
autoSetPorts: true
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 10300 ]
|
||||
|
||||
prometheus:
|
||||
# Enable or disable Prometheus monitoring
|
||||
enable: true
|
||||
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 12300 ]
|
||||
|
||||
|
||||
object:
|
||||
@ -36,17 +31,10 @@ object:
|
||||
sessionToken:
|
||||
publicRead: false
|
||||
kodo:
|
||||
endpoint: https://s3.cn-south-1.qiniucs.com
|
||||
bucket: testdemo12313
|
||||
bucketURL: http://so2at6d05.hn-bkt.clouddn.com
|
||||
endpoint: http://s3.cn-south-1.qiniucs.com
|
||||
bucket: kodo-bucket-test
|
||||
bucketURL: http://kodo-bucket-test-oetobfb.qiniudns.com
|
||||
accessKeyID:
|
||||
accessKeySecret:
|
||||
sessionToken:
|
||||
publicRead: false
|
||||
aws:
|
||||
region: ap-southeast-2
|
||||
bucket: testdemo832234
|
||||
accessKeyID:
|
||||
secretAccessKey:
|
||||
sessionToken:
|
||||
publicRead: false
|
||||
@ -3,16 +3,11 @@ rpc:
|
||||
registerIP:
|
||||
# Listening IP; 0.0.0.0 means both internal and external IPs are listened to, if blank, the internal network IP is automatically obtained by default
|
||||
listenIP: 0.0.0.0
|
||||
# autoSetPorts indicates whether to automatically set the ports
|
||||
# if you use in kubernetes, set it to false
|
||||
autoSetPorts: true
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
# Listening ports; if multiple are configured, multiple instances will be launched, and must be consistent with the number of prometheus.ports
|
||||
ports: [ 10320 ]
|
||||
|
||||
prometheus:
|
||||
# Whether to enable prometheus
|
||||
enable: true
|
||||
# Prometheus listening ports, must be consistent with the number of rpc.ports
|
||||
# It will only take effect when autoSetPorts is set to false.
|
||||
ports:
|
||||
ports: [ 12320 ]
|
||||
|
||||
@ -8,7 +8,7 @@ global:
|
||||
alerting:
|
||||
alertmanagers:
|
||||
- static_configs:
|
||||
- targets: [127.0.0.1:19093]
|
||||
- targets: [internal_ip:19093]
|
||||
|
||||
# Load rules once and periodically evaluate them according to the global evaluation_interval.
|
||||
rule_files:
|
||||
@ -25,95 +25,62 @@ scrape_configs:
|
||||
# prometheus fetches application services
|
||||
- job_name: node_exporter
|
||||
static_configs:
|
||||
- targets: [ 127.0.0.1:19100 ]
|
||||
|
||||
- targets: [ internal_ip:20500 ]
|
||||
- job_name: openimserver-openim-api
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/api"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12002 ]
|
||||
# labels:
|
||||
# namespace: default
|
||||
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12002 ]
|
||||
labels:
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-msggateway
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/msg_gateway"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12140 ]
|
||||
# # - targets: [ 127.0.0.1:12140, 127.0.0.1:12141, 127.0.0.1:12142, 127.0.0.1:12143, 127.0.0.1:12144, 127.0.0.1:12145, 127.0.0.1:12146, 127.0.0.1:12147, 127.0.0.1:12148, 127.0.0.1:12149, 127.0.0.1:12150, 127.0.0.1:12151, 127.0.0.1:12152, 127.0.0.1:12153, 127.0.0.1:12154, 127.0.0.1:12155 ]
|
||||
# labels:
|
||||
# namespace: default
|
||||
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12140 ]
|
||||
# - targets: [ internal_ip:12140, internal_ip:12141, internal_ip:12142, internal_ip:12143, internal_ip:12144, internal_ip:12145, internal_ip:12146, internal_ip:12147, internal_ip:12148, internal_ip:12149, internal_ip:12150, internal_ip:12151, internal_ip:12152, internal_ip:12153, internal_ip:12154, internal_ip:12155 ]
|
||||
labels:
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-msgtransfer
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/msg_transfer"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12020, 127.0.0.1:12021, 127.0.0.1:12022, 127.0.0.1:12023, 127.0.0.1:12024, 127.0.0.1:12025, 127.0.0.1:12026, 127.0.0.1:12027 ]
|
||||
# # - targets: [ 127.0.0.1:12020, 127.0.0.1:12021, 127.0.0.1:12022, 127.0.0.1:12023, 127.0.0.1:12024, 127.0.0.1:12025, 127.0.0.1:12026, 127.0.0.1:12027, 127.0.0.1:12028, 127.0.0.1:12029, 127.0.0.1:12030, 127.0.0.1:12031, 127.0.0.1:12032, 127.0.0.1:12033, 127.0.0.1:12034, 127.0.0.1:12035 ]
|
||||
# labels:
|
||||
# namespace: default
|
||||
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12020, internal_ip:12021, internal_ip:12022, internal_ip:12023, internal_ip:12024, internal_ip:12025, internal_ip:12026, internal_ip:12027 ]
|
||||
# - targets: [ internal_ip:12020, internal_ip:12021, internal_ip:12022, internal_ip:12023, internal_ip:12024, internal_ip:12025, internal_ip:12026, internal_ip:12027, internal_ip:12028, internal_ip:12029, internal_ip:12030, internal_ip:12031, internal_ip:12032, internal_ip:12033, internal_ip:12034, internal_ip:12035 ]
|
||||
labels:
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-push
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/push"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12170, 127.0.0.1:12171, 127.0.0.1:12172, 127.0.0.1:12173, 127.0.0.1:12174, 127.0.0.1:12175, 127.0.0.1:12176, 127.0.0.1:12177 ]
|
||||
## - targets: [ 127.0.0.1:12170, 127.0.0.1:12171, 127.0.0.1:12172, 127.0.0.1:12173, 127.0.0.1:12174, 127.0.0.1:12175, 127.0.0.1:12176, 127.0.0.1:12177, 127.0.0.1:12178, 127.0.0.1:12179, 127.0.0.1:12180, 127.0.0.1:12182, 127.0.0.1:12183, 127.0.0.1:12184, 127.0.0.1:12185, 127.0.0.1:12186 ]
|
||||
# labels:
|
||||
# namespace: default
|
||||
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12170, internal_ip:12171, internal_ip:12172, internal_ip:12173, internal_ip:12174, internal_ip:12175, internal_ip:12176, internal_ip:12177 ]
|
||||
# - targets: [ internal_ip:12170, internal_ip:12171, internal_ip:12172, internal_ip:12173, internal_ip:12174, internal_ip:12175, internal_ip:12176, internal_ip:12177, internal_ip:12178, internal_ip:12179, internal_ip:12180, internal_ip:12182, internal_ip:12183, internal_ip:12184, internal_ip:12185, internal_ip:12186 ]
|
||||
labels:
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-auth
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/auth"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12200 ]
|
||||
# labels:
|
||||
# namespace: default
|
||||
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12200 ]
|
||||
labels:
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-conversation
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/conversation"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12220 ]
|
||||
# labels:
|
||||
# namespace: default
|
||||
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12220 ]
|
||||
labels:
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-friend
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/friend"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12240 ]
|
||||
# labels:
|
||||
# namespace: default
|
||||
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12240 ]
|
||||
labels:
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-group
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/group"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12260 ]
|
||||
# labels:
|
||||
# namespace: default.
|
||||
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12260 ]
|
||||
labels:
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-msg
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/msg"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12280 ]
|
||||
# labels:
|
||||
# namespace: default
|
||||
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12280 ]
|
||||
labels:
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-third
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/third"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12300 ]
|
||||
# labels:
|
||||
# namespace: default
|
||||
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12300 ]
|
||||
labels:
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-user
|
||||
http_sd_configs:
|
||||
- url: "http://127.0.0.1:10002/prometheus_discovery/user"
|
||||
# static_configs:
|
||||
# - targets: [ 127.0.0.1:12320 ]
|
||||
# labels:
|
||||
# namespace: default
|
||||
static_configs:
|
||||
- targets: [ internal_ip:12320 ]
|
||||
labels:
|
||||
namespace: default
|
||||
@ -1,14 +1,7 @@
|
||||
address: [localhost:16379]
|
||||
address: [ localhost:16379 ]
|
||||
username:
|
||||
password: openIM123
|
||||
# redis Mode, including "standalone","cluster","sentinel"
|
||||
redisMode: "standalone"
|
||||
clusterMode: false
|
||||
db: 0
|
||||
maxRetry: 10
|
||||
poolSize: 100
|
||||
# Sentinel configuration (only used when redisMode is "sentinel")
|
||||
sentinelMode:
|
||||
masterName: "redis-master"
|
||||
sentinelsAddrs: ["127.0.0.1:26379", "127.0.0.1:26380", "127.0.0.1:26381"]
|
||||
routeByLatency: true
|
||||
routeRandomly: true
|
||||
|
||||
@ -1,20 +1,16 @@
|
||||
secret: openIM123
|
||||
rpcRegisterName:
|
||||
user: user
|
||||
friend: friend
|
||||
msg: msg
|
||||
push: push
|
||||
messageGateway: messageGateway
|
||||
group: group
|
||||
auth: auth
|
||||
conversation: conversation
|
||||
third: third
|
||||
|
||||
# imAdminUser: Configuration for instant messaging system administrators
|
||||
imAdminUser:
|
||||
# userIDs: List of administrator user IDs.
|
||||
# Each entry here corresponds by index to the matching entry in the nicknames list below.
|
||||
userIDs: [imAdmin]
|
||||
# nicknames: List of administrator display names.
|
||||
# Each entry here corresponds by index to the matching entry in the userIDs list above.
|
||||
nicknames: [superAdmin]
|
||||
imAdminUserID: [ imAdmin ]
|
||||
|
||||
# 1: For Android, iOS, Windows, Mac, and web platforms, only one instance can be online at a time
|
||||
multiLogin:
|
||||
policy: 1
|
||||
# max num of tokens in one end
|
||||
maxNumOneEnd: 30
|
||||
|
||||
rpcMaxBodySize:
|
||||
requestMaxBodySize: 8388608
|
||||
responseMaxBodySize: 8388608
|
||||
multiLoginPolicy: 1
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
url: http://127.0.0.1:10006/callbackExample
|
||||
url: webhook://127.0.0.1:10008/callbackExample
|
||||
beforeSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
# Only the contentType not in deniedTypes will send the callback.
|
||||
# If not set, all contentType messages will through this filter.
|
||||
deniedTypes: []
|
||||
beforeUpdateUserInfoEx:
|
||||
enable: false
|
||||
timeout: 5
|
||||
@ -16,31 +13,20 @@ afterUpdateUserInfoEx:
|
||||
afterSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
# Only the recvIDs specified in attentionIds will send the callback
|
||||
# Only the senID/recvID specified in attentionIds will send the callback
|
||||
# if not set, all user messages will be callback
|
||||
attentionIds: []
|
||||
# See beforeSendSingleMsg comment.
|
||||
deniedTypes: []
|
||||
beforeSendGroupMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
# See beforeSendSingleMsg comment.
|
||||
deniedTypes: []
|
||||
beforeMsgModify:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
# See beforeSendSingleMsg comment.
|
||||
deniedTypes: []
|
||||
afterSendGroupMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
# Only the GroupIDs specified in attentionIds will send the callback
|
||||
# if not set, all user messages will be callback
|
||||
attentionIds: []
|
||||
# See beforeSendSingleMsg comment.
|
||||
deniedTypes: []
|
||||
afterUserOnline:
|
||||
enable: false
|
||||
timeout: 5
|
||||
@ -181,19 +167,3 @@ afterImportFriends:
|
||||
afterRemoveBlack:
|
||||
enable: false
|
||||
timeout: 5
|
||||
beforeCreateSingleChatConversations:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: false
|
||||
afterCreateSingleChatConversations:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: false
|
||||
beforeCreateGroupChatConversations:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: false
|
||||
afterCreateGroupChatConversations:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: false
|
||||
|
||||
@ -1,188 +1,175 @@
|
||||
# Kubernetes Deployment
|
||||
# OpenIM Application Containerization Deployment Guide
|
||||
|
||||
## Resource Requests
|
||||
OpenIM supports a variety of cluster deployment methods, including but not limited to `helm`, `sealos`, `kustomize`
|
||||
|
||||
- CPU: 2 cores
|
||||
- Memory: 4 GiB
|
||||
- Disk usage: 20 GiB (on Node)
|
||||
Various contributors, as well as previous official releases, have provided some referenceable solutions:
|
||||
|
||||
## Preconditions
|
||||
+ [k8s-jenkins Repository](https://github.com/OpenIMSDK/k8s-jenkins)
|
||||
+ [open-im-server-k8s-deploy Repository](https://github.com/openimsdk/open-im-server-k8s-deploy)
|
||||
+ [openim-charts Repository](https://github.com/OpenIMSDK/openim-charts)
|
||||
+ [deploy-openim Repository](https://github.com/showurl/deploy-openim)
|
||||
|
||||
ensure that you have already deployed the following components:
|
||||
### Dependency Check
|
||||
|
||||
- Redis
|
||||
- MongoDB
|
||||
- Kafka
|
||||
- MinIO
|
||||
```bash
|
||||
Kubernetes: >= 1.16.0-0
|
||||
Helm: >= 3.0
|
||||
```
|
||||
|
||||
## Origin Deploy
|
||||
### Minimum Configuration
|
||||
|
||||
### Enter the target dir
|
||||
|
||||
`cd ./deployments/deploy/`
|
||||
|
||||
### Deploy configs and dependencies
|
||||
|
||||
Upate your configMap `openim-config.yml`. **You can check the official docs for more details.**
|
||||
|
||||
In `openim-config.yml`, you need modify the following configurations:
|
||||
|
||||
**discovery.yml**
|
||||
|
||||
- `kubernetes.namespace`: default is `default`, you can change it to your namespace.
|
||||
|
||||
**mongodb.yml**
|
||||
|
||||
- `address`: set to your already mongodb address or mongo Service name and port in your deployed.
|
||||
- `database`: set to your mongodb database name.(Need have a created database.)
|
||||
- `authSource`: set to your mongodb authSource. (authSource is specify the database name associated with the user's credentials, user need create in this database.)
|
||||
|
||||
**kafka.yml**
|
||||
|
||||
- `address`: set to your already kafka address or kafka Service name and port in your deployed.
|
||||
|
||||
**redis.yml**
|
||||
|
||||
- `address`: set to your already redis address or redis Service name and port in your deployed.
|
||||
|
||||
**minio.yml**
|
||||
|
||||
- `internalAddress`: set to your minio Service name and port in your deployed.
|
||||
- `externalAddress`: set to your already expose minio external address.
|
||||
|
||||
### Set the secret
|
||||
|
||||
A Secret is an object that contains a small amount of sensitive data. Such as password and secret. Secret is similar to ConfigMaps.
|
||||
|
||||
#### Redis:
|
||||
|
||||
Update the `redis-password` value in `redis-secret.yml` to your Redis password encoded in base64.
|
||||
The recommended minimum configuration for a production environment is as follows:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: openim-redis-secret
|
||||
type: Opaque
|
||||
data:
|
||||
redis-password: b3BlbklNMTIz # update to your redis password encoded in base64, if need empty, you can set to ""
|
||||
CPU: 4
|
||||
Memory: 8G
|
||||
Disk: 100G
|
||||
```
|
||||
|
||||
#### Mongo:
|
||||
## Configuration File Generation
|
||||
|
||||
Update the `mongo_openim_username`, `mongo_openim_password` value in `mongo-secret.yml` to your Mongo username and password encoded in base64.
|
||||
We have automated all the files, making the generation of configuration files optional for OpenIM. However, if you desire custom configurations, you can follow the steps below:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: openim-mongo-secret
|
||||
type: Opaque
|
||||
data:
|
||||
mongo_openim_username: b3BlbklN # update to your mongo username encoded in base64, if need empty, you can set to "" (this user credentials need in authSource database).
|
||||
mongo_openim_password: b3BlbklNMTIz # update to your mongo password encoded in base64, if need empty, you can set to ""
|
||||
```bash
|
||||
$ make init
|
||||
# Alternatively, use script:
|
||||
# ./scripts/init-config.sh
|
||||
```
|
||||
|
||||
#### Minio:
|
||||
At this point, configuration files will be generated under `deployments/openim/config`, which you can modify as per your requirements.
|
||||
|
||||
Update the `minio-root-user` and `minio-root-password` value in `minio-secret.yml` to your MinIO accessKeyID and secretAccessKey encoded in base64.
|
||||
## Cluster Setup
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: openim-minio-secret
|
||||
type: Opaque
|
||||
data:
|
||||
minio-root-user: cm9vdA== # update to your minio accessKeyID encoded in base64, if need empty, you can set to ""
|
||||
minio-root-password: b3BlbklNMTIz # update to your minio secretAccessKey encoded in base64, if need empty, you can set to ""
|
||||
If you already have a `kubernetes` cluster, or if you wish to build a `kubernetes` cluster from scratch, you can skip this step.
|
||||
|
||||
For a quick start, I used [sealos](https://github.com/labring/sealos) to rapidly set up the cluster, with sealos also being a wrapper for kubeadm at its core:
|
||||
|
||||
```bash
|
||||
$ SEALOS_VERSION=`curl -s https://api.github.com/repos/labring/sealos/releases/latest | grep -oE '"tag_name": "[^"]+"' | head -n1 | cut -d'"' -f4` && \
|
||||
curl -sfL https://raw.githubusercontent.com/labring/sealos/${SEALOS_VERSION}/scripts/install.sh |
|
||||
sh -s ${SEALOS_VERSION} labring/sealos
|
||||
```
|
||||
|
||||
#### Kafka:
|
||||
**Supported Versions:**
|
||||
|
||||
Update the `kafka-password` value in `kafka-secret.yml` to your Kafka password encoded in base64.
|
||||
+ docker: `labring/kubernetes-docker`:(v1.24.0~v1.27.0)
|
||||
+ containerd: `labring/kubernetes`:(v1.24.0~v1.27.0)
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: openim-kafka-secret
|
||||
type: Opaque
|
||||
data:
|
||||
kafka-password: b3BlbklNMTIz # update to your kafka password encoded in base64, if need empty, you can set to ""
|
||||
#### Cluster Installation:
|
||||
|
||||
Cluster details are as follows:
|
||||
|
||||
| Hostname | IP Address | System Info |
|
||||
| -------- | ---------- | ------------------------------------------------------------ |
|
||||
| master01 | 10.0.0.9 | `Linux VM-0-9-ubuntu 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux` |
|
||||
| node01 | 10.0.0.4 | Similar to master01 |
|
||||
| node02 | 10.0.0.10 | Similar to master01 |
|
||||
|
||||
```bash
|
||||
$ export CLUSTER_USERNAME=ubuntu
|
||||
$ export CLUSTER_PASSWORD=123456
|
||||
$ sudo sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:v3.24.1 \
|
||||
--masters 10.0.0.9 \
|
||||
--nodes 10.0.0.4,10.0.0.10 \
|
||||
-u "$CLUSTER_USERNAME" \
|
||||
-p "$CLUSTER_PASSWORD"
|
||||
```
|
||||
|
||||
### Apply the secret.
|
||||
|
||||
```shell
|
||||
kubectl apply -f redis-secret.yml -f minio-secret.yml -f mongo-secret.yml -f kafka-secret.yml
|
||||
```
|
||||
|
||||
### Apply all config
|
||||
|
||||
`kubectl apply -f ./openim-config.yml`
|
||||
|
||||
> Attation: If you use `default` namespace, you can excute `clusterRile.yml` to create a cluster role binding for default service account.
|
||||
> **Node** Uninstallation method: using `kubeadm` for uninstallation does not remove `etcd` and `cni` related configurations. Manual clearance or using `sealos` for uninstallation is needed.
|
||||
>
|
||||
> Namespace is modify to `discovery.yml` in `openim-config.yml`, you can change `kubernetes.namespace` to your namespace.
|
||||
> ```bash
|
||||
> $ sealos reset
|
||||
> ```
|
||||
|
||||
**Excute `clusterRole.yml`**
|
||||
|
||||
`kubectl apply -f ./clusterRole.yml`
|
||||
|
||||
### run all deployments and services
|
||||
|
||||
> Note: Ensure that infrastructure services like MinIO, Redis, and Kafka are running before deploying the main applications.
|
||||
If you are local, you can also use Kind and Minikube to test, for example, using Kind:
|
||||
|
||||
```bash
|
||||
kubectl apply \
|
||||
-f openim-api-deployment.yml \
|
||||
-f openim-api-service.yml \
|
||||
-f openim-crontask-deployment.yml \
|
||||
-f openim-rpc-user-deployment.yml \
|
||||
-f openim-rpc-user-service.yml \
|
||||
-f openim-msggateway-deployment.yml \
|
||||
-f openim-msggateway-service.yml \
|
||||
-f openim-push-deployment.yml \
|
||||
-f openim-push-service.yml \
|
||||
-f openim-msgtransfer-service.yml \
|
||||
-f openim-msgtransfer-deployment.yml \
|
||||
-f openim-rpc-conversation-deployment.yml \
|
||||
-f openim-rpc-conversation-service.yml \
|
||||
-f openim-rpc-auth-deployment.yml \
|
||||
-f openim-rpc-auth-service.yml \
|
||||
-f openim-rpc-group-deployment.yml \
|
||||
-f openim-rpc-group-service.yml \
|
||||
-f openim-rpc-friend-deployment.yml \
|
||||
-f openim-rpc-friend-service.yml \
|
||||
-f openim-rpc-msg-deployment.yml \
|
||||
-f openim-rpc-msg-service.yml \
|
||||
-f openim-rpc-third-deployment.yml \
|
||||
-f openim-rpc-third-service.yml
|
||||
$ GO111MODULE="on" go get sigs.k8s.io/kind@v0.11.1
|
||||
$ kind create cluster
|
||||
```
|
||||
|
||||
### Verification
|
||||
### Installing helm
|
||||
|
||||
After deploying the services, verify that everything is running smoothly:
|
||||
Helm simplifies the deployment and management of Kubernetes applications to a large extent by offering version control and release management through packaging.
|
||||
|
||||
**Using Script:**
|
||||
|
||||
```bash
|
||||
# Check the status of all pods
|
||||
kubectl get pods
|
||||
|
||||
# Check the status of services
|
||||
kubectl get svc
|
||||
|
||||
# Check the status of deployments
|
||||
kubectl get deployments
|
||||
|
||||
# View all resources
|
||||
kubectl get all
|
||||
$ curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
```
|
||||
|
||||
### clean all
|
||||
**Adding Repository:**
|
||||
|
||||
`kubectl delete -f ./`
|
||||
```bash
|
||||
$ helm repo add brigade https://openimsdk.github.io/openim-charts
|
||||
```
|
||||
|
||||
### Notes:
|
||||
### OpenIM Image Strategy
|
||||
|
||||
- If you use a specific namespace for your deployment, be sure to append the -n <namespace> flag to your kubectl commands.
|
||||
Automated offerings include aliyun, ghcr, docker hub: [Image Documentation](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md)
|
||||
|
||||
**Local Test Build Method:**
|
||||
|
||||
```bash
|
||||
$ make image
|
||||
```
|
||||
|
||||
> This command assists in quickly building the required images locally. For a detailed build strategy, refer to the [Build Documentation](https://github.com/openimsdk/open-im-server/blob/main/build/README.md).
|
||||
|
||||
## Installation
|
||||
|
||||
Explore our Helm-Charts repository and read through: [Helm-Charts Repository](https://github.com/openimsdk/helm-charts)
|
||||
|
||||
|
||||
Using the helm charts repository, you can ignore the following configuration, but if you want to just use the server and scale on top of it, you can go ahead:
|
||||
|
||||
**Use the Helm template to generate the deployment yaml file: `openim-charts.yaml`**
|
||||
|
||||
**Gen Image:**
|
||||
|
||||
```bash
|
||||
../scripts/genconfig.sh ../scripts/install/environment.sh ./templates/helm-image.yaml > ./charts/generated-configs/helm-image.yaml
|
||||
```
|
||||
|
||||
**Gen Charts:**
|
||||
|
||||
```bash
|
||||
for chart in ./charts/*/; do
|
||||
if [[ "$chart" == *"generated-configs"* || "$chart" == *"helmfile.yaml"* ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -f "${chart}values.yaml" ]; then
|
||||
helm template "$chart" -f "./charts/generated-configs/helm-image.yaml" -f "./charts/generated-configs/config.yaml" -f "./charts/generated-configs/notification.yaml" >> openim-charts.yaml
|
||||
else
|
||||
helm template "$chart" >> openim-charts.yaml
|
||||
fi
|
||||
done
|
||||
```
|
||||
|
||||
**Use Helmfile:**
|
||||
|
||||
```bash
|
||||
GO111MODULE=on go get github.com/roboll/helmfile@latest
|
||||
```
|
||||
|
||||
```bash
|
||||
export MONGO_ADDRESS=im-mongo
|
||||
export MONGO_PORT=27017
|
||||
export REDIS_ADDRESS=im-redis-master
|
||||
export REDIS_PORT=6379
|
||||
export KAFKA_ADDRESS=im-kafka
|
||||
export KAFKA_PORT=9092
|
||||
export OBJECT_APIURL="https://openim.server.com/api"
|
||||
export MINIO_ENDPOINT="http://im-minio:9000"
|
||||
export MINIO_SIGN_ENDPOINT="https://openim.server.com/im-minio-api"
|
||||
|
||||
mkdir ./charts/generated-configs
|
||||
../scripts/genconfig.sh ../scripts/install/environment.sh ./templates/config.yaml > ./charts/generated-configs/config.yaml
|
||||
cp ../config/notification.yaml ./charts/generated-configs/notification.yaml
|
||||
../scripts/genconfig.sh ../scripts/install/environment.sh ./templates/helm-image.yaml > ./charts/generated-configs/helm-image.yaml
|
||||
```
|
||||
|
||||
```bash
|
||||
helmfile apply
|
||||
```
|
||||
|
||||
34
deployments/charts/helmfile.yaml
Normal file
34
deployments/charts/helmfile.yaml
Normal file
@ -0,0 +1,34 @@
|
||||
# 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.
|
||||
|
||||
{{- define "defaultValues" -}}
|
||||
- ./generated-configs/helm-image.yaml
|
||||
- ./generated-configs/config.yaml
|
||||
- ./generated-configs/notification.yaml
|
||||
{{- end -}}
|
||||
|
||||
{{- define "defaultRelease" -}}
|
||||
namespace: openim
|
||||
chart: ./{{ .name }}
|
||||
values:
|
||||
- ./{{ .name }}/values.yaml
|
||||
{{- template "defaultValues" . }}
|
||||
{{- end -}}
|
||||
|
||||
releases:
|
||||
{{- $apps := list "openim-api" "openim-msggateway" "openim-msgtransfer" "openim-push" "openim-rpc-auth" "openim-rpc-conversation" "openim-rpc-friend" "openim-rpc-group" "openim-rpc-msg" "openim-rpc-third" "openim-rpc-user" }}
|
||||
{{- range $app := $apps }}
|
||||
- name: {{ $app }}
|
||||
{{- template "defaultRelease" dict "name" $app }}
|
||||
{{- end }}
|
||||
23
deployments/charts/openim-api/.helmignore
Normal file
23
deployments/charts/openim-api/.helmignore
Normal file
@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
53
deployments/charts/openim-api/Chart.yaml
Normal file
53
deployments/charts/openim-api/Chart.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v2
|
||||
name: openim-api
|
||||
description: A OpenIM Api Helm chart for Kubernetes
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 0.1.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
# It is recommended to use it with quotes.
|
||||
appVersion: "1.16.0"
|
||||
|
||||
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
|
||||
|
||||
maintainers:
|
||||
- name: "OpenIM"
|
||||
url: "https://github.com/openimsdk"
|
||||
|
||||
keywords:
|
||||
- openim
|
||||
- im
|
||||
- chat
|
||||
|
||||
sources:
|
||||
- "https://github.com/openimsdk/open-im-server"
|
||||
- "https://github.com/openimsdk/helm-charts"
|
||||
201
deployments/charts/openim-api/LICENSE
Normal file
201
deployments/charts/openim-api/LICENSE
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
22
deployments/charts/openim-api/templates/NOTES.txt
Normal file
22
deployments/charts/openim-api/templates/NOTES.txt
Normal file
@ -0,0 +1,22 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
{{- range .paths }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "openim-api.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "openim-api.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "openim-api.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "openim-api.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
||||
62
deployments/charts/openim-api/templates/_helpers.tpl
Normal file
62
deployments/charts/openim-api/templates/_helpers.tpl
Normal file
@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "openim-api.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "openim-api.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "openim-api.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "openim-api.labels" -}}
|
||||
helm.sh/chart: {{ include "openim-api.chart" . }}
|
||||
{{ include "openim-api.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "openim-api.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "openim-api.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "openim-api.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "openim-api.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
27
deployments/charts/openim-api/templates/app-cm.yaml
Normal file
27
deployments/charts/openim-api/templates/app-cm.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: openim-cm
|
||||
data:
|
||||
config.yaml: |+
|
||||
{{- with .Values.config }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
notification.yaml: |+
|
||||
{{- with .Values.notification }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
86
deployments/charts/openim-api/templates/deployment.yaml
Normal file
86
deployments/charts/openim-api/templates/deployment.yaml
Normal file
@ -0,0 +1,86 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "openim-api.fullname" . }}
|
||||
labels:
|
||||
{{- include "openim-api.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "openim-api.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "openim-api.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "openim-api.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: webhook
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
#livenessProbe:
|
||||
# httpGet:
|
||||
# path: /
|
||||
# port: webhook
|
||||
#readinessProbe:
|
||||
# httpGet:
|
||||
# path: /
|
||||
# port: webhook
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- mountPath: /openim/openim-server/config/config.yaml
|
||||
name: config
|
||||
subPath: config.yaml
|
||||
- mountPath: /openim/openim-server/config/
|
||||
name: config
|
||||
subPath: notification.yaml
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-cm
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
42
deployments/charts/openim-api/templates/hpa.yaml
Normal file
42
deployments/charts/openim-api/templates/hpa.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
# 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.
|
||||
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2beta1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "openim-api.fullname" . }}
|
||||
labels:
|
||||
{{- include "openim-api.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "openim-api.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
75
deployments/charts/openim-api/templates/ingress.yaml
Normal file
75
deployments/charts/openim-api/templates/ingress.yaml
Normal file
@ -0,0 +1,75 @@
|
||||
# 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.
|
||||
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "openim-api.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "openim-api.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
29
deployments/charts/openim-api/templates/service.yaml
Normal file
29
deployments/charts/openim-api/templates/service.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "openim-api.fullname" . }}
|
||||
labels:
|
||||
{{- include "openim-api.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: webhook
|
||||
protocol: TCP
|
||||
name: webhook
|
||||
selector:
|
||||
{{- include "openim-api.selectorLabels" . | nindent 4 }}
|
||||
26
deployments/charts/openim-api/templates/serviceaccount.yaml
Normal file
26
deployments/charts/openim-api/templates/serviceaccount.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
# 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.
|
||||
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "openim-api.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "openim-api.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
100
deployments/charts/openim-api/values.yaml
Normal file
100
deployments/charts/openim-api/values.yaml
Normal file
@ -0,0 +1,100 @@
|
||||
# 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.
|
||||
|
||||
# Default values for openim-api.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: ghcr.io/openimsdk/openim-api
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a service account should be created
|
||||
create: false
|
||||
# Annotations to add to the service account
|
||||
annotations: {}
|
||||
# The name of the service account to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name: ""
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
# fsGroup: 2000
|
||||
|
||||
securityContext: {}
|
||||
# capabilities:
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
# runAsNonRoot: true
|
||||
# runAsUser: 1000
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: "nginx"
|
||||
annotations:
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- host: chart-example.local
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
resources: {}
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 80
|
||||
# targetMemoryUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
notification:
|
||||
|
||||
config:
|
||||
23
deployments/charts/openim-msggateway/.helmignore
Normal file
23
deployments/charts/openim-msggateway/.helmignore
Normal file
@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
53
deployments/charts/openim-msggateway/Chart.yaml
Normal file
53
deployments/charts/openim-msggateway/Chart.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v2
|
||||
name: openim-msggateway
|
||||
description: A Helm chart for Kubernetes
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 0.1.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
# It is recommended to use it with quotes.
|
||||
appVersion: "1.16.0"
|
||||
|
||||
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
|
||||
|
||||
maintainers:
|
||||
- name: "OpenIM"
|
||||
url: "https://github.com/openimsdk"
|
||||
|
||||
keywords:
|
||||
- openim
|
||||
- im
|
||||
- chat
|
||||
|
||||
sources:
|
||||
- "https://github.com/openimsdk/open-im-server"
|
||||
- "https://github.com/openimsdk/helm-charts"
|
||||
22
deployments/charts/openim-msggateway/templates/NOTES.txt
Normal file
22
deployments/charts/openim-msggateway/templates/NOTES.txt
Normal file
@ -0,0 +1,22 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
{{- range .paths }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "openim-msggateway.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "openim-msggateway.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "openim-msggateway.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "openim-msggateway.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
||||
62
deployments/charts/openim-msggateway/templates/_helpers.tpl
Normal file
62
deployments/charts/openim-msggateway/templates/_helpers.tpl
Normal file
@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "openim-msggateway.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "openim-msggateway.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "openim-msggateway.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "openim-msggateway.labels" -}}
|
||||
helm.sh/chart: {{ include "openim-msggateway.chart" . }}
|
||||
{{ include "openim-msggateway.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "openim-msggateway.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "openim-msggateway.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "openim-msggateway.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "openim-msggateway.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@ -0,0 +1,89 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "openim-msggateway.fullname" . }}
|
||||
labels:
|
||||
{{- include "openim-msggateway.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "openim-msggateway.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "openim-msggateway.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "openim-msggateway.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: webhook
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
- name: rpc
|
||||
containerPort: 88
|
||||
protocol: TCP
|
||||
#livenessProbe:
|
||||
# httpGet:
|
||||
# path: /
|
||||
# port: webhook
|
||||
#readinessProbe:
|
||||
# httpGet:
|
||||
# path: /
|
||||
# port: webhook
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- mountPath: /openim/openim-server/config/config.yaml
|
||||
name: config
|
||||
subPath: config.yaml
|
||||
- mountPath: /openim/openim-server/config/
|
||||
name: config
|
||||
subPath: notification.yaml
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-cm
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
42
deployments/charts/openim-msggateway/templates/hpa.yaml
Normal file
42
deployments/charts/openim-msggateway/templates/hpa.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
# 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.
|
||||
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2beta1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "openim-msggateway.fullname" . }}
|
||||
labels:
|
||||
{{- include "openim-msggateway.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "openim-msggateway.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
75
deployments/charts/openim-msggateway/templates/ingress.yaml
Normal file
75
deployments/charts/openim-msggateway/templates/ingress.yaml
Normal file
@ -0,0 +1,75 @@
|
||||
# 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.
|
||||
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "openim-msggateway.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "openim-msggateway.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
33
deployments/charts/openim-msggateway/templates/service.yaml
Normal file
33
deployments/charts/openim-msggateway/templates/service.yaml
Normal file
@ -0,0 +1,33 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "openim-msggateway.fullname" . }}
|
||||
labels:
|
||||
{{- include "openim-msggateway.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: webhook
|
||||
protocol: TCP
|
||||
name: webhook
|
||||
- port: 88
|
||||
targetPort: rpc
|
||||
protocol: TCP
|
||||
name: rpc
|
||||
selector:
|
||||
{{- include "openim-msggateway.selectorLabels" . | nindent 4 }}
|
||||
@ -0,0 +1,26 @@
|
||||
# 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.
|
||||
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "openim-msggateway.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "openim-msggateway.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
96
deployments/charts/openim-msggateway/values.yaml
Normal file
96
deployments/charts/openim-msggateway/values.yaml
Normal file
@ -0,0 +1,96 @@
|
||||
# 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.
|
||||
|
||||
# Default values for openim-msggateway.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: ghcr.io/openimsdk/openim-msggateway
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a service account should be created
|
||||
create: false
|
||||
# Annotations to add to the service account
|
||||
annotations: {}
|
||||
# The name of the service account to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name: ""
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
# fsGroup: 2000
|
||||
|
||||
securityContext: {}
|
||||
# capabilities:
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
# runAsNonRoot: true
|
||||
# runAsUser: 1000
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: "nginx"
|
||||
annotations:
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- host: chart-example.local
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
resources: {}
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 80
|
||||
# targetMemoryUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
23
deployments/charts/openim-msgtransfer/.helmignore
Normal file
23
deployments/charts/openim-msgtransfer/.helmignore
Normal file
@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
53
deployments/charts/openim-msgtransfer/Chart.yaml
Normal file
53
deployments/charts/openim-msgtransfer/Chart.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v2
|
||||
name: openim-msgtransfer
|
||||
description: A Helm chart for Kubernetes
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 0.1.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
# It is recommended to use it with quotes.
|
||||
appVersion: "1.16.0"
|
||||
|
||||
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
|
||||
|
||||
maintainers:
|
||||
- name: "OpenIM"
|
||||
url: "https://github.com/openimsdk"
|
||||
|
||||
keywords:
|
||||
- openim
|
||||
- im
|
||||
- chat
|
||||
|
||||
sources:
|
||||
- "https://github.com/openimsdk/open-im-server"
|
||||
- "https://github.com/openimsdk/helm-charts"
|
||||
22
deployments/charts/openim-msgtransfer/templates/NOTES.txt
Normal file
22
deployments/charts/openim-msgtransfer/templates/NOTES.txt
Normal file
@ -0,0 +1,22 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
{{- range .paths }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "openim-msgtransfer.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "openim-msgtransfer.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "openim-msgtransfer.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "openim-msgtransfer.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
||||
62
deployments/charts/openim-msgtransfer/templates/_helpers.tpl
Normal file
62
deployments/charts/openim-msgtransfer/templates/_helpers.tpl
Normal file
@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "openim-msgtransfer.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "openim-msgtransfer.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "openim-msgtransfer.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "openim-msgtransfer.labels" -}}
|
||||
helm.sh/chart: {{ include "openim-msgtransfer.chart" . }}
|
||||
{{ include "openim-msgtransfer.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "openim-msgtransfer.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "openim-msgtransfer.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "openim-msgtransfer.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "openim-msgtransfer.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@ -0,0 +1,86 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "openim-msgtransfer.fullname" . }}
|
||||
labels:
|
||||
{{- include "openim-msgtransfer.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "openim-msgtransfer.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "openim-msgtransfer.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "openim-msgtransfer.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: webhook
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
#livenessProbe:
|
||||
# httpGet:
|
||||
# path: /
|
||||
# port: webhook
|
||||
#readinessProbe:
|
||||
# httpGet:
|
||||
# path: /
|
||||
# port: webhook
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- mountPath: /openim/openim-server/config/config.yaml
|
||||
name: config
|
||||
subPath: config.yaml
|
||||
- mountPath: /openim/openim-server/config/
|
||||
name: config
|
||||
subPath: notification.yaml
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-cm
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
42
deployments/charts/openim-msgtransfer/templates/hpa.yaml
Normal file
42
deployments/charts/openim-msgtransfer/templates/hpa.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
# 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.
|
||||
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2beta1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "openim-msgtransfer.fullname" . }}
|
||||
labels:
|
||||
{{- include "openim-msgtransfer.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "openim-msgtransfer.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
75
deployments/charts/openim-msgtransfer/templates/ingress.yaml
Normal file
75
deployments/charts/openim-msgtransfer/templates/ingress.yaml
Normal file
@ -0,0 +1,75 @@
|
||||
# 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.
|
||||
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "openim-msgtransfer.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "openim-msgtransfer.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
29
deployments/charts/openim-msgtransfer/templates/service.yaml
Normal file
29
deployments/charts/openim-msgtransfer/templates/service.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "openim-msgtransfer.fullname" . }}
|
||||
labels:
|
||||
{{- include "openim-msgtransfer.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: webhook
|
||||
protocol: TCP
|
||||
name: webhook
|
||||
selector:
|
||||
{{- include "openim-msgtransfer.selectorLabels" . | nindent 4 }}
|
||||
@ -0,0 +1,26 @@
|
||||
# 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.
|
||||
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "openim-msgtransfer.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "openim-msgtransfer.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
96
deployments/charts/openim-msgtransfer/values.yaml
Normal file
96
deployments/charts/openim-msgtransfer/values.yaml
Normal file
@ -0,0 +1,96 @@
|
||||
# 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.
|
||||
|
||||
# Default values for openim-msgtransfer.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: ghcr.io/openimsdk/openim-msgtransfer
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a service account should be created
|
||||
create: false
|
||||
# Annotations to add to the service account
|
||||
annotations: {}
|
||||
# The name of the service account to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name: ""
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
# fsGroup: 2000
|
||||
|
||||
securityContext: {}
|
||||
# capabilities:
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
# runAsNonRoot: true
|
||||
# runAsUser: 1000
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- host: chart-example.local
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
resources: {}
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 80
|
||||
# targetMemoryUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
23
deployments/charts/openim-push/.helmignore
Normal file
23
deployments/charts/openim-push/.helmignore
Normal file
@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
53
deployments/charts/openim-push/Chart.yaml
Normal file
53
deployments/charts/openim-push/Chart.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v2
|
||||
name: openim-push
|
||||
description: A Helm chart for Kubernetes
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 0.1.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
# It is recommended to use it with quotes.
|
||||
appVersion: "1.16.0"
|
||||
|
||||
icon: https://raw.githubusercontent.com/openimsdk/open-im-server/main/assets/openim-logo-gradient.svg
|
||||
|
||||
maintainers:
|
||||
- name: "OpenIM"
|
||||
url: "https://github.com/openimsdk"
|
||||
|
||||
keywords:
|
||||
- openim
|
||||
- im
|
||||
- chat
|
||||
|
||||
sources:
|
||||
- "https://github.com/openimsdk/open-im-server"
|
||||
- "https://github.com/openimsdk/helm-charts"
|
||||
22
deployments/charts/openim-push/templates/NOTES.txt
Normal file
22
deployments/charts/openim-push/templates/NOTES.txt
Normal file
@ -0,0 +1,22 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
{{- range .paths }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "openim-push.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "openim-push.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "openim-push.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "openim-push.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
||||
62
deployments/charts/openim-push/templates/_helpers.tpl
Normal file
62
deployments/charts/openim-push/templates/_helpers.tpl
Normal file
@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "openim-push.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "openim-push.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "openim-push.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "openim-push.labels" -}}
|
||||
helm.sh/chart: {{ include "openim-push.chart" . }}
|
||||
{{ include "openim-push.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "openim-push.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "openim-push.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "openim-push.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "openim-push.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user