mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 14:29:19 +08:00
Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 67ba395907 | |||
| 51ad54b039 | |||
| d0bd1f9923 | |||
| a60bce5cf7 | |||
| bb7f359829 | |||
| 79fdcc8159 | |||
| a01e7eaafb | |||
| 4c9b03ae4f | |||
| 6745b40094 | |||
| 5131fc1041 | |||
| 0aea79fd88 | |||
| ef446aa3d7 | |||
| c1761f6446 | |||
| 7b29663a4c | |||
| ff9b258229 | |||
| 38d4babf30 | |||
| 7f4de7fda7 | |||
| 859063ddba | |||
| ae0d16b06a | |||
| d3364e374f | |||
| f0ad869d29 | |||
| 84c7cc1801 | |||
| b02d65bf9a | |||
| 90659a30b6 | |||
| 3599d4b7ef | |||
| cf8bba036f | |||
| 0f05ff52a3 | |||
| ef399caa4d | |||
| b818259100 | |||
| 7e8b975e22 | |||
| 888351493a | |||
| 0953f616f0 | |||
| 5742932df5 | |||
| 1f25f7dc78 | |||
| 7994b377f7 | |||
| 45a0266b20 | |||
| a38dfb9a1d | |||
| 391e3ea10c | |||
| 8b365ae49f | |||
| e2efd7abdd | |||
| c3e721f145 | |||
| 958afd6115 | |||
| 0f2d9308e8 | |||
| 4f1dacabfa | |||
| 0c11880326 | |||
| b0d940945f | |||
| 36bb68e1e6 | |||
| d5996217a2 | |||
| 6f9f7c767c | |||
| dd5f2d0476 | |||
| 84c60cd6b6 |
@@ -1,19 +1,5 @@
|
||||
# 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.
|
||||
|
||||
USER=root
|
||||
PASSWORD=openIM123
|
||||
MINIO_ENDPOINT=http://113.90.85.238:10005
|
||||
API_URL=http://113.90.85.238:10002/object/
|
||||
DATA_DIR=/root/workspaces/openim/openim-server
|
||||
MINIO_ENDPOINT=http://127.0.0.1:10005
|
||||
API_URL=http://127.0.0.1:10002
|
||||
DATA_DIR=./
|
||||
|
||||
+13
-2
@@ -75,6 +75,17 @@ OpenIMSDK/OpenKF:
|
||||
dest: .github/.codecov.yml
|
||||
replace: false
|
||||
|
||||
openim-sigs/openim-docker:
|
||||
- source: ./config
|
||||
dest: ./openim-server/config
|
||||
replace: true
|
||||
- source: ./docs
|
||||
dest: ./openim-server/docs
|
||||
replace: true
|
||||
- source: ./scripts
|
||||
dest: ./openim-server/scripts
|
||||
replace: true
|
||||
|
||||
group:
|
||||
# first group:common to all warehouses
|
||||
# TODO: add the required warehouse here
|
||||
@@ -86,7 +97,7 @@ group:
|
||||
OpenIMSDK/community
|
||||
OpenIMSDK/openim-charts
|
||||
OpenIMSDK/openim-sdk-cpp@main
|
||||
files:
|
||||
files:
|
||||
- source: LICENSE
|
||||
dest: LICENSE
|
||||
replace: false
|
||||
@@ -116,4 +127,4 @@ group:
|
||||
replace: false
|
||||
- source: ./scripts/githooks/
|
||||
dest: ./scripts/githooks/
|
||||
replace: true
|
||||
replace: true
|
||||
|
||||
+97
-102
@@ -36,12 +36,12 @@ env:
|
||||
GO_VERSION: "1.19"
|
||||
GOLANGCI_VERSION: "v1.50.1"
|
||||
|
||||
|
||||
jobs:
|
||||
openim:
|
||||
name: Test with go ${{ matrix.go_version }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
|
||||
contents: write
|
||||
environment:
|
||||
name: openim
|
||||
@@ -52,108 +52,63 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go_version }}
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
id: go
|
||||
- name: Setup
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go_version }}
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v1
|
||||
with:
|
||||
version: 2.x
|
||||
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v1
|
||||
with:
|
||||
version: 2.x
|
||||
- name: Module Operations
|
||||
run: |
|
||||
sudo make tidy
|
||||
sudo make tools.verify.go-gitlint
|
||||
|
||||
- name: Run go modules tidy
|
||||
run: |
|
||||
sudo make tidy
|
||||
sudo make tools.verify.go-gitlint
|
||||
echo "Run go modules tidy successfully"
|
||||
- name: Format Code
|
||||
run: sudo make format
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run go format
|
||||
run: |
|
||||
sudo make format
|
||||
echo "Run go format successfully"
|
||||
continue-on-error: true
|
||||
- name: Generate Files
|
||||
run: make gen
|
||||
continue-on-error: true
|
||||
|
||||
- name: Generate all necessary files, such as error code files
|
||||
run: |
|
||||
make generate
|
||||
echo "Generate all necessary files successfully"
|
||||
continue-on-error: true
|
||||
- name: Build Source
|
||||
run: sudo make build
|
||||
|
||||
- name: Run unit test and get test coverage
|
||||
run: |
|
||||
make cover
|
||||
echo "Run unit test and get test coverage successfully"
|
||||
continue-on-error: true
|
||||
- name: Cleanup Build
|
||||
run: sudo make clean
|
||||
|
||||
- name: Build source code for host platform
|
||||
run: |
|
||||
sudo make build
|
||||
echo "Build source code for host platform successfully"
|
||||
- name: Push Changes to Main
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "cicd: robot automated Change"
|
||||
branch: main
|
||||
continue-on-error: true
|
||||
|
||||
- name: OpenIM verify copyright
|
||||
run: |
|
||||
sudo make verify-copyright
|
||||
sudo make add-copyright
|
||||
echo "OpenIM verify successfully"
|
||||
continue-on-error: true
|
||||
- name: Set Current Directory
|
||||
id: set_directory
|
||||
run: echo "::set-output name=directory::$(pwd)"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Clean all build
|
||||
run: |
|
||||
sudo make clean
|
||||
echo "Clean all build successfully"
|
||||
|
||||
- name: push OpenIM
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "cicd: robot automated Change"
|
||||
# commit_options: '--no-verify --signoff'
|
||||
branch: main
|
||||
# create_branch: true
|
||||
# # Optional commit user and author settings
|
||||
# commit_user_name: kubbot # defaults to "github-actions[bot]"
|
||||
# commit_user_email: 3293172751ysy@gmail.com # defaults to "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
# commit_author: Kubbot # defaults to author of the commit that triggered the run
|
||||
continue-on-error: true
|
||||
|
||||
- name: Commit Changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "chore(fmt): robot automated format and lint Change"
|
||||
commit_options: '--no-verify --signoff'
|
||||
branch: main
|
||||
continue-on-error: true
|
||||
|
||||
- name: Set Current Directory
|
||||
id: set_directory
|
||||
run: |
|
||||
echo "::set-output name=directory::$(pwd)"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Collect Test Coverage File
|
||||
id: collect_coverage
|
||||
run: |
|
||||
cd ${{ steps.set_directory.outputs.directory }}
|
||||
make cover
|
||||
echo "::set-output name=coverage_file::./_output/tmp/coverage.out"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Display Test Coverage
|
||||
run: |
|
||||
echo "Test Coverage:"
|
||||
cat ${{ steps.collect_coverage.outputs.coverage_file }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
continue-on-error: true
|
||||
- name: Collect and Display Test Coverage
|
||||
id: collect_coverage
|
||||
run: |
|
||||
cd ${{ steps.set_directory.outputs.directory }}
|
||||
make cover
|
||||
echo "::set-output name=coverage_file::./_output/tmp/coverage.out"
|
||||
echo "Test Coverage:"
|
||||
cat ${{ steps.collect_coverage.outputs.coverage_file }}
|
||||
continue-on-error: true
|
||||
|
||||
openim-start:
|
||||
name: Teat OpenIM make install start on ${{ matrix.os }}
|
||||
name: Test OpenIM install/start on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
environment:
|
||||
name: openim
|
||||
@@ -162,15 +117,55 @@ jobs:
|
||||
go_version: ["1.21"]
|
||||
os: ["ubuntu-latest"]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go_version }}
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
id: go
|
||||
- name: Checkout and Install OpenIM
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v1
|
||||
with:
|
||||
version: 2.x
|
||||
- name: Run OpenIM make install start
|
||||
run: |
|
||||
sudo make install
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
execute-scripts:
|
||||
name: Execute OpenIM script on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
environment:
|
||||
name: openim
|
||||
strategy:
|
||||
matrix:
|
||||
go_version: ["1.20"]
|
||||
os: ["ubuntu-latest"]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Run OpenIM make install start
|
||||
run: |
|
||||
sudo make install
|
||||
- name: Set up Go ${{ matrix.go_version }}
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
id: go
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v1
|
||||
with:
|
||||
version: 2.x
|
||||
- name: Docker Operations
|
||||
run: |
|
||||
curl -o docker-compose.yaml https://gist.githubusercontent.com/cubxxw/b1d5cbd2edfa23fee911118aa3e8249e/raw/openim-server.sh
|
||||
sudo docker compose up -d
|
||||
sudo sleep 60
|
||||
|
||||
- name: Module Operations
|
||||
run: |
|
||||
sudo make tidy
|
||||
sudo make tools.verify.go-gitlint
|
||||
|
||||
- name: Build, Start and Check Services
|
||||
run: |
|
||||
make build
|
||||
make start
|
||||
make check
|
||||
|
||||
- name: Print OpenIM Logs
|
||||
run: sudo cat ./_output/logs/* 2>/dev/null
|
||||
continue-on-error: true
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: OpenIM Server Release
|
||||
name: OpenIM Server Release Workflow
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: OpenIM Start Execute Scripts
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "README.md"
|
||||
- "README_zh-CN.md"
|
||||
- "CONTRIBUTING.md"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- "README_zh-CN.md"
|
||||
- "CONTRIBUTING.md"
|
||||
- "docs/**"
|
||||
|
||||
jobs:
|
||||
execute-scripts:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download Docker Compose
|
||||
run: |
|
||||
curl -o docker-compose.yaml https://gist.githubusercontent.com/cubxxw/b1d5cbd2edfa23fee911118aa3e8249e/raw/openim-server.sh
|
||||
shell: bash
|
||||
|
||||
- name: Start Docker Compose
|
||||
run: |
|
||||
sudo docker compose up -d
|
||||
sudo sleep 60
|
||||
continue-on-error: true
|
||||
|
||||
- name: Stop all services
|
||||
run: |
|
||||
sudo chmod +x ./scripts/stop-all.sh
|
||||
sudo ./scripts/stop-all.sh
|
||||
sudo cat logs/openIM.log 2>/dev/null
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
- name: Build all services
|
||||
run: |
|
||||
sudo chmod +x ./scripts/build-all-service.sh
|
||||
sudo ./scripts/build-all-service.sh
|
||||
sudo cat logs/openIM.log 2>/dev/null
|
||||
shell: bash
|
||||
|
||||
- name: Start all services
|
||||
run: |
|
||||
sudo chmod +x ./scripts/start-all.sh
|
||||
sudo ./scripts/start-all.sh
|
||||
sudo cat logs/openIM.log 2>/dev/null
|
||||
continue-on-error: true
|
||||
shell: bash
|
||||
|
||||
- name: Check all services
|
||||
run: |
|
||||
sudo chmod +x ./scripts/check_all.sh
|
||||
sudo ./scripts/check_all.sh
|
||||
sudo cat logs/openIM.log 2>/dev/null
|
||||
shell: bash
|
||||
|
||||
- name: Print openIM.log
|
||||
run: |
|
||||
sudo cat logs/* 2>/dev/null
|
||||
sudo cat logs/* 2>/dev/null >> "$GITHUB_OUTPUT"
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
@@ -6,6 +6,10 @@
|
||||
name: Synchronize kubecub public code to other repositories
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- scripts/*
|
||||
- docs/*
|
||||
- config/*
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -30,6 +30,12 @@ bin/
|
||||
output/
|
||||
_output/
|
||||
|
||||
### OpenIM Config ###
|
||||
config/config.yaml
|
||||
./config/config.yaml
|
||||
.env
|
||||
./.env
|
||||
|
||||
### OpenIM deploy ###
|
||||
deploy/openim_demo
|
||||
deploy/openim-api
|
||||
@@ -157,6 +163,7 @@ vendor/
|
||||
|
||||
# Go workspace file
|
||||
# go.work
|
||||
go.work.sum
|
||||
|
||||
### JetBrains ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
|
||||
+4
-4
@@ -10,7 +10,7 @@ ENV GOPROXY=$GOPROXY
|
||||
# Set up the working directory
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY go.mod go.sum go.work go.work.sum ./
|
||||
COPY go.mod go.sum go.work ./
|
||||
#RUN go mod download
|
||||
|
||||
# Copy all files to the container
|
||||
@@ -19,13 +19,13 @@ ADD . .
|
||||
RUN make clean
|
||||
RUN make build
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
FROM ghcr.io/openim-sigs/openim-ubuntu-image:latest
|
||||
|
||||
WORKDIR ${SERVER_WORKDIR}
|
||||
|
||||
# Copy scripts and binary files to the production image
|
||||
COPY --from=builder ${OPENIM_SERVER_BINDIR} /openim/openim-server/_output/bin
|
||||
COPY --from=builder ${OPENIM_SERVER_CMDDIR} /openim/openim-server/scripts
|
||||
COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config
|
||||
COPY --from=builder ${OPENIM_SERVER_BINDIR} /openim/openim-server/_output/bin
|
||||
|
||||
CMD ["bash","-c","${OPENIM_SERVER_CMDDIR}/docker-start-all.sh"]
|
||||
CMD ["/openim/openim-server/scripts/docker-start-all.sh"]
|
||||
|
||||
+1
-1
@@ -267,7 +267,7 @@ bashCopy code
|
||||
|
||||
```
|
||||
bashCopy code
|
||||
./scripts/check_all.sh
|
||||
./scripts/check-all.sh
|
||||
```
|
||||
|
||||
停止服务
|
||||
|
||||
@@ -111,73 +111,113 @@ Further enhancing your experience, we also provide an SDK client, wherein most c
|
||||
|
||||
## :rocket: Quick Start
|
||||
|
||||
You can quickly learn OpenIM engineering solutions, all it takes is one simple command:
|
||||
|
||||
```bash
|
||||
$ make demo
|
||||
```
|
||||
|
||||
🤲 In order to facilitate the user experience, we have provided a variety of deployment solutions, you can choose your own deployment method according to the list below:
|
||||
|
||||
<details> <summary>Deploying with Docker Compose</summary>
|
||||
|
||||
1. Clone the project
|
||||
|
||||
> docker compose will not be maintained in future versions, but it is still the easiest and most convenient way to organize docker compose deployments into a separate project https://github.com/openim-sigs/openim-docker to maintain.
|
||||
|
||||
**1. Clone the project**
|
||||
|
||||
|
||||
```bash
|
||||
# choose what you need
|
||||
BRANCH=release-v3.1
|
||||
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
|
||||
# choose what you need, We take branch 3.2 as an example
|
||||
$ BRANCH=release-v3.2
|
||||
$ git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim/openim-server && export openim_dir=$(pwd)/openim && cd ${openim_dir}/openim-server
|
||||
```
|
||||
|
||||
> **Note**
|
||||
> Read our release policy: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
|
||||
> If you don't know OpenIM's versioning policy, 📚Read our release policy: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
|
||||
|
||||
2. Modify `.env`
|
||||
|
||||
|
||||
**2. Configure the config file**
|
||||
|
||||
If you tried to get started quickly with `make demo`, then you know that our config file is generated by automation.
|
||||
|
||||
You can use `make init` to quickly initialize a configuration file
|
||||
|
||||
```bash
|
||||
USER=root #no need to modify
|
||||
PASSWORD=openIM123 #A combination of 8 or more numbers and letters, this password applies to redis, mysql, mongo, as well as accessSecret in config/config.yaml
|
||||
ENDPOINT=http://127.0.0.1:10005 #minio's external service IP and port, or use the domain name storage.xx.xx, the app must be able to access this IP and port or domain,
|
||||
API_URL=http://127.0.0.1:10002/object/ #the app must be able to access this IP and port or domain,
|
||||
DATA_DIR=./ #designate large disk directory
|
||||
$ make init
|
||||
$ git diff
|
||||
```
|
||||
|
||||
3. Deploy and start
|
||||
Then feel free to modify your current config file, you can also modify `/scripts/install/environment.sh` document template, `make init` is essentially rendering `environment.sh` template, and then through the `make init` to automatically generate a new configuration.
|
||||
|
||||
> **Note**
|
||||
> This command can only be executed once. It will modify the component passwords in docker-compose based on the `PASSWORD` variable in `.env`, and modify the component passwords in `config/config.yaml`. If the password in `.env` changes, you need to first execute `docker-compose down`; `rm components -rf` and then execute this command.
|
||||
If you only need to change the config file for a short time, or if you don't want to make any major changes in the future, you can modify the `.env file directly
|
||||
|
||||
```bash
|
||||
make install
|
||||
USER=root #no need to modify
|
||||
PASSWORD=openIM123 #A combination of 8 or more numbers and letters, this password applies to redis, mysql, mongo, as well as accessSecret in config/config.yaml
|
||||
ENDPOINT=http://127.0.0.1:10005 #minio's external service IP and port, or use the domain name storage.xx.xx, the app must be able to access this IP and port or domain,
|
||||
API_URL=http://127.0.0.1:10002/object/ #the app must be able to access this IP and port or domain,
|
||||
DATA_DIR=./ #designate large disk directory
|
||||
```
|
||||
|
||||
**3. Deploy and start**
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> You can deploy either directly with `make install` or with `docker compose up`, the logic is the same
|
||||
|
||||
```bash
|
||||
$ make install
|
||||
# OR
|
||||
$ docker-compose up
|
||||
```
|
||||
|
||||
4. Check the service
|
||||
|
||||
```bash
|
||||
make check
|
||||
$ make check
|
||||
```
|
||||
|
||||

|
||||
Looking at the command line at this point, there are two items in the output, checking for the start of the component port that OpenIM depends on, and the start of the OpenIM core component
|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Compile from Source</summary>
|
||||
|
||||
|
||||
Ur need `Go 1.18` or higher version, and `make`.
|
||||
|
||||
|
||||
```bash
|
||||
go version && make --version || echo "Error: One of the commands failed."
|
||||
```
|
||||
|
||||
Version Details: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
|
||||
|
||||
```bash
|
||||
# choose what you need
|
||||
BRANCH=release-v3.1
|
||||
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
|
||||
$ BRANCH=release-v3.1
|
||||
$ git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make start
|
||||
```
|
||||
|
||||
Read about the [OpenIM Version Policy](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
|
||||
> `make help` to help you see the instructions supported by OpenIM.
|
||||
|
||||
`make help` to help you see the instructions supported by OpenIM.
|
||||
Use `make check` to check all component starts
|
||||
|
||||
All services have been successfully built as shown in the figure
|
||||
```bash
|
||||
$ make check
|
||||
```
|
||||
|
||||

|
||||
You can use the `make help-all` see OpenIM in action.
|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Component Configuration Instructions</summary>
|
||||
The `config/config.yaml` file has detailed configuration instructions for the storage components.
|
||||
|
||||
The config/config.yaml file has detailed configuration instructions for the storage components.
|
||||
|
||||
The config file is available via [environment.sh](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/scripts/install/environment.sh) configuration [openim.yaml](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployments/templates/openim.yaml) template, and then through the `make init` to automatically generate a new configuration.
|
||||
|
||||
- Zookeeper
|
||||
|
||||
@@ -260,30 +300,16 @@ The config/config.yaml file has detailed configuration instructions for the stor
|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Start and Stop Services</summary>
|
||||
<details> <summary>Deployed with kubernetes</summary>
|
||||
|
||||
Start services
|
||||
|
||||
```
|
||||
./scripts/start-all.sh;
|
||||
```
|
||||
|
||||
Check services
|
||||
|
||||
```
|
||||
./scripts/check_all.sh
|
||||
```
|
||||
|
||||
Stop services
|
||||
|
||||
```
|
||||
./scripts/stop-all.sh
|
||||
```
|
||||
read: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployments/README.md
|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Open IM Ports</summary>
|
||||
|
||||
|
||||
| TCP Port | Description | Operation |
|
||||
| --------- | ------------------------------------------------------------ | ----------------------------------------------------- |
|
||||
| TCP:10001 | ws protocol, message port such as message sending, pushing etc, used for client SDK | Port release or nginx reverse proxy, and firewall off |
|
||||
@@ -294,6 +320,7 @@ Stop services
|
||||
|
||||
<details> <summary>Open Chat Ports</summary>
|
||||
|
||||
|
||||
+ chat warehouse: https://github.com/OpenIMSDK/chat
|
||||
|
||||
| TCP Port | Description | Operation |
|
||||
@@ -303,6 +330,7 @@ Stop services
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
## :link: Relationship Between APP and OpenIM
|
||||
|
||||
OpenIM isn't just an open-source instant messaging component, it's an integral part of your application ecosystem. Check out this diagram to understand how AppServer, AppClient, Open-IM-Server, and Open-IM-SDK interact.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the License);
|
||||
# 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
|
||||
#
|
||||
@@ -13,10 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# TODO: This config file is the template file
|
||||
# --| source: scripts/template/config-tmpl/openim_config.yaml
|
||||
# --| env: scripts/install/environment.sh
|
||||
# --| target: config/config.yaml
|
||||
# Infrastructural configurations, please modify based on your setup
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
###################### Zookeeper ######################
|
||||
@@ -29,8 +26,8 @@
|
||||
zookeeper:
|
||||
schema: openim
|
||||
address: [ 127.0.0.1:2181 ]
|
||||
username: ''
|
||||
password: ''
|
||||
username:
|
||||
password:
|
||||
|
||||
###################### Mysql ######################
|
||||
# MySQL configuration
|
||||
@@ -60,23 +57,23 @@ mysql:
|
||||
# Default MongoDB database name
|
||||
# Maximum connection pool size
|
||||
mongo:
|
||||
uri: ''
|
||||
uri:
|
||||
address: [ 127.0.0.1:37017 ]
|
||||
database: openIM_v3
|
||||
username: root
|
||||
password: openIM123
|
||||
maxPoolSize: 100
|
||||
|
||||
###################### Redis configuration information ######################
|
||||
###################### Redis ######################
|
||||
# Redis configuration
|
||||
#
|
||||
# Username is required only for Redis version 6.0+
|
||||
redis:
|
||||
address: [ 127.0.0.1:16379 ]
|
||||
username: ''
|
||||
username:
|
||||
password: openIM123
|
||||
|
||||
###################### Kafka configuration information ######################
|
||||
###################### Kafka ######################
|
||||
# Kafka configuration
|
||||
#
|
||||
# Kafka username
|
||||
@@ -84,8 +81,8 @@ redis:
|
||||
# It's not recommended to modify this topic name
|
||||
# Consumer group ID, it's not recommended to modify
|
||||
kafka:
|
||||
username: ''
|
||||
password: ''
|
||||
username:
|
||||
password:
|
||||
addr: [ 127.0.0.1:9092 ]
|
||||
latestMsgToRedis:
|
||||
topic: "latestMsgToRedis"
|
||||
@@ -99,16 +96,16 @@ kafka:
|
||||
msgToMySql: mysql
|
||||
msgToPush: push
|
||||
|
||||
###################### RPC configuration information ######################
|
||||
###################### RPC ######################
|
||||
# RPC configuration
|
||||
#
|
||||
# IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway
|
||||
# Default listen IP is 0.0.0.0
|
||||
rpc:
|
||||
registerIP: ''
|
||||
registerIP:
|
||||
listenIP: 0.0.0.0
|
||||
|
||||
###################### API configuration information ######################
|
||||
###################### API ######################
|
||||
# API configuration
|
||||
#
|
||||
# API service port
|
||||
@@ -117,7 +114,7 @@ api:
|
||||
openImApiPort: [ 10002 ]
|
||||
listenIP: 0.0.0.0
|
||||
|
||||
###################### Object configuration information ######################
|
||||
###################### Gateway ######################
|
||||
# Object storage configuration
|
||||
#
|
||||
# Use minio for object storage
|
||||
@@ -132,34 +129,32 @@ api:
|
||||
# minio.signEndpoint is minio public network address
|
||||
object:
|
||||
enable: "minio"
|
||||
apiURL: "http://127.0.0.1:10002/object/"
|
||||
apiURL: "http://127.0.0.1:10002"
|
||||
minio:
|
||||
bucket: "openim"
|
||||
endpoint: "http://113.90.85.238:10005"
|
||||
endpoint: "http://127.0.0.1:10005"
|
||||
accessKeyID: "root"
|
||||
secretAccessKey: "openIM123"
|
||||
sessionToken: ''
|
||||
signEndpoint: "http://113.90.85.238:10005"
|
||||
sessionToken: ""
|
||||
signEndpoint: "http://127.0.0.1:10005"
|
||||
cos:
|
||||
bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
|
||||
secretID: ''
|
||||
secretKey: ''
|
||||
sessionToken: ''
|
||||
bucketURL: "https://temp-1252357374.cos.ap-chengdu.myqcloud.com"
|
||||
secretID: ""
|
||||
secretKey: ""
|
||||
sessionToken: ""
|
||||
oss:
|
||||
endpoint: "https://oss-cn-chengdu.aliyuncs.com"
|
||||
bucket: "demo-9999999"
|
||||
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com"
|
||||
accessKeyID: root
|
||||
accessKeySecret: ''
|
||||
sessionToken: ''
|
||||
accessKeyID: ""
|
||||
accessKeySecret: ""
|
||||
sessionToken: ""
|
||||
|
||||
|
||||
###################### RPC Port Configuration ######################
|
||||
# RPC service ports
|
||||
# These ports are passed into the program by the script and are not recommended to modify
|
||||
# For launching multiple programs, just fill in multiple ports separated by commas
|
||||
# For example, [10110, 10111]
|
||||
rpcPort:
|
||||
rpcPort:
|
||||
openImUserPort: [ 10110 ]
|
||||
openImFriendPort: [ 10120 ]
|
||||
openImMessagePort: [ 10130 ]
|
||||
@@ -170,7 +165,6 @@ rpcPort:
|
||||
openImConversationPort: [ 10180 ]
|
||||
openImThirdPort: [ 10190 ]
|
||||
|
||||
###################### RPC Register Name Configuration ######################
|
||||
# RPC service names for registration, it's not recommended to modify these
|
||||
rpcRegisterName:
|
||||
openImUserName: User
|
||||
@@ -183,7 +177,6 @@ rpcRegisterName:
|
||||
openImConversationName: Conversation
|
||||
openImThirdName: Third
|
||||
|
||||
###################### Log Configuration ######################
|
||||
# Log configuration
|
||||
#
|
||||
# Storage directory
|
||||
@@ -194,15 +187,14 @@ rpcRegisterName:
|
||||
# Whether to output in json format
|
||||
# Whether to include stack trace in logs
|
||||
log:
|
||||
storageLocation: /root/workspaces/openim/openim-server/logs/
|
||||
storageLocation: ../../../../../logs/
|
||||
rotationTime: 24
|
||||
remainRotationCount: 2
|
||||
remainLogLevel: 6
|
||||
isStdout: false
|
||||
isStdout: false
|
||||
isJson: false
|
||||
withStack: false
|
||||
|
||||
###################### Variables definition ######################
|
||||
# Long connection server configuration
|
||||
#
|
||||
# Websocket port for msg_gateway
|
||||
@@ -232,7 +224,7 @@ push:
|
||||
channelID: ""
|
||||
channelName: ""
|
||||
fcm:
|
||||
serviceAccount: x.json
|
||||
serviceAccount: "x.json"
|
||||
jpns:
|
||||
appKey:
|
||||
masterSecret:
|
||||
@@ -244,8 +236,8 @@ push:
|
||||
# Built-in app manager user IDs
|
||||
# Built-in app manager nicknames
|
||||
manager:
|
||||
userID: [ "openIM123456", "openIM654321", "openIMAdmin" ]
|
||||
nickname: [ "system1", "system2", "system3" ]
|
||||
userID: [ "openIM123456","openIM654321","openIMAdmin" ]
|
||||
nickname: [ "system1","system2", "system3" ]
|
||||
|
||||
# Multi-platform login policy
|
||||
# For each platform(Android, iOS, Windows, Mac, web), only one can be online at a time
|
||||
@@ -299,7 +291,6 @@ iosPush:
|
||||
badgeCount: true
|
||||
production: false
|
||||
|
||||
###################### Third-party service configuration ######################
|
||||
# Callback configuration
|
||||
#
|
||||
# Callback URL
|
||||
@@ -369,7 +360,7 @@ callback:
|
||||
failedContinue: true
|
||||
|
||||
###################### Prometheus ######################
|
||||
# Prometheus configuration for various services
|
||||
# Prometheus configuration
|
||||
# The number of Prometheus ports per service needs to correspond to rpcPort
|
||||
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||
prometheus:
|
||||
@@ -384,4 +375,4 @@ prometheus:
|
||||
conversationPrometheusPort: [ 20230 ]
|
||||
rtcPrometheusPort: [ 21300 ]
|
||||
thirdPrometheusPort: [ 21301 ]
|
||||
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # List of ports
|
||||
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ]
|
||||
@@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC CONVERSATION
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-conversation
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-conversation
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-conversation --config=${OPENIM_CONFIG_DIR}/openim-rpc-conversation.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC FRIEND
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-friend
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-friend
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-friend --config=${OPENIM_CONFIG_DIR}/openim-rpc-friend.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC GROUP
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-group
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-group
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-group --config=${OPENIM_CONFIG_DIR}/openim-rpc-group.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC MSG
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-msg
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-msg
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-msg --config=${OPENIM_CONFIG_DIR}/openim-rpc-msg.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC THIRD
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-third
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-third
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-third --config=${OPENIM_CONFIG_DIR}/openim-rpc-third.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC USER
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-user
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-user
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-user --config=${OPENIM_CONFIG_DIR}/openim-rpc-user.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-cmdutils
|
||||
description: "This is a description for openim-cmdutils"
|
||||
type: "service"
|
||||
@@ -1,384 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# This config file is the template file
|
||||
# --| source: scripts/template/config-tmpl/openim_config.yaml
|
||||
# --| env: scripts/install/environment.sh
|
||||
# --| target: config/config.yaml
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
###################### Zookeeper ######################
|
||||
# Zookeeper configuration
|
||||
# It's not recommended to modify the schema
|
||||
#
|
||||
# Zookeeper address
|
||||
# Zookeeper username
|
||||
# Zookeeper password
|
||||
zookeeper:
|
||||
schema: "openim"
|
||||
address: [ "127.0.0.1:2181" ]
|
||||
username: ""
|
||||
password: ""
|
||||
|
||||
###################### Mysql ######################
|
||||
# MySQL configuration
|
||||
# Currently, only single machine setup is supported
|
||||
#
|
||||
# Maximum number of open connections
|
||||
# Maximum number of idle connections
|
||||
# Maximum lifetime in seconds a connection can be reused
|
||||
# Log level: 1=slient, 2=error, 3=warn, 4=info
|
||||
# Slow query threshold in milliseconds
|
||||
mysql:
|
||||
address: [ "127.0.0.1:13306" ]
|
||||
username: "root"
|
||||
password: "openIM123"
|
||||
database: "openIM_v3"
|
||||
maxOpenConn: "1000"
|
||||
maxIdleConn: "100"
|
||||
maxLifeTime: "60"
|
||||
logLevel: "4"
|
||||
slowThreshold: "500"
|
||||
|
||||
###################### Mongo ######################
|
||||
# MongoDB configuration
|
||||
# If uri is not empty, it will be used directly
|
||||
#
|
||||
# MongoDB address for standalone setup, Mongos address for sharded cluster setup
|
||||
# Default MongoDB database name
|
||||
# Maximum connection pool size
|
||||
mongo:
|
||||
uri: ""
|
||||
address: [ "127.0.0.1:37017" ]
|
||||
database: "openIM_v3"
|
||||
username: "root"
|
||||
password: "openIM123"
|
||||
maxPoolSize: "100"
|
||||
|
||||
###################### Redis configuration information ######################
|
||||
# Redis configuration
|
||||
#
|
||||
# Username is required only for Redis version 6.0+
|
||||
redis:
|
||||
address: [ "127.0.0.1:16379" ]
|
||||
username: ""
|
||||
password: "openIM123"
|
||||
|
||||
###################### Kafka configuration information ######################
|
||||
# Kafka configuration
|
||||
#
|
||||
# Kafka username
|
||||
# Kafka password
|
||||
# It's not recommended to modify this topic name
|
||||
# Consumer group ID, it's not recommended to modify
|
||||
kafka:
|
||||
username: ""
|
||||
password: ""
|
||||
addr: [ "127.0.0.1:9092" ]
|
||||
latestMsgToRedis:
|
||||
topic: "latestMsgToRedis"
|
||||
offlineMsgToMongo:
|
||||
topic: "offlineMsgToMongoMysql"
|
||||
msgToPush:
|
||||
topic: "msgToPush"
|
||||
consumerGroupID:
|
||||
msgToRedis: "redis"
|
||||
msgToMongo: "mongo"
|
||||
msgToMySql: "mysql"
|
||||
msgToPush: "push"
|
||||
|
||||
###################### RPC configuration information ######################
|
||||
# RPC configuration
|
||||
#
|
||||
# IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway
|
||||
# Default listen IP is 0.0.0.0
|
||||
rpc:
|
||||
registerIP: ""
|
||||
listenIP: "0.0.0.0"
|
||||
|
||||
###################### API configuration information ######################
|
||||
# API configuration
|
||||
#
|
||||
# API service port
|
||||
# Default listen IP is 0.0.0.0
|
||||
api:
|
||||
openImApiPort: [ "10002" ]
|
||||
listenIP: "0.0.0.0"
|
||||
|
||||
###################### Object configuration information ######################
|
||||
# Object storage configuration
|
||||
#
|
||||
# Use minio for object storage
|
||||
# API URL should be accessible by the app
|
||||
# It's not recommended to modify the bucket name
|
||||
# Endpoint should be accessible by the app
|
||||
# Session token
|
||||
# Configuration for Tencent COS
|
||||
# Configuration for Aliyun OSS
|
||||
# It can be set by an environment variable or by a script
|
||||
object:
|
||||
enable: "minio"
|
||||
apiURL: "http://127.0.0.1:10002/object/"
|
||||
minio:
|
||||
bucket: "openim"
|
||||
endpoint: "http://113.90.83.134:10005"
|
||||
accessKeyID: "root"
|
||||
secretAccessKey: "openIM123"
|
||||
sessionToken: ""
|
||||
cos:
|
||||
bucketURL: "https://temp-1252357374.cos.ap-chengdu.myqcloud.com"
|
||||
secretID: ""
|
||||
secretKey: ""
|
||||
sessionToken: ""
|
||||
oss:
|
||||
endpoint: "https://oss-cn-chengdu.aliyuncs.com"
|
||||
bucket: "demo-9999999"
|
||||
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com"
|
||||
accessKeyID: "root"
|
||||
accessKeySecret: ""
|
||||
sessionToken: ""
|
||||
|
||||
|
||||
###################### RPC Port Configuration ######################
|
||||
# RPC service ports
|
||||
# These ports are passed into the program by the script and are not recommended to modify
|
||||
# For launching multiple programs, just fill in multiple ports separated by commas
|
||||
# For example, [10110, 10111]
|
||||
rpcPort:
|
||||
openImUserPort: [ "10110" ]
|
||||
openImFriendPort: [ "10120" ]
|
||||
openImMessagePort: [ "10130" ]
|
||||
openImMessageGatewayPort: [ "10140" ]
|
||||
openImGroupPort: [ "10150" ]
|
||||
openImAuthPort: [ "10160" ]
|
||||
openImPushPort: [ "10170" ]
|
||||
openImConversationPort: [ "10180" ]
|
||||
openImThirdPort: [ "10190" ]
|
||||
|
||||
###################### RPC Register Name Configuration ######################
|
||||
# RPC service names for registration, it's not recommended to modify these
|
||||
rpcRegisterName:
|
||||
openImUserName: "User"
|
||||
openImFriendName: "Friend"
|
||||
openImMsgName: "Msg"
|
||||
openImPushName: "Push"
|
||||
openImMessageGatewayName: "MessageGateway"
|
||||
openImGroupName: "Group"
|
||||
openImAuthName: "Auth"
|
||||
openImConversationName: "Conversation"
|
||||
openImThirdName: "Third"
|
||||
|
||||
###################### Log Configuration ######################
|
||||
# Log configuration
|
||||
#
|
||||
# Storage directory
|
||||
# Log rotation time
|
||||
# Maximum number of logs to retain
|
||||
# Log level, 6 means all levels
|
||||
# Whether to output to stdout
|
||||
# Whether to output in json format
|
||||
# Whether to include stack trace in logs
|
||||
log:
|
||||
storageLocation: "/root/workspaces/openim/openim-server/log/"
|
||||
rotationTime: 24
|
||||
remainRotationCount: 2
|
||||
remainLogLevel: 6
|
||||
isStdout: false
|
||||
isJson: false
|
||||
withStack: false
|
||||
|
||||
###################### Variables definition ######################
|
||||
# Long connection server configuration
|
||||
#
|
||||
# Websocket port for msg_gateway
|
||||
# Maximum number of websocket connections
|
||||
# Maximum length of websocket request package
|
||||
# Websocket connection handshake timeout
|
||||
longConnSvr:
|
||||
openImWsPort: [ "10001" ]
|
||||
websocketMaxConnNum: 100000
|
||||
websocketMaxMsgLen: 4096
|
||||
websocketTimeout: 10
|
||||
|
||||
# Push notification service configuration
|
||||
#
|
||||
# Use GeTui for push notifications
|
||||
# GeTui offline push configuration
|
||||
# FCM offline push configuration
|
||||
# Account file, place it in the config directory
|
||||
# JPush configuration, modify these after applying in JPush backend
|
||||
push:
|
||||
enable: "getui"
|
||||
geTui:
|
||||
pushUrl: "https://restapi.getui.com/v2/$appId"
|
||||
masterSecret: ""
|
||||
appKey: ""
|
||||
intent: ""
|
||||
channelID: ""
|
||||
channelName: ""
|
||||
fcm:
|
||||
serviceAccount: "x.json"
|
||||
jpns:
|
||||
appKey: ""
|
||||
masterSecret: ""
|
||||
pushUrl: ""
|
||||
pushIntent: ""
|
||||
|
||||
# App manager configuration
|
||||
#
|
||||
# Built-in app manager user IDs
|
||||
# Built-in app manager nicknames
|
||||
manager:
|
||||
userID: [ "openIM123456", "openIM654321", "openIMAdmin" ]
|
||||
nickname: [ "system1", "system2", "system3" ]
|
||||
|
||||
# Multi-platform login policy
|
||||
# For each platform(Android, iOS, Windows, Mac, web), only one can be online at a time
|
||||
multiLoginPolicy: 1
|
||||
|
||||
# Whether to store messages in MySQL, messages in MySQL are only used for management background
|
||||
chatPersistenceMysql: true
|
||||
|
||||
# Message cache timeout in seconds, it's not recommended to modify
|
||||
msgCacheTimeout: 86400
|
||||
|
||||
# Whether to enable read receipts for group chat
|
||||
groupMessageHasReadReceiptEnable: true
|
||||
|
||||
# Whether to enable read receipts for single chat
|
||||
singleMessageHasReadReceiptEnable: true
|
||||
|
||||
# MongoDB offline message retention period in days
|
||||
retainChatRecords: 365
|
||||
|
||||
# Schedule to clear expired messages(older than retainChatRecords days) in MongoDB every Wednesday at 2am
|
||||
# This deletion is just for cleaning up disk usage according to previous configuration retainChatRecords, no notification will be sent
|
||||
chatRecordsClearTime: "0 2 * * *"
|
||||
|
||||
# Schedule to auto delete messages every day at 2am
|
||||
# This deletion is for messages that have been retained for more than msg_destruct_time (seconds) in the conversation field
|
||||
msgDestructTime: "0 2 * * *"
|
||||
|
||||
# Secret key
|
||||
secret: "openIM123"
|
||||
|
||||
# Token policy
|
||||
#
|
||||
# Token expiration period in days
|
||||
tokenPolicy:
|
||||
expire: 90
|
||||
|
||||
# Message verification policy
|
||||
#
|
||||
# Whether to verify friendship when sending messages
|
||||
messageVerify:
|
||||
friendVerify: false
|
||||
|
||||
# iOS push notification configuration
|
||||
#
|
||||
# iOS push notification sound
|
||||
# Whether to count badge
|
||||
# Whether it's production environment
|
||||
iosPush:
|
||||
pushSound: "xxx"
|
||||
badgeCount: true
|
||||
production: false
|
||||
|
||||
###################### Third-party service configuration ######################
|
||||
# Callback configuration
|
||||
#
|
||||
# Callback URL
|
||||
# Whether to enable this callback event
|
||||
# Timeout in seconds
|
||||
# Whether to continue execution if callback fails
|
||||
callback:
|
||||
url:
|
||||
beforeSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
afterSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
beforeSendGroupMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
afterSendGroupMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
msgModify:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
userOnline:
|
||||
enable: false
|
||||
timeout: 5
|
||||
userOffline:
|
||||
enable: false
|
||||
timeout: 5
|
||||
userKickOff:
|
||||
enable: false
|
||||
timeout: 5
|
||||
offlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
onlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
superGroupOnlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeAddFriend:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeCreateGroup:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeMemberJoinGroup:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeSetGroupMemberInfo:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
setMessageReactionExtensions:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
|
||||
###################### Prometheus ######################
|
||||
# Prometheus configuration for various services
|
||||
# The number of Prometheus ports per service needs to correspond to rpcPort
|
||||
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||
prometheus:
|
||||
enable: "false"
|
||||
userPrometheusPort: [ "20110" ]
|
||||
friendPrometheusPort: [ "20120" ]
|
||||
messagePrometheusPort: [ "20130" ]
|
||||
messageGatewayPrometheusPort: [ "20140" ]
|
||||
groupPrometheusPort: [ "20150" ]
|
||||
authPrometheusPort: [ "20160" ]
|
||||
pushPrometheusPort: [ "20170" ]
|
||||
conversationPrometheusPort: [ "20230" ]
|
||||
rtcPrometheusPort: [ "21300" ]
|
||||
thirdPrometheusPort: [ "21301" ]
|
||||
messageTransferPrometheusPort: [ "21400, 21401, 21402, 21403" ] # List of ports
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-msggateway
|
||||
description: "This is a description for openim-msggateway"
|
||||
type: "service"
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-msgtransfer
|
||||
description: "This is a description for openim-msgtransfer"
|
||||
type: "service"
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-push
|
||||
description: "This is a description for openim-push"
|
||||
type: "service"
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-rpc-auth
|
||||
description: "This is a description for openim-rpc-auth"
|
||||
type: "service"
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-rpc-conversation
|
||||
description: "This is a description for openim-rpc-conversation"
|
||||
type: "service"
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-rpc-friend
|
||||
description: "This is a description for openim-rpc-friend"
|
||||
type: "service"
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-rpc-group
|
||||
description: "This is a description for openim-rpc-group"
|
||||
type: "service"
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-rpc-msg
|
||||
description: "This is a description for openim-rpc-msg"
|
||||
type: "service"
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-rpc-third
|
||||
description: "This is a description for openim-rpc-third"
|
||||
type: "service"
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: openim-rpc-user
|
||||
description: "This is a description for openim-rpc-user"
|
||||
type: "service"
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# TODO: This config file is the template file
|
||||
# --| source: scripts/template/config-tmpl/openim_config.yaml
|
||||
# --| env: scripts/install/environment.sh
|
||||
# --| source: deployments/templates/openim.yaml
|
||||
# --| env: scripts/install/environment
|
||||
# --| target: config/config.yaml
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
@@ -232,7 +232,7 @@ push:
|
||||
channelID: ""
|
||||
channelName: ""
|
||||
fcm:
|
||||
serviceAccount: ${FCM_SERVICE_ACCOUNT}
|
||||
serviceAccount: "${FCM_SERVICE_ACCOUNT}"
|
||||
jpns:
|
||||
appKey:
|
||||
masterSecret:
|
||||
@@ -384,4 +384,4 @@ prometheus:
|
||||
conversationPrometheusPort: [ ${CONVERSATION_PROM_PORT} ]
|
||||
rtcPrometheusPort: [ ${RTC_PROM_PORT} ]
|
||||
thirdPrometheusPort: [ ${THIRD_PROM_PORT} ]
|
||||
messageTransferPrometheusPort: [ ${MSG_TRANSFER_PROM_PORT} ] # List of ports
|
||||
messageTransferPrometheusPort: [ ${MSG_TRANSFER_PROM_PORT} ] # List of ports
|
||||
+65
-56
@@ -98,45 +98,49 @@ services:
|
||||
restart: always
|
||||
command: minio server /data --console-address ':9090'
|
||||
|
||||
# openim-server:
|
||||
# # image: ghcr.io/openimsdk/openim-server:latest
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:v3.2.1-beta.4
|
||||
# # image: openim/openim-server:latest
|
||||
# # build: .
|
||||
# container_name: openim-server
|
||||
# volumes:
|
||||
# - ./logs:/openim/openim-server/logs
|
||||
# - ./config:/openim/openim-server/config
|
||||
# - ./scripts:/openim/openim-server/scripts
|
||||
# restart: always
|
||||
# depends_on:
|
||||
# - zookeeper
|
||||
# - kafka
|
||||
# - mysql
|
||||
# - mongodb
|
||||
# - redis
|
||||
# - minio
|
||||
# network_mode: "host"
|
||||
# logging:
|
||||
# driver: json-file
|
||||
# options:
|
||||
# max-size: "1g"
|
||||
# max-file: "2"
|
||||
openim-server:
|
||||
# image: ghcr.io/openimsdk/openim-server:release-v3.2
|
||||
image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:release-v3.2
|
||||
# image: openim/openim-server:release-v3.2
|
||||
container_name: openim-server
|
||||
# healthcheck:
|
||||
# test: ["CMD-SHELL", "./scripts/check-all.sh"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 5
|
||||
volumes:
|
||||
- ${DATA_DIR}/_output/openim/logs:/openim/openim-server/logs
|
||||
- ${DATA_DIR}/config:/openim/openim-server/config
|
||||
- ${DATA_DIR}/scripts:/openim/openim-server/scripts
|
||||
restart: always
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- kafka
|
||||
- mysql
|
||||
- mongodb
|
||||
- redis
|
||||
- minio
|
||||
network_mode: "host"
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
# openim-chat:
|
||||
# # image: ghcr.io/openimsdk/openim-chat:latest
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat:latest
|
||||
# # image: openim/openim-chat:latest
|
||||
# # image: ghcr.io/openimsdk/openim-server:release-v1.2
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:release-v1.2
|
||||
# # image: openim/openim-server:release-v1.2
|
||||
# container_name: openim-chat
|
||||
# healthcheck:
|
||||
# test: ["CMD-SHELL", "./scripts/check_all.sh"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 5
|
||||
# # healthcheck:
|
||||
# # test: ["CMD-SHELL", "./scripts/check-all.sh"]
|
||||
# # interval: 30s
|
||||
# # timeout: 10s
|
||||
# # retries: 5
|
||||
# volumes:
|
||||
# - ${DATA_DIR}/_output/openim/openim-chat/logs:/openim/openim-chat/logs
|
||||
# - ${DATA_DIR}/_output/openim/openim-chat/config:/openim/openim-chat/config
|
||||
# - ${DATA_DIR}/_output/openim/openim-chat/scripts:/openim/openim-chat/scripts
|
||||
# - openim-chat_logs:/openim/openim-chat/logs
|
||||
# - openim-chat_config:/openim/openim-chat/config
|
||||
# - openim-chat_scripts:/openim/openim-chat/scripts
|
||||
# restart: always
|
||||
# user: root:root
|
||||
# depends_on:
|
||||
@@ -152,28 +156,33 @@ services:
|
||||
# max-size: "1g"
|
||||
# max-file: "2"
|
||||
|
||||
# prometheus:
|
||||
# image: prom/prometheus
|
||||
# volumes:
|
||||
# - ./.docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml
|
||||
# container_name: prometheus
|
||||
# # ports:
|
||||
# # - 9091:9091
|
||||
# depends_on:
|
||||
# - openim-server
|
||||
# command: --web.listen-address=:9091 --config.file="/etc/prometheus/prometheus.yml"
|
||||
# network_mode: "host"
|
||||
prometheus:
|
||||
image: prom/prometheus
|
||||
volumes:
|
||||
- ./.docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml
|
||||
container_name: prometheus
|
||||
# ports:
|
||||
# - 9091:9091
|
||||
depends_on:
|
||||
- openim-server
|
||||
command: --web.listen-address=:9091 --config.file="/etc/prometheus/prometheus.yml"
|
||||
network_mode: "host"
|
||||
|
||||
# grafana:
|
||||
# image: grafana/grafana
|
||||
# volumes:
|
||||
# - ./.docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
|
||||
# - ./.docker-compose_cfg/grafana.ini:/etc/grafana/grafana.ini
|
||||
# - ./.docker-compose_cfg/node-exporter-full_rev1.json:/var/lib/grafana/dashboards/node-exporter-full_rev1.json
|
||||
# container_name: grafana
|
||||
# depends_on:
|
||||
# - prometheus
|
||||
# network_mode: "host"
|
||||
grafana:
|
||||
image: grafana/grafana
|
||||
volumes:
|
||||
- ./.docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
|
||||
- ./.docker-compose_cfg/grafana.ini:/etc/grafana/grafana.ini
|
||||
- ./.docker-compose_cfg/node-exporter-full_rev1.json:/var/lib/grafana/dashboards/node-exporter-full_rev1.json
|
||||
container_name: grafana
|
||||
depends_on:
|
||||
- prometheus
|
||||
network_mode: "host"
|
||||
|
||||
volumes:
|
||||
openim-chat_logs:
|
||||
openim-chat_config:
|
||||
openim-chat_scripts:
|
||||
|
||||
# node-exporter:
|
||||
# image: quay.io/prometheus/node-exporter
|
||||
|
||||
@@ -65,12 +65,12 @@ It is critical that our full community is actively engaged on enhancements in th
|
||||
|
||||
### Steps
|
||||
|
||||
- Run the [cherry pick script](https://github.com/OpenIMSDK/Open-IM-Server/tree/main/scripts/cherry_pick_pull.sh)
|
||||
- Run the [cherry pick script](https://github.com/OpenIMSDK/Open-IM-Server/tree/main/scripts/cherry-pick.sh)
|
||||
|
||||
This example applies a main branch PR #98765 to the remote branch `upstream/release-v3.1`:
|
||||
|
||||
```
|
||||
scripts/cherry_pick_pull.sh upstream/release-v3.1 98765
|
||||
scripts/cherry-pick.sh upstream/release-v3.1 98765
|
||||
```
|
||||
|
||||
- Be aware the cherry pick script assumes you have a git remote called `upstream` that points at the openim-server github org.
|
||||
|
||||
@@ -24,7 +24,7 @@ In the `scripts/init_config.sh` file, we defined some template files. These temp
|
||||
# Defines an associative array where the keys are the template files and the values are the corresponding output files.
|
||||
declare -A TEMPLATES=(
|
||||
["${OPENIM_ROOT}/scripts/template/config-tmpl/env.template"]="${OPENIM_OUTPUT_SUBPATH}/bin/.env"
|
||||
["${OPENIM_ROOT}/scripts/template/config-tmpl/openim_config.yaml"]="${OPENIM_OUTPUT_SUBPATH}/bin/openim_config.yaml"
|
||||
["${OPENIM_ROOT}/scripts/template/config-tmpl/config.yaml"]="${OPENIM_OUTPUT_SUBPATH}/bin/config.yaml"
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
# OpenIM Protoc Tool
|
||||
|
||||
## Introduction
|
||||
|
||||
OpenIM is passionate about ensuring that its suite of tools is custom-tailored to cater to the unique needs of its users. That commitment led us to develop and release our custom Protoc tool, version v1.0.0.
|
||||
|
||||
### Why a Custom Version?
|
||||
|
||||
There are several reasons to choose our custom Protoc tool over generic open-source versions:
|
||||
|
||||
- **Specialized Features**: OpenIM's Protoc tool has been enriched with features and plugins that are optimized for the OpenIM ecosystem. This makes it more aligned with the needs of OpenIM users.
|
||||
- **Optimized Performance**: Built from the ground up with OpenIM's infrastructure in mind, our tool guarantees faster and more efficient operations.
|
||||
- **Enhanced Compatibility**: Our Protoc tool ensures full compatibility with OpenIM's offerings, minimizing potential conflicts and integration challenges.
|
||||
- **Rich Output Support**: Unlike generic tools, our custom tool provides a wide array of output options including C++, C#, Java, Kotlin, Objective-C, PHP, Python, Ruby, and more. This allows developers to generate code for their preferred platform with ease.
|
||||
|
||||
## Download
|
||||
|
||||
+ https://github.com/OpenIMSDK/Open-IM-Protoc
|
||||
|
||||
Access the official release of the Protoc tool on the OpenIM repository here: [OpenIM Protoc Tool v1.0.0 Release](https://github.com/OpenIMSDK/Open-IM-Protoc/releases/tag/v1.0.0)
|
||||
|
||||
### Direct Download Links:
|
||||
|
||||
- **Windows**: [Download for Windows](https://github.com/OpenIMSDK/Open-IM-Protoc/releases/download/v1.0.0/windows.zip)
|
||||
- **Linux**: [Download for Linux](https://github.com/OpenIMSDK/Open-IM-Protoc/releases/download/v1.0.0/linux.zip)
|
||||
|
||||
## Installation
|
||||
|
||||
For Windows:
|
||||
|
||||
1. Navigate to the Windows download link provided above and download the version suitable for your system.
|
||||
2. Extract the contents of the zip file.
|
||||
3. Add the path of the extracted tool to your `PATH` environment variable to run the Protoc tool directly from the command line.
|
||||
|
||||
For Linux:
|
||||
|
||||
1. Navigate to the Linux download link provided above and download the version suitable for your system.
|
||||
2. Extract the contents of the zip file.
|
||||
3. Use `chmod +x ./*` to make the extracted files executable.
|
||||
4. Add the path of the extracted tool to your `PATH` environment variable to run the Protoc tool directly from the command line.
|
||||
|
||||
## Usage
|
||||
|
||||
The OpenIM Protoc tool provides a multitude of options for parsing `.proto` files and generating output:
|
||||
|
||||
```
|
||||
bashCopy code
|
||||
./protoc [OPTION] PROTO_FILES
|
||||
```
|
||||
|
||||
Some of the key options include:
|
||||
|
||||
- `--proto_path=PATH`: Specify the directory to search for imports.
|
||||
- `--version`: Show version info.
|
||||
- `--encode=MESSAGE_TYPE`: Convert a text-format message of a given type from standard input to binary on standard output.
|
||||
- `--decode=MESSAGE_TYPE`: Convert a binary message of a given type from standard input to text format on standard output.
|
||||
- `--cpp_out=OUT_DIR`: Generate C++ header and source.
|
||||
- `--java_out=OUT_DIR`: Generate Java source file.
|
||||
|
||||
... and many more. For a full list of options, run `./protoc --help` or refer to the official documentation.
|
||||
@@ -104,9 +104,21 @@ git merge release-v3.1
|
||||
# Push the updates to the main branch
|
||||
git push origin main
|
||||
```
|
||||
## Release Process
|
||||
|
||||
```
|
||||
Publishing v3.2.0: A Step-by-Step Guide
|
||||
(1) Create the tag v3.2.0-alpha.0 from the main branch.
|
||||
(2) Bugs are fixed on the main branch. Once the bugs are resolved, tag the main branch as v3.2.0-rc.0.
|
||||
(3) After further testing, if v3.2.0-rc.0 is deemed stable, create a branch named release-v3.2 from the tag v3.2.0-rc.0.
|
||||
(4) From the release-v3.2 branch, create the tag v3.2.0. At this point, the official release of v3.2.0 is complete.
|
||||
|
||||
After the release of v3.2.0, if urgent bugs are discovered, fix them on the release-v3.2 branch. Then, submit two pull requests (PRs) to both the main and release-v3.2 branches. Tag the release-v3.2 branch as v3.2.1.
|
||||
```
|
||||
|
||||
Throughout this process, active communication within the team is pivotal to maintaining transparency and consensus on changes.
|
||||
|
||||
## Docker Images Version Management
|
||||
|
||||
For more details on managing Docker image versions, visit [OpenIM Docker Images Administration](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md).
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ require (
|
||||
require github.com/google/uuid v1.3.0
|
||||
|
||||
require (
|
||||
github.com/OpenIMSDK/protocol v0.0.11
|
||||
github.com/OpenIMSDK/protocol v0.0.14
|
||||
github.com/OpenIMSDK/tools v0.0.13
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible
|
||||
github.com/go-redis/redis v6.15.9+incompatible
|
||||
|
||||
@@ -17,8 +17,8 @@ cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7Biccwk
|
||||
firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4=
|
||||
firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/OpenIMSDK/protocol v0.0.11 h1:3sWujfQhO1I1Da1b8UScaZcc0DNunSbNiH3DagZB/AA=
|
||||
github.com/OpenIMSDK/protocol v0.0.11/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
||||
github.com/OpenIMSDK/protocol v0.0.14 h1:cvQ3f8MTcyYygAnZ7Exq6zIbvHGCEV0fWdpzjQEDDBQ=
|
||||
github.com/OpenIMSDK/protocol v0.0.14/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
||||
github.com/OpenIMSDK/tools v0.0.13 h1:rcw4HS8S2DPZR9UOBxD8/ol9UBMzXBypzOVEytDRIMo=
|
||||
github.com/OpenIMSDK/tools v0.0.13/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
|
||||
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y=
|
||||
cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU=
|
||||
github.com/AlekSi/pointer v1.1.0 h1:SSDMPcXD9jSl8FPy9cRzoRaMJtm9g9ggGTxecRUbQoI=
|
||||
github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
|
||||
github.com/marmotedu/component-base v1.6.2 h1:UtQkG0ZmAbVHVUdky5Sw68QLJno5ARSqslHu/xsVNl0=
|
||||
github.com/marmotedu/errors v1.0.2 h1:qx9GtOljmAL+wLuemahe3WSWdXyEpJvLBlpXK8y2rdI=
|
||||
github.com/marmotedu/marmotedu-sdk-go v1.6.2 h1:eQcHVdK89Xb107+XbeqIyEXzYFxmyjQFChBtijrQSl8=
|
||||
github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM=
|
||||
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
|
||||
github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY=
|
||||
github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA=
|
||||
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||
github.com/spf13/viper v1.9.0 h1:yR6EXjTp0y0cLN8OZg1CRZmOBdI88UcGkhgyJhu6nZk=
|
||||
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=
|
||||
moul.io/http2curl v1.0.0 h1:6XwpyZOYsgZJrU8exnG87ncVkU1FVCcTRpwzOkTDUi8=
|
||||
rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4=
|
||||
+1
-1
@@ -152,7 +152,7 @@ EOF
|
||||
cd ..;
|
||||
docker-compose up -d;
|
||||
cd scripts;
|
||||
./docker_check_service.sh;
|
||||
./docker-check-service.sh;
|
||||
}
|
||||
|
||||
read choice
|
||||
|
||||
@@ -363,3 +363,6 @@ func (m *MessageApi) GetActiveGroup(c *gin.Context) {
|
||||
func (m *MessageApi) SearchMsg(c *gin.Context) {
|
||||
a2r.Call(msg.MsgClient.SearchMessage, m.Client, c)
|
||||
}
|
||||
func (m *MessageApi) GetServerTime(c *gin.Context) {
|
||||
a2r.Call(msg.MsgClient.GetServerTime, m.Client, c)
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive
|
||||
|
||||
msgGroup.POST("/batch_send_msg", m.BatchSendMsg)
|
||||
msgGroup.POST("/check_msg_is_send_success", m.CheckMsgIsSendSuccess)
|
||||
msgGroup.POST("/get_server_time", m.GetServerTime)
|
||||
}
|
||||
// Conversation
|
||||
conversationGroup := r.Group("/conversation", ParseToken)
|
||||
|
||||
@@ -26,8 +26,10 @@ import (
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
"github.com/OpenIMSDK/tools/mcontext"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
)
|
||||
|
||||
@@ -107,13 +109,15 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
revokerUserID := mcontext.GetOpUserID(ctx)
|
||||
tips := sdkws.RevokeMsgTips{
|
||||
RevokerUserID: req.UserID,
|
||||
RevokerUserID: revokerUserID,
|
||||
ClientMsgID: msgs[0].ClientMsgID,
|
||||
RevokeTime: now,
|
||||
Seq: req.Seq,
|
||||
SesstionType: msgs[0].SessionType,
|
||||
ConversationID: req.ConversationID,
|
||||
IsAdminRevoke: utils.Contain(revokerUserID, config.Config.Manager.UserID...),
|
||||
}
|
||||
var recvID string
|
||||
if msgs[0].SessionType == constant.SuperGroupChatType {
|
||||
|
||||
@@ -188,3 +188,6 @@ func (m *msgServer) SearchMessage(ctx context.Context, req *msg.SearchMessageReq
|
||||
resp.ChatLogsNum = total
|
||||
return resp, nil
|
||||
}
|
||||
func (m *msgServer) GetServerTime(ctx context.Context, _ *msg.GetServerTimeReq) (*msg.GetServerTimeResp, error) {
|
||||
return &msg.GetServerTimeResp{ServerTime: utils.GetCurrentTimestampByMill()}, nil
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package tools
|
||||
|
||||
import (
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package convert
|
||||
|
||||
import (
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
@@ -78,6 +79,9 @@ func MsgDB2Pb(msgModel *unrelation.MsgDataModel) *sdkws.MsgData {
|
||||
msg.SendTime = msgModel.SendTime
|
||||
msg.CreateTime = msgModel.CreateTime
|
||||
msg.Status = msgModel.Status
|
||||
if msgModel.SessionType == constant.SingleChatType {
|
||||
msg.IsRead = msgModel.IsRead
|
||||
}
|
||||
msg.Options = msgModel.Options
|
||||
if msgModel.OfflinePush != nil {
|
||||
msg.OfflinePushInfo = &sdkws.OfflinePushInfo{
|
||||
|
||||
Vendored
+2
-1
@@ -17,11 +17,12 @@ package cache
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"hash/crc32"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/user"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package minio
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package minio
|
||||
|
||||
type minioImageInfo struct {
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package oss
|
||||
|
||||
import (
|
||||
|
||||
@@ -21,6 +21,8 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/msg"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
@@ -1166,9 +1168,7 @@ func (m *MsgMongoDriver) searchMessage(ctx context.Context, req *msg.SearchMessa
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
if len(msgsDocs) == 0 {
|
||||
return 0, nil, errs.Wrap(mongo.ErrNoDocuments)
|
||||
}
|
||||
log.ZDebug(ctx, "query mongoDB", "result", msgsDocs)
|
||||
msgs := make([]*table.MsgInfoModel, 0)
|
||||
for index := range msgsDocs {
|
||||
msgInfo := msgsDocs[index].Msg
|
||||
@@ -1207,7 +1207,9 @@ func (m *MsgMongoDriver) searchMessage(ctx context.Context, req *msg.SearchMessa
|
||||
}
|
||||
start := (req.Pagination.PageNumber - 1) * req.Pagination.ShowNumber
|
||||
n := int32(len(msgs))
|
||||
if start+req.Pagination.ShowNumber < n {
|
||||
if start >= n {
|
||||
return n, []*table.MsgInfoModel{}, nil
|
||||
} else if start+req.Pagination.ShowNumber < n {
|
||||
msgs = msgs[start : start+req.Pagination.ShowNumber]
|
||||
} else {
|
||||
msgs = msgs[start:]
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package unrelation
|
||||
|
||||
import (
|
||||
|
||||
@@ -16,11 +16,13 @@ package notification
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
|
||||
relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
)
|
||||
|
||||
type UserNotificationSender struct {
|
||||
|
||||
+4
-4
@@ -34,15 +34,15 @@ scripts/
|
||||
├── build.cmd # Windows build command script
|
||||
├── build-all-service.sh # Script to build all services
|
||||
├── build_push_k8s_images.sh # Script to build and push images for Kubernetes
|
||||
├── check_all.sh # Script to check status of all services
|
||||
├── check-all.sh # Script to check status of all services
|
||||
├── common.sh # Contains common functions used by other scripts
|
||||
├── coverage.awk # AWK script for coverage report generation
|
||||
├── coverage.sh # Script for generating coverage reports
|
||||
├── docker_check_service.sh # Docker specific service check script
|
||||
├── docker-check-service.sh # Docker specific service check script
|
||||
├── docker-start-all-all.sh # Script to start all services in a docker environment
|
||||
├── ensure_tag.sh # Script to ensure proper tagging of docker images
|
||||
├── enterprise # Scripts specific to enterprise version
|
||||
│ ├── check_all.sh # Check status of all enterprise services
|
||||
│ ├── check-all.sh # Check status of all enterprise services
|
||||
│ ├── function.sh # Functions specific to enterprise version
|
||||
│ └── path_info.cfg # Path information configuration for enterprise version
|
||||
├── env_check.sh # Script to check the environment
|
||||
@@ -53,7 +53,7 @@ scripts/
|
||||
│ └── pre-push # Script to run before each push
|
||||
├── init_pwd.sh # Script to initialize password
|
||||
├── install_im_compose.sh # Script to install IM with Docker Compose
|
||||
├── install_im_server.sh # Script to install IM server
|
||||
├── install-im-server.sh # Script to install IM server
|
||||
├── lib # Library scripts
|
||||
│ ├── color.sh # Script for console color manipulation
|
||||
│ ├── golang.sh # Script for golang related utility functions
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# 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.
|
||||
|
||||
#
|
||||
# This script runs `make build` command.
|
||||
# The command compiles all Makefile configs.
|
||||
# Args:
|
||||
@@ -33,17 +33,11 @@ source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
# Check the system type
|
||||
system_type=$(uname)
|
||||
|
||||
if [[ "$system_type" == "Darwin" ]]; then
|
||||
# macOS (using sysctl)
|
||||
cpu_count=$(sysctl -n hw.ncpu)
|
||||
elif [[ "$system_type" == "Linux" ]]; then
|
||||
# Linux (using lscpu)
|
||||
cpu_count=$(lscpu --parse | grep -E '^([^#].*,){3}[^#]' | sort -u | wc -l)
|
||||
else
|
||||
echo "Unsupported operating system: $system_type"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${GREEN_PREFIX}======> cpu_count=$cpu_count${COLOR_SUFFIX}"
|
||||
pushd "${OPENIM_ROOT}/tools/ncpu" >/dev/null
|
||||
cpu_count=$(go run .)
|
||||
popd >/dev/null
|
||||
|
||||
openim::color::echo ${GREEN_PREFIX} "======> cpu_count=$cpu_count"
|
||||
|
||||
openim::log::info "Building OpenIM, Parallel compilation compile=$cpu_count"
|
||||
compile_count=$((cpu_count / 2))
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
# This script is check openim service is running normally
|
||||
#
|
||||
# Usage: `scripts/check_all.sh`.
|
||||
# Usage: `scripts/check-all.sh`.
|
||||
# Encapsulated as: `make check`.
|
||||
# READ: https://github.com/OpenIMSDK/Open-IM-Server/tree/main/scripts/install/environment.sh
|
||||
|
||||
@@ -28,10 +28,37 @@ source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
OPENIM_VERBOSE=4
|
||||
|
||||
echo "++++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
# OpenIM status
|
||||
# Elegant printing function
|
||||
print_services_and_ports() {
|
||||
local -n service_names=$1
|
||||
local -n service_ports=$2
|
||||
|
||||
echo "++++ Check all dependent service ports"
|
||||
echo "+ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}"
|
||||
echo "+-------------------------+----------+"
|
||||
echo "| Service Name | Port |"
|
||||
echo "+-------------------------+----------+"
|
||||
|
||||
for index in "${!service_names[@]}"; do
|
||||
printf "| %-23s | %-8s |\n" "${service_names[$index]}" "${service_ports[$index]}"
|
||||
done
|
||||
|
||||
echo "+-------------------------+----------+"
|
||||
}
|
||||
|
||||
|
||||
# Print out services and their ports
|
||||
print_services_and_ports OPENIM_SERVER_NAME_TARGETS OPENIM_SERVER_PORT_TARGETS
|
||||
|
||||
# Print out dependencies and their ports
|
||||
print_services_and_ports OPENIM_DEPENDENCY_TARGETS OPENIM_DEPENDENCY_PORT_TARGETS
|
||||
|
||||
|
||||
# OpenIM check
|
||||
echo "++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
echo "## Check all dependent service ports"
|
||||
echo "+++ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}"
|
||||
|
||||
set +e
|
||||
openim::util::check_ports ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
@@ -40,9 +67,13 @@ if [[ $? -ne 0 ]]; then
|
||||
else
|
||||
echo "++++ Check all dependent service ports successfully !"
|
||||
fi
|
||||
set -e
|
||||
|
||||
echo "++++ Check all OpenIM service ports"
|
||||
echo "+ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
echo -e "\n## Check OpenIM service name"
|
||||
. $(dirname ${BASH_SOURCE})/install/openim-msgtransfer.sh openim::msgtransfer::check
|
||||
|
||||
echo -e "\n## Check all OpenIM service ports"
|
||||
echo "+++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
openim::util::check_ports ${OPENIM_SERVER_PORT_LISTARIES[@]}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "+++ cat openim log file >>> ${LOG_FILE}"
|
||||
@@ -24,6 +24,13 @@ openim::util::desc "========> Press Enter to continue...."
|
||||
openim::util::run "make advertise"
|
||||
clear
|
||||
|
||||
openim::util::desc "========> Initialize the project and generate configuration files"
|
||||
openim::util::run "make init"
|
||||
|
||||
openim::util::desc "========> You can look git diff"
|
||||
openim::util::run "git diff"
|
||||
clear
|
||||
|
||||
openim::util::desc "You can learn a lot about automation using make help"
|
||||
openim::util::run "make help"
|
||||
clear
|
||||
|
||||
@@ -14,15 +14,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Include shell font styles and some basic information
|
||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
source "$SCRIPTS_ROOT/style_info.sh"
|
||||
|
||||
echo -e "${GREEN_PREFIX}=========> Check docker-compose status ${COLOR_SUFFIX} \n"
|
||||
|
||||
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
cd "$OPENIM_ROOT"
|
||||
|
||||
@@ -86,7 +79,7 @@ do_sth() {
|
||||
|
||||
kill "$_progress_pid" "$_countdown_pid"
|
||||
|
||||
"${SCRIPTS_ROOT}/check_all.sh"
|
||||
"${SCRIPTS_ROOT}/check-all.sh"
|
||||
echo -e "${PURPLE_PREFIX}=========> Check docker-compose status ${COLOR_SUFFIX} \n"
|
||||
}
|
||||
|
||||
@@ -22,8 +22,10 @@ source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
trap 'openim::util::onCtrlC' INT
|
||||
|
||||
nohup ${OPENIM_ROOT}/scripts/start-all.sh > ${LOG_FILE} 2>&1 &
|
||||
nohup ${OPENIM_ROOT}/scripts/start-all.sh >> ${LOG_FILE} 2>&1 &
|
||||
|
||||
nohup ${OPENIM_ROOT}/scripts/check-all.sh > ${LOG_FILE} 2>&1 &
|
||||
sleep 15
|
||||
|
||||
nohup ${OPENIM_ROOT}/scripts/check-all.sh >> ${LOG_FILE} 2>&1 &
|
||||
|
||||
tail -f ${LOG_FILE}
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
source $SCRIPTS_ROOT/lib/init.sh
|
||||
source $SCRIPTS_ROOT/path_info.sh
|
||||
|
||||
cd $SCRIPTS_ROOT
|
||||
|
||||
echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}"
|
||||
echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}"
|
||||
echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
|
||||
|
||||
service_port_name=(
|
||||
openImChatApiPort
|
||||
openImAdminApiPort
|
||||
#api port name
|
||||
openImAdminPort
|
||||
openImChatPort
|
||||
)
|
||||
|
||||
for i in ${service_port_name[*]}; do
|
||||
list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}')
|
||||
openim::util::list-to-string $list
|
||||
for j in ${ports_array}; do
|
||||
port=$(ss -tunlp| grep openim | awk '{print $5}' | grep -w ${j} | awk -F '[:]' '{print $NF}')
|
||||
if [[ ${port} -ne ${j} ]]; then
|
||||
echo -e ${BACKGROUND_GREEN}${i}${COLOR_SUFFIX}${RED_PREFIX}" service does not start normally,not initiated port is "${COLOR_SUFFIX}${BACKGROUND_GREEN}${j}${COLOR_SUFFIX}
|
||||
echo -e ${RED_PREFIX}"please check $OPENIM_ROOT/logs/openIM.log"${COLOR_SUFFIX}
|
||||
exit -1
|
||||
else
|
||||
echo -e ${j}${GREEN_PREFIX}" port has been listening,belongs service is "${i}${COLOR_SUFFIX}
|
||||
fi
|
||||
done
|
||||
done
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#input:[10023,2323,3434]
|
||||
#output:10023 2323 3434
|
||||
openim::util::list-to-string(){
|
||||
ports_list=$*
|
||||
sub_s1=`echo $ports_list | sed 's/ //g'`
|
||||
sub_s2=${sub_s1//,/ }
|
||||
sub_s3=${sub_s2#*[}
|
||||
sub_s4=${sub_s3%]*}
|
||||
ports_array=$sub_s4
|
||||
}
|
||||
openim::util::remove_space(){
|
||||
value=$*
|
||||
result=`echo $value | sed 's/ //g'`
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#Don't put the space between "="
|
||||
|
||||
demo_server_name="chat-api"
|
||||
demo_server_binary_root="$BIN_DIR/"
|
||||
|
||||
#Global configuration file default dir
|
||||
config_path="../.docker-compose_cfg/config.yaml"
|
||||
|
||||
#servicefile dir path
|
||||
service_source_root=(
|
||||
#api service file
|
||||
../cmd/api/chat/
|
||||
../cmd/api/admin/
|
||||
#rpc service file
|
||||
../cmd/rpc/admin/
|
||||
../cmd/rpc/chat/
|
||||
)
|
||||
|
||||
#service filename
|
||||
service_names=(
|
||||
chat-api
|
||||
admin-api
|
||||
admin-rpc
|
||||
chat-rpc
|
||||
)
|
||||
@@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
# 本脚本功能:根据 scripts/environment.sh 配置,生成 OPENIM 组件 YAML 配置文件。
|
||||
# 示例:./scripts/genconfig.sh scripts/install/environment.sh scripts/template/openim_config.yaml
|
||||
# 示例:./scripts/genconfig.sh scripts/install/environment.sh scripts/template/config.yaml
|
||||
# Read: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/contrib/init_config.md
|
||||
|
||||
env_file="$1"
|
||||
|
||||
+58
-17
@@ -13,25 +13,66 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Iterates over two directories: 'pkg' and 'internal/pkg'.
|
||||
for top in pkg internal/pkg
|
||||
do
|
||||
# Finds all subdirectories (including nested ones) under the current directory in the iteration ('pkg' or 'internal/pkg').
|
||||
for d in $(find $top -type d)
|
||||
do
|
||||
# Checks if 'doc.go' doesn't exist in the current subdirectory.
|
||||
if [ ! -f $d/doc.go ]; then
|
||||
# Checks if there are any '.go' files in the current subdirectory.
|
||||
if ls $d/*.go > /dev/null 2>&1; then
|
||||
# Echoes the path of the 'doc.go' file to the terminal.
|
||||
# This is likely for debugging or information purposes.
|
||||
echo $d/doc.go
|
||||
DEFAULT_DIRS=(
|
||||
"pkg"
|
||||
"internal/pkg"
|
||||
)
|
||||
BASE_URL="github.com/OpenIMSDK/Open-IM-Server"
|
||||
|
||||
# Writes the package declaration and import comment to the 'doc.go' file in the current subdirectory.
|
||||
# 'basename $d' retrieves the name of the current directory (last part of the path).
|
||||
# The import comment is constructed based on a static base URL and the directory path.
|
||||
echo "package $(basename $d) // import \"github.com/OpenIMSDK/Open-IM-Server/$d\"" > $d/doc.go
|
||||
usage() {
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo
|
||||
echo "This script iterates over directories and generates doc.go if necessary."
|
||||
echo "By default, it processes 'pkg' and 'internal/pkg' directories."
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -d DIRS, --dirs DIRS Specify the directories to be processed, separated by commas. E.g., 'pkg,internal/pkg'."
|
||||
echo " -u URL, --url URL Set the base URL for the import path. Default is '$BASE_URL'."
|
||||
echo " -h, --help Show this help message."
|
||||
echo
|
||||
}
|
||||
|
||||
process_dir() {
|
||||
local dir=$1
|
||||
local base_url=$2
|
||||
|
||||
for d in $(find $dir -type d); do
|
||||
if [ ! -f $d/doc.go ]; then
|
||||
if ls $d/*.go > /dev/null 2>&1; then
|
||||
echo $d/doc.go
|
||||
echo "package $(basename $d) // import \"$base_url/$d\"" > $d/doc.go
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-d|--dirs)
|
||||
IFS=',' read -ra DIRS <<< "$2"
|
||||
shift # shift past argument
|
||||
shift # shift past value
|
||||
;;
|
||||
-u|--url)
|
||||
BASE_URL="$2"
|
||||
shift # shift past argument
|
||||
shift # shift past value
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
DIRS=${DIRS:-${DEFAULT_DIRS[@]}}
|
||||
|
||||
for dir in "${DIRS[@]}"; do
|
||||
process_dir $dir $BASE_URL
|
||||
done
|
||||
|
||||
@@ -30,7 +30,7 @@ readonly ENV_FILE=${ENV_FILE:-${OPENIM_ROOT}/scripts/install/environment.sh}
|
||||
# 定义关联数组,其中键是模板文件,值是对应的输出文件 (en: Defines an associative array where the keys are the template files and the values are the corresponding output files.)
|
||||
declare -A TEMPLATES=(
|
||||
["${OPENIM_ROOT}/deployments/templates/env_template.yaml"]="${OPENIM_ROOT}/.env"
|
||||
["${OPENIM_ROOT}/deployments/templates/openim.yaml"]="${OPENIM_ROOT}/config/openim_config.yaml"
|
||||
["${OPENIM_ROOT}/deployments/templates/openim.yaml"]="${OPENIM_ROOT}/config/config.yaml"
|
||||
)
|
||||
|
||||
for template in "${!TEMPLATES[@]}"; do
|
||||
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#FIXME This script is the startup script for multiple servers.
|
||||
#FIXME The full names of the shell scripts that need to be started are placed in the `need_to_start_server_shell` array.
|
||||
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd -P)
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
for file in "${OPENIM_SERVER_TARGETS[@]}"; do
|
||||
VARNAME="$(echo $file | tr '[:lower:]' '[:upper:]' | tr '.' '_' | tr '-' '_')"
|
||||
VARVALUE="$OPENIM_OUTPUT_HOSTBIN/$file"
|
||||
# /etc/profile.d/openim-env.sh
|
||||
echo "export $VARNAME=$VARVALUE" > /etc/profile.d/openim-env.sh
|
||||
source /etc/profile.d/openim-env.sh
|
||||
done
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
# Common utilities, variables and checks for all build scripts.
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
|
||||
trap 'openim::util::onCtrlC' INT
|
||||
|
||||
chmod +x ${OPENIM_ROOT}/scripts/*.sh
|
||||
${OPENIM_ROOT}/scripts/init-config.sh
|
||||
|
||||
openim::util::ensure_docker_daemon_connectivity
|
||||
|
||||
DOCKER_COMPOSE_COMMAND=
|
||||
# Check if docker-compose command is available
|
||||
if command -v docker-compose &> /dev/null
|
||||
then
|
||||
openim::log::info "docker-compose command is available"
|
||||
DOCKER_COMPOSE_COMMAND="docker-compose"
|
||||
else
|
||||
DOCKER_COMPOSE_COMMAND="docker compose"
|
||||
fi
|
||||
|
||||
pushd "${OPENIM_ROOT}" >/dev/null
|
||||
${DOCKER_COMPOSE_COMMAND} up -d
|
||||
sleep 60
|
||||
${DOCKER_COMPOSE_COMMAND} ps
|
||||
${DOCKER_COMPOSE_COMMAND} logs
|
||||
popd >/dev/null
|
||||
@@ -25,7 +25,7 @@ The OpenIM Suite represents a comprehensive collection of scripts, each tailored
|
||||
12. **openim-rpc-third:** Script dedicated to third-party integrations with OpenIM RPC.
|
||||
13. **openim-rpc-user:** Control interface for OpenIM RPC User operations.
|
||||
|
||||
## Usage
|
||||
## OpenIM Server Installation Script Usage
|
||||
|
||||
The scripts within the OpenIM Suite generally adhere to two primary execution methodologies. To illustrate these methodologies, we'll use `openim-crontask` as a representative example.
|
||||
|
||||
@@ -38,9 +38,38 @@ The scripts within the OpenIM Suite generally adhere to two primary execution me
|
||||
2. **Function-based Execution:** Invoking specific functions within the script for more specialized operations (e.g., install, uninstall).
|
||||
|
||||
```bash
|
||||
./scripts/install/install.sh [function-name]
|
||||
./scripts/install/install.sh [options]
|
||||
```
|
||||
|
||||
**Description:**
|
||||
This script is designed to handle the installation, uninstallation, and status checking of OpenIM components on the server. OpenIM is a presumed communication or messaging platform.
|
||||
|
||||
### Commands:
|
||||
- **-i, --install**:
|
||||
Initiate the installation of all OpenIM components.
|
||||
|
||||
- **-u, --uninstall**:
|
||||
Uninstall or remove all OpenIM components from the server.
|
||||
|
||||
- **-s, --status**:
|
||||
Check and report the current operational status of the installed OpenIM components.
|
||||
|
||||
- **-h, --help**:
|
||||
Display the help menu for available commands.
|
||||
|
||||
### Example Usage:
|
||||
To install all OpenIM components:
|
||||
```bash
|
||||
./scripts/install/install.sh -i
|
||||
```
|
||||
or
|
||||
```bash
|
||||
./scripts/install/install.sh --install
|
||||
```
|
||||
> **Note**:
|
||||
> Ensure you have the necessary privileges to execute installation or uninstallation operations. It's generally recommended to take a backup before making major changes.
|
||||
|
||||
|
||||
### 1. Direct Script Execution
|
||||
|
||||
This method involves invoking the script directly, initiating its default behavior. For instance, with `openim-crontask`, direct execution will start the OpenIM CronTask as a background process.
|
||||
|
||||
@@ -26,6 +26,7 @@ OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
# Make sure the environment is only called via common to avoid too much nesting
|
||||
source "${OPENIM_ROOT}/scripts/install/environment.sh"
|
||||
|
||||
# This function returns a list of Prometheus ports for various services
|
||||
# based on the provided configuration. Each service has its own dedicated
|
||||
# port for monitoring purposes.
|
||||
@@ -51,6 +52,29 @@ IFS=" " read -ra OPENIM_PROM_PORT_TARGETS <<< "$(openim::common::prometheus_port
|
||||
readonly OPENIM_PROM_PORT_TARGETS
|
||||
readonly OPENIM_PROM_PORT_LISTARIES=("${OPENIM_PROM_PORT_TARGETS[@]##*/}")
|
||||
|
||||
openim::common::service_name() {
|
||||
local targets=(
|
||||
openim-user
|
||||
openim-friend
|
||||
openim-msg
|
||||
openim-msg-gateway
|
||||
openim-group
|
||||
openim-auth
|
||||
openim-push
|
||||
openim-conversation
|
||||
openim-third
|
||||
# openim-msg-transfer
|
||||
|
||||
# api
|
||||
openim-api
|
||||
openim-ws
|
||||
)
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
|
||||
IFS=" " read -ra OPENIM_SERVER_NAME_TARGETS <<< "$(openim::common::service_name)"
|
||||
readonly OPENIM_SERVER_NAME_TARGETS
|
||||
|
||||
# Storing all the defined ports in an array for easy management and access.
|
||||
# This array consolidates the port numbers for all the services defined above.
|
||||
openim::common::service_port() {
|
||||
@@ -75,6 +99,21 @@ IFS=" " read -ra OPENIM_SERVER_PORT_TARGETS <<< "$(openim::common::service_port)
|
||||
readonly OPENIM_SERVER_PORT_TARGETS
|
||||
readonly OPENIM_SERVER_PORT_LISTARIES=("${OPENIM_SERVER_PORT_TARGETS[@]##*/}")
|
||||
|
||||
openim::common::dependency_name() {
|
||||
local targets=(
|
||||
mysql
|
||||
redis
|
||||
zookeeper
|
||||
kafka
|
||||
mongodb
|
||||
minio
|
||||
)
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
|
||||
IFS=" " read -ra OPENIM_DEPENDENCY_TARGETS <<< "$(openim::common::dependency_name)"
|
||||
readonly OPENIM_DEPENDENCY_TARGETS
|
||||
|
||||
# This function returns a list of ports for various services
|
||||
# - zookeeper
|
||||
# - kafka
|
||||
@@ -88,7 +127,7 @@ openim::common::dependency_port() {
|
||||
${REDIS_PORT} # Redis port
|
||||
${ZOOKEEPER_PORT} # Zookeeper port
|
||||
${KAFKA_PORT} # Kafka port
|
||||
${MongoDB_PORT} # MongoDB port
|
||||
${MONGO_PORT} # MongoDB port
|
||||
${MINIO_PORT} # MinIO port
|
||||
)
|
||||
echo "${targets[@]}"
|
||||
|
||||
@@ -97,4 +97,4 @@ docker run -d \
|
||||
-e MINIO_ROOT_USER=${USER} \
|
||||
-e MINIO_ROOT_PASSWORD=${PASSWORD} \
|
||||
--restart always \
|
||||
minio/minio server /data --console-address ':9090'
|
||||
minio/minio server /data --console-address ':9090'
|
||||
|
||||
@@ -24,10 +24,11 @@ OPENIM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
||||
LOCAL_OUTPUT_ROOT="${OPENIM_ROOT}/${OUT_DIR:-_output}"
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
|
||||
IP=$(openim::util::get_server_ip)
|
||||
|
||||
#TODO
|
||||
# IP=http://127.0.0.1
|
||||
if [ -z "${IP}" ]; then
|
||||
IP=$(openim::util::get_server_ip)
|
||||
fi
|
||||
|
||||
function def() {
|
||||
local var_name="$1"
|
||||
@@ -36,7 +37,7 @@ function def() {
|
||||
}
|
||||
|
||||
# app要能访问到此ip和端口或域名
|
||||
def "API_URL" "http://${IP}:10002/object/"
|
||||
def "API_URL" "http://${IP}:10002"
|
||||
def "DATA_DIR" "${OPENIM_ROOT}"
|
||||
|
||||
# 设置统一的用户名,方便记忆
|
||||
@@ -101,11 +102,11 @@ def "MONGO_MAX_POOL_SIZE" "100" # 最
|
||||
|
||||
###################### Object 配置信息 ######################
|
||||
def "OBJECT_ENABLE" "minio" # 对象是否启用
|
||||
def "OBJECT_APIURL" "http://127.0.0.1:10002/object/" # 对象的API地址
|
||||
def "OBJECT_APIURL" "http://${IP}:10002" # 对象的API地址
|
||||
def "MINIO_BUCKET" "openim" # MinIO的存储桶名称
|
||||
def "MINIO_PORT" "10005" # MinIO的端口
|
||||
# MinIO的端点URL
|
||||
readonly MINIO_ENDPOINT=${MINIO_ENDPOINT:-"http://${IP}:${MINIO_PORT}"}
|
||||
readonly MINIO_ENDPOINT=${MINIO_ENDPOINT:-"http://127.0.0.1:${MINIO_PORT}"}
|
||||
def "MINIO_ACCESS_KEY" "${USER}" # MinIO的访问密钥ID
|
||||
def "MINIO_SECRET_KEY" "${PASSWORD}" # MinIO的密钥
|
||||
def "MINIO_SESSION_TOKEN" # MinIO的会话令牌
|
||||
@@ -117,7 +118,7 @@ def "COS_SESSION_TOKEN" # 腾
|
||||
def "OSS_ENDPOINT" "https://oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的端点URL
|
||||
def "OSS_BUCKET" "demo-9999999" # 阿里云OSS的存储桶名称
|
||||
def "OSS_BUCKET_URL" "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的存储桶URL
|
||||
def "OSS_ACCESS_KEY_ID" "${USER}" # 阿里云OSS的访问密钥ID
|
||||
def "OSS_ACCESS_KEY_ID" # 阿里云OSS的访问密钥ID
|
||||
def "OSS_ACCESS_KEY_SECRET" # 阿里云OSS的密钥
|
||||
def "OSS_SESSION_TOKEN" # 阿里云OSS的会话令牌
|
||||
|
||||
|
||||
Executable
+116
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# OpenIM Protoc Tool v1.0.0
|
||||
# --------------------------------------------------------------
|
||||
# OpenIM has released its custom Protoc tool version v1.0.0.
|
||||
# This tool is customized to meet the specific needs of OpenIM and resides in its separate repository.
|
||||
# It can be downloaded from the following link:
|
||||
# https://github.com/OpenIMSDK/Open-IM-Protoc/releases/tag/v1.0.0
|
||||
#
|
||||
# Download link (Windows): https://github.com/OpenIMSDK/Open-IM-Protoc/releases/download/v1.0.0/windows.zip
|
||||
# Download link (Linux): https://github.com/OpenIMSDK/Open-IM-Protoc/releases/download/v1.0.0/linux.zip
|
||||
#
|
||||
# Installation steps (taking Windows as an example):
|
||||
# 1. Visit the above link and download the version suitable for Windows.
|
||||
# 2. Extract the downloaded file.
|
||||
# 3. Add the extracted tool to your PATH environment variable so that it can be run directly from the command line.
|
||||
#
|
||||
# Note: The specific installation and usage instructions may vary based on the tool's actual implementation. It's advised to refer to official documentation.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
PROTOC_DOWNLOAD_URL="https://github.com/OpenIMSDK/Open-IM-Protoc/releases/download/v1.0.0/linux.zip"
|
||||
DOWNLOAD_DIR="/tmp/openim-protoc"
|
||||
INSTALL_DIR="/usr/local/bin"
|
||||
|
||||
function help_message {
|
||||
echo "Usage: ./install-protobuf.sh [option]"
|
||||
echo "Options:"
|
||||
echo "-i, --install Install the OpenIM Protoc tool."
|
||||
echo "-u, --uninstall Uninstall the OpenIM Protoc tool."
|
||||
echo "-r, --reinstall Reinstall the OpenIM Protoc tool."
|
||||
echo "-c, --check Check if the OpenIM Protoc tool is installed."
|
||||
echo "-h, --help Display this help message."
|
||||
}
|
||||
|
||||
function install_protobuf {
|
||||
echo "Installing OpenIM Protoc tool..."
|
||||
|
||||
# Create temporary directory and download the zip file
|
||||
mkdir -p $DOWNLOAD_DIR
|
||||
wget $PROTOC_DOWNLOAD_URL -O $DOWNLOAD_DIR/linux.zip
|
||||
|
||||
# Unzip the file
|
||||
unzip -o $DOWNLOAD_DIR/linux.zip -d $DOWNLOAD_DIR
|
||||
|
||||
# Move binaries to the install directory and make them executable
|
||||
sudo cp $DOWNLOAD_DIR/linux/protoc $INSTALL_DIR/
|
||||
sudo cp $DOWNLOAD_DIR/linux/protoc-gen-go $INSTALL_DIR/
|
||||
sudo chmod +x $INSTALL_DIR/protoc
|
||||
sudo chmod +x $INSTALL_DIR/protoc-gen-go
|
||||
|
||||
# Clean up
|
||||
rm -rf $DOWNLOAD_DIR
|
||||
|
||||
echo "OpenIM Protoc tool installed successfully!"
|
||||
}
|
||||
|
||||
function uninstall_protobuf {
|
||||
echo "Uninstalling OpenIM Protoc tool..."
|
||||
|
||||
# Removing binaries from the install directory
|
||||
sudo rm -f $INSTALL_DIR/protoc
|
||||
sudo rm -f $INSTALL_DIR/protoc-gen-go
|
||||
|
||||
echo "OpenIM Protoc tool uninstalled successfully!"
|
||||
}
|
||||
|
||||
function reinstall_protobuf {
|
||||
echo "Reinstalling OpenIM Protoc tool..."
|
||||
uninstall_protobuf
|
||||
install_protobuf
|
||||
}
|
||||
|
||||
function check_protobuf {
|
||||
echo "Checking for OpenIM Protoc tool installation..."
|
||||
|
||||
which protoc > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "OpenIM Protoc tool is installed."
|
||||
else
|
||||
echo "OpenIM Protoc tool is not installed."
|
||||
fi
|
||||
}
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
case $1 in
|
||||
-i | --install ) install_protobuf
|
||||
;;
|
||||
-u | --uninstall ) uninstall_protobuf
|
||||
;;
|
||||
-r | --reinstall ) reinstall_protobuf
|
||||
;;
|
||||
-c | --check ) check_protobuf
|
||||
;;
|
||||
-h | --help ) help_message
|
||||
exit
|
||||
;;
|
||||
* ) help_message
|
||||
exit 1
|
||||
esac
|
||||
shift
|
||||
done
|
||||
+130
-2
@@ -13,9 +13,137 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# OpenIM Server Installation Script
|
||||
#
|
||||
# Description:
|
||||
# This script is designed to handle the installation, Is a deployment solution
|
||||
# that uses the Linux systen extension. uninstallation, and
|
||||
# status checking of OpenIM components on the server. OpenIM is a presumed
|
||||
# communication or messaging platform based on the context.
|
||||
#
|
||||
# Usage:
|
||||
# To utilize this script, you need to invoke it with specific commands
|
||||
# and options as detailed below.
|
||||
#
|
||||
# Commands:
|
||||
# -i, --install : Use this command to initiate the installation of all
|
||||
# OpenIM components.
|
||||
# -u, --uninstall : Use this command to uninstall or remove all
|
||||
# OpenIM components from the server.
|
||||
# -s, --status : This command can be used to check and report the
|
||||
# current operational status of the installed OpenIM components.
|
||||
# -h, --help : For any assistance or to view the available commands,
|
||||
# use this command to display the help menu.
|
||||
#
|
||||
# Example Usage:
|
||||
# To install all OpenIM components:
|
||||
# ./scripts/install/install.sh -i
|
||||
# or
|
||||
# ./scripts/install/install.sh --install
|
||||
#
|
||||
# Note:
|
||||
# Ensure you have the necessary privileges to execute installation or
|
||||
# uninstallation operations. It's generally recommended to take a backup
|
||||
# before making major changes.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||
[[ -z ${COMMON_SOURCED} ]] && source ${OPENIM_ROOT}/scripts/install/common.sh
|
||||
|
||||
# common.sh environment.sh mariadb_for_ubuntu.sh openim-msgtransfer.sh openim-push.sh openim-rpc.sh
|
||||
# dependency.sh install.sh openim-msggateway.sh openim-crontask.sh redis_for_ubuntu.sh test.sh man.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/openim-msggateway.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/openim-msgtransfer.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/openim-push.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/openim-rpc.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/openim-crontask.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/openim-api.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/openim-man.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/openim-tools.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/test.sh
|
||||
|
||||
# Detailed help function
|
||||
function openim::install::show_help() {
|
||||
echo "OpenIM Installer"
|
||||
echo "Usage: $0 <command> [options]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " -i, --install Install all OpenIM components."
|
||||
echo " -u, --uninstall Remove all OpenIM components."
|
||||
echo " -s, --status Check the current status of OpenIM components."
|
||||
echo " -h, --help Show this help menu."
|
||||
echo ""
|
||||
echo "Example: "
|
||||
echo " $0 -i Will install all OpenIM components."
|
||||
echo " $0 --install Same as above."
|
||||
}
|
||||
|
||||
function openim::install::install_openim()
|
||||
{
|
||||
openim::log::info "check openim dependency"
|
||||
openim::util::check_ports ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}
|
||||
|
||||
openim::msggateway::install || return 1
|
||||
openim::msgtransfer::install || return 1
|
||||
openim::push::install || return 1
|
||||
openim::rpc::install || return 1
|
||||
openim::crontask::install || return 1
|
||||
openim::api::install || return 1
|
||||
|
||||
openim::log::success "openim install success"
|
||||
}
|
||||
|
||||
function openim::uninstall::uninstall_openim()
|
||||
{
|
||||
openim::log::info "uninstall openim"
|
||||
|
||||
openim::msggateway::uninstall || return 1
|
||||
openim::msgtransfer::uninstall || return 1
|
||||
openim::push::uninstall || return 1
|
||||
openim::rpc::uninstall || return 1
|
||||
openim::crontask::uninstall || return 1
|
||||
openim::api::uninstall || return 1
|
||||
|
||||
openim::log::success "openim uninstall success"
|
||||
}
|
||||
|
||||
function openim::install::status()
|
||||
{
|
||||
openim::log::info "check openim status"
|
||||
|
||||
openim::msggateway::status || return 1
|
||||
openim::msgtransfer::status || return 1
|
||||
openim::push::status || return 1
|
||||
openim::rpc::status || return 1
|
||||
openim::crontask::status || return 1
|
||||
openim::api::status || return 1
|
||||
|
||||
openim::log::success "openim status success"
|
||||
}
|
||||
|
||||
# If no arguments are provided, show help
|
||||
if [[ $# -eq 0 ]]; then
|
||||
openim::install::show_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Argument parsing to call functions based on user input
|
||||
while (( "$#" )); do
|
||||
case "$1" in
|
||||
-i|--install)
|
||||
openim::install::install_openim
|
||||
shift
|
||||
;;
|
||||
-u|--uninstall)
|
||||
openim::uninstall::uninstall_openim
|
||||
shift
|
||||
;;
|
||||
-s|--status)
|
||||
openim::install::status
|
||||
shift
|
||||
;;
|
||||
-h|--help|*)
|
||||
openim::install::show_help
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -1,83 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# The root of the build/dist directory
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
||||
|
||||
[[ -z ${COMMON_SOURCED} ]] && source ${OPENIM_ROOT}/scripts/install/common.sh
|
||||
|
||||
# 安装后打印必要的信息
|
||||
function openim::mariadb::info() {
|
||||
cat << EOF
|
||||
MariaDB Login: mysql -h127.0.0.1 -u${MARIADB_ADMIN_USERNAME} -p'${MARIADB_ADMIN_PASSWORD}'
|
||||
EOF
|
||||
}
|
||||
|
||||
# 安装
|
||||
function openim::mariadb::install()
|
||||
{
|
||||
# 1. 配置 MariaDB 10.5 apt 源
|
||||
openim::common::sudo "apt-get install software-properties-common dirmngr apt-transport-https"
|
||||
echo ${LINUX_PASSWORD} | sudo -S apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
|
||||
# add /etc/apt/sources.list
|
||||
echo ${LINUX_PASSWORD} | sudo -S add-apt-repository 'deb [arch=amd64,arm64,ppc64el,s390x] https://mirrors.aliyun.com/mariadb/repo/10.5/ubuntu focal main'
|
||||
|
||||
# 2. 安装 MariaDB 和 MariaDB 客户端
|
||||
openim::common::sudo "apt update"
|
||||
openim::common::sudo "apt -y install mariadb-server"
|
||||
|
||||
# 3. 启动 MariaDB,并设置开机启动
|
||||
openim::common::sudo "systemctl enable mariadb"
|
||||
openim::common::sudo "systemctl start mariadb"
|
||||
|
||||
# 4. 设置 root 初始密码
|
||||
openim::common::sudo "mysqladmin -u${MARIADB_ADMIN_USERNAME} password ${MARIADB_ADMIN_PASSWORD}"
|
||||
|
||||
openim::mariadb::status || return 1
|
||||
openim::mariadb::info
|
||||
openim::log::info "install MariaDB successfully"
|
||||
}
|
||||
|
||||
# 卸载
|
||||
function openim::mariadb::uninstall()
|
||||
{
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop mariadb"
|
||||
openim::common::sudo "systemctl disable mariadb"
|
||||
openim::common::sudo "apt-get -y remove mariadb-server"
|
||||
openim::common::sudo "rm -rf /var/lib/mysql"
|
||||
set -o errexit
|
||||
openim::log::info "uninstall MariaDB successfully"
|
||||
}
|
||||
|
||||
# 状态检查
|
||||
function openim::mariadb::status()
|
||||
{
|
||||
# 查看 mariadb 运行状态,如果输出中包含 active (running) 字样说明 mariadb 成功启动。
|
||||
systemctl status mariadb |grep -q 'active' || {
|
||||
openim::log::error "mariadb failed to start, maybe not installed properly"
|
||||
return 1
|
||||
}
|
||||
|
||||
mysql -u${MARIADB_ADMIN_USERNAME} -p${MARIADB_ADMIN_PASSWORD} -e quit &>/dev/null || {
|
||||
openim::log::error "can not login with root, mariadb maybe not initialized properly"
|
||||
return 1
|
||||
}
|
||||
openim::log::info "MariaDB status active"
|
||||
}
|
||||
|
||||
if [[ "$*" =~ openim::mariadb:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
@@ -33,22 +33,47 @@ readonly OPENIM_API_SERVICE_TARGETS=(
|
||||
)
|
||||
readonly OPENIM_API_SERVICE_LISTARIES=("${OPENIM_API_SERVICE_TARGETS[@]##*/}")
|
||||
|
||||
echo "++ OPENIM_API_SERVICE_LISTARIES: ${OPENIM_API_SERVICE_LISTARIES[@]}"
|
||||
echo "++ OPENIM_API_PORT_LISTARIES: ${OPENIM_API_PORT_LISTARIES[@]}"
|
||||
echo "++ OpenIM API config path: ${OPENIM_API_CONFIG}"
|
||||
function openim::api::start()
|
||||
{
|
||||
echo "++ OPENIM_API_SERVICE_LISTARIES: ${OPENIM_API_SERVICE_LISTARIES[@]}"
|
||||
echo "++ OPENIM_API_PORT_LISTARIES: ${OPENIM_API_PORT_LISTARIES[@]}"
|
||||
echo "++ OpenIM API config path: ${OPENIM_API_CONFIG}"
|
||||
|
||||
openim::log::info "Starting ${SERVER_NAME} ..."
|
||||
openim::log::info "Starting ${SERVER_NAME} ..."
|
||||
|
||||
printf "+------------------------+--------------+\n"
|
||||
printf "| Service Name | Port |\n"
|
||||
printf "+------------------------+--------------+\n"
|
||||
printf "+------------------------+--------------+\n"
|
||||
printf "| Service Name | Port |\n"
|
||||
printf "+------------------------+--------------+\n"
|
||||
|
||||
length=${#OPENIM_API_SERVICE_LISTARIES[@]}
|
||||
length=${#OPENIM_API_SERVICE_LISTARIES[@]}
|
||||
|
||||
for ((i=0; i<$length; i++)); do
|
||||
printf "| %-22s | %6s |\n" "${OPENIM_API_SERVICE_LISTARIES[$i]}" "${OPENIM_API_PORT_LISTARIES[$i]}"
|
||||
printf "+------------------------+--------------+\n"
|
||||
done
|
||||
for ((i=0; i<$length; i++)); do
|
||||
printf "| %-22s | %6s |\n" "${OPENIM_API_SERVICE_LISTARIES[$i]}" "${OPENIM_API_PORT_LISTARIES[$i]}"
|
||||
printf "+------------------------+--------------+\n"
|
||||
done
|
||||
# start all api services
|
||||
for ((i = 0; i < ${#OPENIM_API_SERVICE_LISTARIES[*]}; i++)); do
|
||||
openim::util::stop_services_with_name ${OPENIM_API_SERVICE_LISTARIES[$i]}
|
||||
openim::log::info "OpenIM ${OPENIM_API_SERVICE_LISTARIES[$i]} config path: ${OPENIM_API_CONFIG}"
|
||||
|
||||
# Get the service and Prometheus ports.
|
||||
OPENIM_API_SERVICE_PORTS=( $(openim::util::list-to-string ${OPENIM_API_PORT_LISTARIES[$i]}) )
|
||||
|
||||
# TODO Only one port is supported. An error occurs on multiple ports
|
||||
if [ ${#OPENIM_API_SERVICE_PORTS[@]} -ne 1 ]; then
|
||||
openim::log::error_exit "Set only one port for ${OPENIM_API_SERVICE_LISTARIES[$i]} service."
|
||||
fi
|
||||
|
||||
for ((j = 0; j < ${#OPENIM_API_SERVICE_PORTS[@]}; j++)); do
|
||||
openim::log::info "Starting ${OPENIM_API_SERVICE_LISTARIES[$i]} service, port: ${OPENIM_API_SERVICE_PORTS[j]}, binary root: ${OPENIM_OUTPUT_HOSTBIN}/${OPENIM_API_SERVICE_LISTARIES[$i]}"
|
||||
openim::api::start_service "${OPENIM_API_SERVICE_LISTARIES[$i]}" "${OPENIM_API_PORT_LISTARIES[j]}"
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
|
||||
OPENIM_API_PORT_STRINGARIES=( $(openim::util::list-to-string ${OPENIM_API_PORT_LISTARIES[@]}) )
|
||||
openim::util::check_ports ${OPENIM_API_PORT_STRINGARIES[@]}
|
||||
}
|
||||
|
||||
function openim::api::start_service() {
|
||||
local binary_name="$1"
|
||||
@@ -64,25 +89,24 @@ function openim::api::start_service() {
|
||||
fi
|
||||
}
|
||||
|
||||
# start all api services
|
||||
for ((i = 0; i < ${#OPENIM_API_SERVICE_LISTARIES[*]}; i++)); do
|
||||
openim::util::stop_services_with_name ${OPENIM_API_SERVICE_LISTARIES[$i]}
|
||||
openim::log::info "OpenIM ${OPENIM_API_SERVICE_LISTARIES[$i]} config path: ${OPENIM_API_CONFIG}"
|
||||
###################################### Linux Systemd ######################################
|
||||
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
|
||||
# Get the service and Prometheus ports.
|
||||
OPENIM_API_SERVICE_PORTS=( $(openim::util::list-to-string ${OPENIM_API_PORT_LISTARIES[$i]}) )
|
||||
function openim::api::install() {
|
||||
openim::log::info "Installing ${SERVER_NAME} ..."
|
||||
}
|
||||
|
||||
# TODO Only one port is supported. An error occurs on multiple ports
|
||||
if [ ${#OPENIM_API_SERVICE_PORTS[@]} -ne 1 ]; then
|
||||
openim::log::error_exit "Set only one port for ${OPENIM_API_SERVICE_LISTARIES[$i]} service."
|
||||
fi
|
||||
function openim::api::uninstall() {
|
||||
openim::log::info "Uninstalling ${SERVER_NAME} ..."
|
||||
|
||||
for ((j = 0; j < ${#OPENIM_API_SERVICE_PORTS[@]}; j++)); do
|
||||
openim::log::info "Starting ${OPENIM_API_SERVICE_LISTARIES[$i]} service, port: ${OPENIM_API_SERVICE_PORTS[j]}, binary root: ${OPENIM_OUTPUT_HOSTBIN}/${OPENIM_API_SERVICE_LISTARIES[$i]}"
|
||||
openim::api::start_service "${OPENIM_API_SERVICE_LISTARIES[$i]}" "${OPENIM_API_PORT_LISTARIES[j]}"
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
OPENIM_API_PORT_STRINGARIES=( $(openim::util::list-to-string ${OPENIM_API_PORT_LISTARIES[@]}) )
|
||||
openim::util::check_ports ${OPENIM_API_PORT_STRINGARIES[@]}
|
||||
function openim::api::status() {
|
||||
openim::log::info "Checking ${SERVER_NAME} status ..."
|
||||
|
||||
openim::util::check_ports ${OPENIM_API_PORT_LISTARIES[@]}
|
||||
}
|
||||
|
||||
if [[ "$*" =~ openim::api:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
@@ -29,7 +29,7 @@
|
||||
# Usage:
|
||||
# 1. Direct Script Execution:
|
||||
# This will start the OpenIM CronTask directly through a background process.
|
||||
# Example: ./openim-crontask.sh
|
||||
# Example: ./openim-crontask.sh openim::crontask::start
|
||||
#
|
||||
# 2. Controlling through Functions for systemctl operations:
|
||||
# Specific operations like installation, uninstallation, and status check can be executed by passing the respective function name as an argument to the script.
|
||||
@@ -38,20 +38,22 @@
|
||||
# Note: Ensure that the appropriate permissions and environmental variables are set prior to script execution.
|
||||
#
|
||||
|
||||
|
||||
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||
[[ -z ${COMMON_SOURCED} ]] && source ${OPENIM_ROOT}/scripts/install/common.sh
|
||||
|
||||
SERVER_NAME="openim-crontask"
|
||||
|
||||
openim::log::info "Start OpenIM Cron, binary root: ${SERVER_NAME}"
|
||||
openim::log::status "Start OpenIM Cron, path: ${OPENIM_CRONTASK_BINARY}"
|
||||
function openim::crontask::start()
|
||||
{
|
||||
openim::log::info "Start OpenIM Cron, binary root: ${SERVER_NAME}"
|
||||
openim::log::status "Start OpenIM Cron, path: ${OPENIM_CRONTASK_BINARY}"
|
||||
|
||||
openim::util::stop_services_with_name ${SERVER_NAME}
|
||||
openim::util::stop_services_with_name ${SERVER_NAME}
|
||||
|
||||
openim::log::status "start cron_task process, path: ${OPENIM_CRONTASK_BINARY}"
|
||||
nohup ${OPENIM_CRONTASK_BINARY} >> ${LOG_FILE} 2>&1 &
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
openim::log::status "start cron_task process, path: ${OPENIM_CRONTASK_BINARY}"
|
||||
nohup ${OPENIM_CRONTASK_BINARY} >> ${LOG_FILE} 2>&1 &
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
}
|
||||
|
||||
###################################### Linux Systemd ######################################
|
||||
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
@@ -125,6 +127,6 @@ function openim::crontask::status()
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$*" =~ ${SERVER_NAME}:: ]];then
|
||||
if [[ "$*" =~ openim::crontask:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
|
||||
@@ -25,42 +25,44 @@ OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||
|
||||
SERVER_NAME="openim-msggateway"
|
||||
|
||||
openim::log::info "Start OpenIM Msggateway, binary root: ${SERVER_NAME}"
|
||||
openim::log::status "Start OpenIM Msggateway, path: ${OPENIM_MSGGATEWAY_BINARY}"
|
||||
function openim::msggateway::start()
|
||||
{
|
||||
openim::log::info "Start OpenIM Msggateway, binary root: ${SERVER_NAME}"
|
||||
openim::log::status "Start OpenIM Msggateway, path: ${OPENIM_MSGGATEWAY_BINARY}"
|
||||
|
||||
openim::util::stop_services_with_name ${SERVER_NAME}
|
||||
openim::util::stop_services_with_name ${SERVER_NAME}
|
||||
|
||||
# OpenIM message gateway service port
|
||||
OPENIM_RPC_PORTS=$(openim::util::list-to-string ${OPENIM_MESSAGE_GATEWAY_PORT} )
|
||||
# OpenIM WS port
|
||||
OPENIM_WS_PORTS=$(openim::util::list-to-string ${OPENIM_WS_PORT} )
|
||||
# Message Gateway Prometheus port of the service
|
||||
MSG_GATEWAY_PROM_PORTS=$(openim::util::list-to-string ${MSG_GATEWAY_PROM_PORT} )
|
||||
# OpenIM message gateway service port
|
||||
OPENIM_RPC_PORTS=$(openim::util::list-to-string ${OPENIM_MESSAGE_GATEWAY_PORT} )
|
||||
# OpenIM WS port
|
||||
OPENIM_WS_PORTS=$(openim::util::list-to-string ${OPENIM_WS_PORT} )
|
||||
# Message Gateway Prometheus port of the service
|
||||
MSG_GATEWAY_PROM_PORTS=$(openim::util::list-to-string ${MSG_GATEWAY_PROM_PORT} )
|
||||
|
||||
openim::log::status "OpenIM RPC ports: ${OPENIM_RPC_PORTS[*]}"
|
||||
openim::log::status "OpenIM WS ports: ${OPENIM_WS_PORTS[*]}"
|
||||
openim::log::status "OpenIM Prometheus ports: ${MSG_GATEWAY_PROM_PORTS[*]}"
|
||||
openim::log::status "OpenIM RPC ports: ${OPENIM_RPC_PORTS[*]}"
|
||||
openim::log::status "OpenIM WS ports: ${OPENIM_WS_PORTS[*]}"
|
||||
openim::log::status "OpenIM Prometheus ports: ${MSG_GATEWAY_PROM_PORTS[*]}"
|
||||
|
||||
openim::log::status "OpenIM Msggateway config path: ${OPENIM_MSGGATEWAY_CONFIG}"
|
||||
openim::log::status "OpenIM Msggateway config path: ${OPENIM_MSGGATEWAY_CONFIG}"
|
||||
|
||||
if [ ${#OPENIM_RPC_PORTS[@]} -ne ${#OPENIM_WS_PORTS[@]} ]; then
|
||||
openim::log::error "ws_ports does not match push_rpc_ports or prome_ports in quantity!!!"
|
||||
exit 1
|
||||
fi
|
||||
if [ ${#OPENIM_RPC_PORTS[@]} -ne ${#OPENIM_WS_PORTS[@]} ]; then
|
||||
openim::log::error "ws_ports does not match push_rpc_ports or prome_ports in quantity!!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for ((i = 0; i < ${#OPENIM_WS_PORTS[@]}; i++)); do
|
||||
openim::log::info "start push process, port: ${OPENIM_MSGGATEWAY_PORTS_ARRAY[$i]}, prometheus port: ${PUSH_MSGGATEWAY_PORTS_ARRAY[$i]}"
|
||||
|
||||
PROMETHEUS_PORT_OPTION=""
|
||||
if [[ -n "${MSG_GATEWAY_PROM_PORTS[$i]}" ]]; then
|
||||
PROMETHEUS_PORT_OPTION="--prometheus_port ${MSG_GATEWAY_PROM_PORTS[$i]}"
|
||||
fi
|
||||
for ((i = 0; i < ${#OPENIM_WS_PORTS[@]}; i++)); do
|
||||
openim::log::info "start push process, port: ${OPENIM_MSGGATEWAY_PORTS_ARRAY[$i]}, prometheus port: ${PUSH_MSGGATEWAY_PORTS_ARRAY[$i]}"
|
||||
|
||||
PROMETHEUS_PORT_OPTION=""
|
||||
if [[ -n "${MSG_GATEWAY_PROM_PORTS[$i]}" ]]; then
|
||||
PROMETHEUS_PORT_OPTION="--prometheus_port ${MSG_GATEWAY_PROM_PORTS[$i]}"
|
||||
fi
|
||||
|
||||
nohup ${OPENIM_MSGGATEWAY_BINARY} --port ${OPENIM_RPC_PORTS[$i]} --ws_port ${OPENIM_WS_PORTS[$i]} $PROMETHEUS_PORT_OPTION -c ${OPENIM_MSGGATEWAY_CONFIG} >> ${LOG_FILE} 2>&1 &
|
||||
done
|
||||
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
nohup ${OPENIM_MSGGATEWAY_BINARY} --port ${OPENIM_RPC_PORTS[$i]} --ws_port ${OPENIM_WS_PORTS[$i]} $PROMETHEUS_PORT_OPTION -c ${OPENIM_MSGGATEWAY_CONFIG} >> ${LOG_FILE} 2>&1 &
|
||||
done
|
||||
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
}
|
||||
|
||||
###################################### Linux Systemd ######################################
|
||||
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
@@ -134,6 +136,6 @@ function openim::msggateway::status()
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$*" =~ ${SERVER_NAME}:: ]];then
|
||||
if [[ "$*" =~ openim::msggateway:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
|
||||
@@ -25,41 +25,58 @@ OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||
|
||||
SERVER_NAME="openim-msgtransfer"
|
||||
|
||||
openim::log::info "Start OpenIM Msggateway, binary root: ${SERVER_NAME}"
|
||||
openim::log::status "Start OpenIM Msggateway, path: ${OPENIM_MSGTRANSFER_BINARY}"
|
||||
function openim::msgtransfer::start()
|
||||
{
|
||||
openim::log::info "Start OpenIM Msggateway, binary root: ${SERVER_NAME}"
|
||||
openim::log::status "Start OpenIM Msggateway, path: ${OPENIM_MSGTRANSFER_BINARY}"
|
||||
|
||||
openim::util::stop_services_with_name ${SERVER_NAME}
|
||||
openim::util::stop_services_with_name ${SERVER_NAME}
|
||||
|
||||
# Message Transfer Prometheus port list
|
||||
MSG_TRANSFER_PROM_PORTS=(openim::util::list-to-string ${MSG_TRANSFER_PROM_PORT} )
|
||||
# Message Transfer Prometheus port list
|
||||
MSG_TRANSFER_PROM_PORTS=(openim::util::list-to-string ${MSG_TRANSFER_PROM_PORT} )
|
||||
|
||||
openim::log::status "OpenIM Prometheus ports: ${MSG_TRANSFER_PROM_PORTS[*]}"
|
||||
openim::log::status "OpenIM Prometheus ports: ${MSG_TRANSFER_PROM_PORTS[*]}"
|
||||
|
||||
openim::log::status "OpenIM Msggateway config path: ${OPENIM_MSGTRANSFER_CONFIG}"
|
||||
openim::log::status "OpenIM Msggateway config path: ${OPENIM_MSGTRANSFER_CONFIG}"
|
||||
|
||||
openim::log::info "openim maggateway num: ${OPENIM_MSGGATEWAY_NUM}"
|
||||
openim::log::info "openim maggateway num: ${OPENIM_MSGGATEWAY_NUM}"
|
||||
|
||||
if [ "${OPENIM_MSGGATEWAY_NUM}" -lt 1 ]; then
|
||||
opeim::log::error_exit "OPENIM_MSGGATEWAY_NUM must be greater than 0"
|
||||
fi
|
||||
if [ "${OPENIM_MSGGATEWAY_NUM}" -lt 1 ]; then
|
||||
opeim::log::error_exit "OPENIM_MSGGATEWAY_NUM must be greater than 0"
|
||||
fi
|
||||
|
||||
if [ ${OPENIM_MSGGATEWAY_NUM} -ne $((${#MSG_TRANSFER_PROM_PORTS[@]} - 1)) ]; then
|
||||
openim::log::error_exit "OPENIM_MSGGATEWAY_NUM must be equal to the number of MSG_TRANSFER_PROM_PORTS"
|
||||
fi
|
||||
if [ ${OPENIM_MSGGATEWAY_NUM} -ne $((${#MSG_TRANSFER_PROM_PORTS[@]} - 1)) ]; then
|
||||
openim::log::error_exit "OPENIM_MSGGATEWAY_NUM must be equal to the number of MSG_TRANSFER_PROM_PORTS"
|
||||
fi
|
||||
|
||||
for (( i=1; i<=$OPENIM_MSGGATEWAY_NUM; i++ )) do
|
||||
openim::log::info "prometheus port: ${MSG_TRANSFER_PROM_PORTS[$i]}"
|
||||
|
||||
PROMETHEUS_PORT_OPTION=""
|
||||
if [[ -n "${OPENIM_PROMETHEUS_PORTS[$i]}" ]]; then
|
||||
PROMETHEUS_PORT_OPTION="--prometheus_port ${OPENIM_PROMETHEUS_PORTS[$i]}"
|
||||
fi
|
||||
for (( i=1; i<=$OPENIM_MSGGATEWAY_NUM; i++ )) do
|
||||
openim::log::info "prometheus port: ${MSG_TRANSFER_PROM_PORTS[$i]}"
|
||||
PROMETHEUS_PORT_OPTION=""
|
||||
if [[ -n "${OPENIM_PROMETHEUS_PORTS[$i]}" ]]; then
|
||||
PROMETHEUS_PORT_OPTION="--prometheus_port ${OPENIM_PROMETHEUS_PORTS[$i]}"
|
||||
fi
|
||||
nohup ${OPENIM_MSGTRANSFER_BINARY} ${PROMETHEUS_PORT_OPTION} -c ${OPENIM_MSGTRANSFER_CONFIG} >> ${LOG_FILE} 2>&1 &
|
||||
done
|
||||
|
||||
nohup ${OPENIM_MSGTRANSFER_BINARY} ${PROMETHEUS_PORT_OPTION} -c ${OPENIM_MSGTRANSFER_CONFIG} >> ${LOG_FILE} 2>&1 &
|
||||
done
|
||||
openim::util::check_process_names "${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME}"
|
||||
}
|
||||
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
function openim::msgtransfer::check()
|
||||
{
|
||||
PIDS=$(pgrep -f "${OPENIM_OUTPUT_HOSTBIN}/openim-msgtransfer")
|
||||
|
||||
NUM_PROCESSES=$(echo "$PIDS" | wc -l)
|
||||
# NUM_PROCESSES=$(($NUM_PROCESSES - 1))
|
||||
|
||||
if [ "$NUM_PROCESSES" -eq "$OPENIM_MSGGATEWAY_NUM" ]; then
|
||||
openim::log::info "Found $OPENIM_MSGGATEWAY_NUM processes named $OPENIM_OUTPUT_HOSTBIN"
|
||||
for PID in $PIDS; do
|
||||
ps -p $PID -o pid,cmd
|
||||
done
|
||||
else
|
||||
openim::log::error_exit "Expected $OPENIM_MSGGATEWAY_NUM openim msgtransfer processes, but found $NUM_PROCESSES msgtransfer processes."
|
||||
fi
|
||||
}
|
||||
|
||||
###################################### Linux Systemd ######################################
|
||||
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
@@ -133,6 +150,6 @@ function openim::msgtransfer::status()
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$*" =~ ${SERVER_NAME}:: ]];then
|
||||
if [[ "$*" =~ openim::msgtransfer:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
|
||||
@@ -49,30 +49,33 @@ OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||
|
||||
SERVER_NAME="openim-push"
|
||||
|
||||
openim::log::status "Start OpenIM Push, binary root: ${SERVER_NAME}"
|
||||
openim::log::info "Start OpenIM Push, path: ${OPENIM_PUSH_BINARY}"
|
||||
function openim::push::start()
|
||||
{
|
||||
openim::log::status "Start OpenIM Push, binary root: ${SERVER_NAME}"
|
||||
openim::log::info "Start OpenIM Push, path: ${OPENIM_PUSH_BINARY}"
|
||||
|
||||
openim::util::stop_services_with_name ${SERVER_NAME}
|
||||
openim::util::stop_services_with_name ${SERVER_NAME}
|
||||
|
||||
openim::log::status "prepare start push process, path: ${OPENIM_PUSH_BINARY}"
|
||||
openim::log::status "prepare start push process, port: ${OPENIM_PUSH_PORT}, prometheus port: ${PUSH_PROM_PORT}"
|
||||
openim::log::status "prepare start push process, path: ${OPENIM_PUSH_BINARY}"
|
||||
openim::log::status "prepare start push process, port: ${OPENIM_PUSH_PORT}, prometheus port: ${PUSH_PROM_PORT}"
|
||||
|
||||
OPENIM_PUSH_PORTS_ARRAY=$(openim::util::list-to-string ${OPENIM_PUSH_PORT} )
|
||||
PUSH_PROM_PORTS_ARRAY=$(openim::util::list-to-string ${PUSH_PROM_PORT} )
|
||||
OPENIM_PUSH_PORTS_ARRAY=$(openim::util::list-to-string ${OPENIM_PUSH_PORT} )
|
||||
PUSH_PROM_PORTS_ARRAY=$(openim::util::list-to-string ${PUSH_PROM_PORT} )
|
||||
|
||||
openim::log::status "push port list: ${OPENIM_PUSH_PORTS_ARRAY[@]}"
|
||||
openim::log::status "prometheus port list: ${PUSH_PROM_PORTS_ARRAY[@]}"
|
||||
openim::log::status "push port list: ${OPENIM_PUSH_PORTS_ARRAY[@]}"
|
||||
openim::log::status "prometheus port list: ${PUSH_PROM_PORTS_ARRAY[@]}"
|
||||
|
||||
if [ ${#OPENIM_PUSH_PORTS_ARRAY[@]} -ne ${#PUSH_PROM_PORTS_ARRAY[@]} ]; then
|
||||
openim::log::error_exit "The length of the two port lists is different!"
|
||||
fi
|
||||
if [ ${#OPENIM_PUSH_PORTS_ARRAY[@]} -ne ${#PUSH_PROM_PORTS_ARRAY[@]} ]; then
|
||||
openim::log::error_exit "The length of the two port lists is different!"
|
||||
fi
|
||||
|
||||
for (( i=0; i<${#OPENIM_PUSH_PORTS_ARRAY[@]}; i++ )); do
|
||||
openim::log::info "start push process, port: ${OPENIM_PUSH_PORTS_ARRAY[$i]}, prometheus port: ${PUSH_PROM_PORTS_ARRAY[$i]}"
|
||||
nohup ${OPENIM_PUSH_BINARY} --port ${OPENIM_PUSH_PORTS_ARRAY[$i]} --prometheus_port ${PUSH_PROM_PORTS_ARRAY[$i]} >> ${LOG_FILE} 2>&1 &
|
||||
done
|
||||
for (( i=0; i<${#OPENIM_PUSH_PORTS_ARRAY[@]}; i++ )); do
|
||||
openim::log::info "start push process, port: ${OPENIM_PUSH_PORTS_ARRAY[$i]}, prometheus port: ${PUSH_PROM_PORTS_ARRAY[$i]}"
|
||||
nohup ${OPENIM_PUSH_BINARY} --port ${OPENIM_PUSH_PORTS_ARRAY[$i]} --prometheus_port ${PUSH_PROM_PORTS_ARRAY[$i]} >> ${LOG_FILE} 2>&1 &
|
||||
done
|
||||
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
}
|
||||
|
||||
###################################### Linux Systemd ######################################
|
||||
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
@@ -145,6 +148,6 @@ function openim::push::status()
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$*" =~ ${SERVER_NAME}:: ]];then
|
||||
if [[ "$*" =~ openim::push:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
@@ -13,6 +13,31 @@
|
||||
# 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 RPC Service Control Script
|
||||
#
|
||||
# Description:
|
||||
# This script provides a control interface for the OpenIM RPC service within a Linux environment. It offers functionalities to start multiple RPC services, each denoted by their respective names under openim::rpc::service_name.
|
||||
#
|
||||
# Features:
|
||||
# 1. Robust error handling using Bash built-ins like 'errexit', 'nounset', and 'pipefail'.
|
||||
# 2. The capability to source common utility functions and configurations to ensure uniform environmental settings.
|
||||
# 3. Comprehensive logging functionalities, providing a detailed understanding of operational processes.
|
||||
# 4. Provision for declaring and managing a set of RPC services, each associated with its unique name and corresponding ports.
|
||||
# 5. The ability to define and associate Prometheus ports for service monitoring purposes.
|
||||
# 6. Functionalities to start each RPC service, along with its designated ports, in a sequence.
|
||||
#
|
||||
# Usage:
|
||||
# 1. Direct Script Execution:
|
||||
# This initiates all the RPC services declared under the function openim::rpc::service_name.
|
||||
# Example: ./openim-rpc-{rpc-name}.sh openim::rpc::start
|
||||
# 2. Controlling through Functions for systemctl operations:
|
||||
# Specific operations like installation, uninstallation, and status check can be executed by passing the respective function name as an argument to the script.
|
||||
# Example: ./openim-rpc-{rpc-name}.sh openim::rpc::install
|
||||
#
|
||||
# Note: Before executing this script, ensure that the necessary permissions are granted and relevant environmental variables are set.
|
||||
#
|
||||
|
||||
|
||||
set -o errexit
|
||||
set +o nounset
|
||||
@@ -77,22 +102,44 @@ IFS=" " read -ra OPENIM_RPC_PROM_PORT_TARGETS <<< "$(openim::rpc::prometheus_por
|
||||
readonly OPENIM_RPC_PROM_PORT_TARGETS
|
||||
readonly OPENIM_RPC_PROM_PORT_LISTARIES=("${OPENIM_RPC_PROM_PORT_TARGETS[@]##*/}")
|
||||
|
||||
echo "OPENIM_RPC_SERVICE_LISTARIES: ${OPENIM_RPC_SERVICE_LISTARIES[@]}"
|
||||
echo "OPENIM_RPC_PROM_PORT_LISTARIES: ${OPENIM_RPC_PROM_PORT_LISTARIES[@]}"
|
||||
echo "OPENIM_RPC_PORT_LISTARIES: ${OPENIM_RPC_PORT_LISTARIES[@]}"
|
||||
function openim::rpc::start() {
|
||||
echo "OPENIM_RPC_SERVICE_LISTARIES: ${OPENIM_RPC_SERVICE_LISTARIES[@]}"
|
||||
echo "OPENIM_RPC_PROM_PORT_LISTARIES: ${OPENIM_RPC_PROM_PORT_LISTARIES[@]}"
|
||||
echo "OPENIM_RPC_PORT_LISTARIES: ${OPENIM_RPC_PORT_LISTARIES[@]}"
|
||||
|
||||
openim::log::info "Starting ${SERVER_NAME} ..."
|
||||
openim::log::info "Starting ${SERVER_NAME} ..."
|
||||
|
||||
printf "+------------------------+-------+-----------------+\n"
|
||||
printf "| Service Name | Port | Prometheus Port |\n"
|
||||
printf "+------------------------+-------+-----------------+\n"
|
||||
printf "+------------------------+-------+-----------------+\n"
|
||||
printf "| Service Name | Port | Prometheus Port |\n"
|
||||
printf "+------------------------+-------+-----------------+\n"
|
||||
|
||||
length=${#OPENIM_RPC_SERVICE_LISTARIES[@]}
|
||||
length=${#OPENIM_RPC_SERVICE_LISTARIES[@]}
|
||||
|
||||
for ((i=0; i<$length; i++)); do
|
||||
printf "| %-22s | %-5s | %-15s |\n" "${OPENIM_RPC_SERVICE_LISTARIES[$i]}" "${OPENIM_RPC_PORT_LISTARIES[$i]}" "${OPENIM_RPC_PROM_PORT_LISTARIES[$i]}"
|
||||
printf "+------------------------+-------+-----------------+\n"
|
||||
done
|
||||
for ((i=0; i<$length; i++)); do
|
||||
printf "| %-22s | %-5s | %-15s |\n" "${OPENIM_RPC_SERVICE_LISTARIES[$i]}" "${OPENIM_RPC_PORT_LISTARIES[$i]}" "${OPENIM_RPC_PROM_PORT_LISTARIES[$i]}"
|
||||
printf "+------------------------+-------+-----------------+\n"
|
||||
done
|
||||
|
||||
# start all rpc services
|
||||
for ((i = 0; i < ${#OPENIM_RPC_SERVICE_LISTARIES[*]}; i++)); do
|
||||
openim::util::stop_services_with_name ${OPENIM_RPC_SERVICE_LISTARIES[$i]}
|
||||
openim::log::info "OpenIM ${OPENIM_RPC_SERVICE_LISTARIES[$i]} config path: ${OPENIM_RPC_CONFIG}"
|
||||
|
||||
# Get the service and Prometheus ports.
|
||||
OPENIM_RPC_SERVICE_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_PORT_LISTARIES[$i]}) )
|
||||
OPENIM_RPC_PROM_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_PROM_PORT_LISTARIES[$i]}) )
|
||||
|
||||
for ((j = 0; j < ${#OPENIM_RPC_SERVICE_PORTS[@]}; j++)); do
|
||||
openim::log::info "Starting ${OPENIM_RPC_SERVICE_LISTARIES[$i]} service, port: ${OPENIM_RPC_SERVICE_PORTS[j]}, prometheus port: ${OPENIM_RPC_PROM_PORTS[j]}, binary root: ${OPENIM_OUTPUT_HOSTBIN}/${OPENIM_RPC_SERVICE_LISTARIES[$i]}"
|
||||
openim::rpc::start_service "${OPENIM_RPC_SERVICE_LISTARIES[$i]}" "${OPENIM_RPC_SERVICE_PORTS[j]}" "${OPENIM_RPC_PROM_PORTS[j]}"
|
||||
sleep 0.5
|
||||
done
|
||||
done
|
||||
|
||||
openim::util::check_ports ${OPENIM_RPC_PORT_TARGETS[@]}
|
||||
# openim::util::check_ports ${OPENIM_RPC_PROM_PORT_TARGETS[@]}
|
||||
|
||||
}
|
||||
|
||||
function openim::rpc::start_service() {
|
||||
local binary_name="$1"
|
||||
@@ -108,21 +155,27 @@ function openim::rpc::start_service() {
|
||||
nohup ${cmd} >> "${LOG_FILE}" 2>&1 &
|
||||
}
|
||||
|
||||
# start all rpc services
|
||||
for ((i = 0; i < ${#OPENIM_RPC_SERVICE_LISTARIES[*]}; i++)); do
|
||||
openim::util::stop_services_with_name ${OPENIM_RPC_SERVICE_LISTARIES[$i]}
|
||||
openim::log::info "OpenIM ${OPENIM_RPC_SERVICE_LISTARIES[$i]} config path: ${OPENIM_RPC_CONFIG}"
|
||||
###################################### Linux Systemd ######################################
|
||||
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
|
||||
# Get the service and Prometheus ports.
|
||||
OPENIM_RPC_SERVICE_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_PORT_LISTARIES[$i]}) )
|
||||
OPENIM_RPC_PROM_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_PROM_PORT_LISTARIES[$i]}) )
|
||||
function openim::rpc::install() {
|
||||
openim::log::info "Installing ${SERVER_NAME} ..."
|
||||
}
|
||||
|
||||
for ((j = 0; j < ${#OPENIM_RPC_SERVICE_PORTS[@]}; j++)); do
|
||||
openim::log::info "Starting ${OPENIM_RPC_SERVICE_LISTARIES[$i]} service, port: ${OPENIM_RPC_SERVICE_PORTS[j]}, prometheus port: ${OPENIM_RPC_PROM_PORTS[j]}, binary root: ${OPENIM_OUTPUT_HOSTBIN}/${OPENIM_RPC_SERVICE_LISTARIES[$i]}"
|
||||
openim::rpc::start_service "${OPENIM_RPC_SERVICE_LISTARIES[$i]}" "${OPENIM_RPC_SERVICE_PORTS[j]}" "${OPENIM_RPC_PROM_PORTS[j]}"
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
function openim::rpc::uninstall() {
|
||||
openim::log::info "Uninstalling ${SERVER_NAME} ..."
|
||||
|
||||
openim::util::check_ports ${OPENIM_RPC_PORT_TARGETS[@]}
|
||||
# openim::util::check_ports ${OPENIM_RPC_PROM_PORT_TARGETS[@]}
|
||||
}
|
||||
|
||||
function openim::rpc::status() {
|
||||
openim::log::info "Checking ${SERVER_NAME} status ..."
|
||||
|
||||
openim::util::check_ports ${OPENIM_RPC_PORT_TARGETS[@]}
|
||||
# openim::util::check_ports ${OPENIM_RPC_PROM_PORT_TARGETS[@]}
|
||||
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
}
|
||||
|
||||
if [[ "$*" =~ openim::rpc:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
Executable
+166
@@ -0,0 +1,166 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# OpenIM Tools Control Script
|
||||
#
|
||||
# Description:
|
||||
# This script is responsible for managing the lifecycle of OpenIM tools, which include starting, stopping,
|
||||
# and handling pre and post operations. It's designed to be modular and extensible, ensuring that the
|
||||
# individual operations can be managed separately, and integrated seamlessly with Linux systemd.
|
||||
#
|
||||
# Features:
|
||||
# 1. Robust error handling using Bash built-ins like 'errexit', 'nounset', and 'pipefail'.
|
||||
# 2. The capability to source common utility functions and configurations to ensure uniform environmental settings.
|
||||
# 3. Comprehensive logging functionalities, providing a detailed understanding of operational processes.
|
||||
# 4. Provision for declaring and managing a set of OpenIM tools, each associated with its unique name and corresponding ports.
|
||||
# 5. The ability to define and associate Prometheus ports for service monitoring purposes.
|
||||
# 6. Functionalities to start each OpenIM tool, along with its designated ports, in a sequence.
|
||||
#
|
||||
# Usage:
|
||||
# 1. Direct Script Execution:
|
||||
# This initiates all the OpenIM tools declared under the function openim::tools::service_name.
|
||||
# Example: ./openim-tools.sh openim::tools::start
|
||||
# 2. Controlling through Functions for systemctl operations:
|
||||
# Specific operations like installation, uninstallation, and status check can be executed by passing the respective function name as an argument to the script.
|
||||
# Example: ./openim-tools.sh openim::tools::install
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
set +o nounset
|
||||
set -o pipefail
|
||||
|
||||
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||
[[ -z ${COMMON_SOURCED} ]] && source ${OPENIM_ROOT}/scripts/install/common.sh
|
||||
|
||||
SERVER_NAME="openim-tools"
|
||||
|
||||
openim::tools::start_name() {
|
||||
local targets=(
|
||||
imctl
|
||||
)
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
IFS=" " read -ra OPENIM_TOOLS_NAME_TARGETS <<< "$(openim::tools::start_name)"
|
||||
readonly OPENIM_TOOLS_NAME_TARGETS
|
||||
readonly OPENIM_TOOLS_NAME_LISTARIES=("${OPENIM_TOOLS_NAME_TARGETS[@]##*/}")
|
||||
|
||||
openim::tools::pre_start_name() {
|
||||
local targets=(
|
||||
ncpu
|
||||
component
|
||||
)
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
IFS=" " read -ra OPENIM_TOOLS_PRE_START_NAME_TARGETS <<< "$(openim::tools::pre_start_name)"
|
||||
readonly OPENIM_TOOLS_PRE_START_NAME_TARGETS
|
||||
readonly OPENIM_TOOLS_PRE_START_NAME_LISTARIES=("${OPENIM_TOOLS_PRE_START_NAME_TARGETS[@]##*/}")
|
||||
|
||||
openim::tools::post_start_name() {
|
||||
local targets=(
|
||||
infra
|
||||
)
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
IFS=" " read -ra OPENIM_TOOLS_POST_START_NAME_TARGETS <<< "$(openim::tools::post_start_name)"
|
||||
readonly OPENIM_TOOLS_POST_START_NAME_TARGETS
|
||||
readonly OPENIM_TOOLS_POST_START_NAME_LISTARIES=("${OPENIM_TOOLS_POST_START_NAME_TARGETS[@]##*/}")
|
||||
|
||||
function openim::tools::start_service() {
|
||||
local binary_name="$1"
|
||||
local config="$2"
|
||||
local service_port="$3"
|
||||
local prometheus_port="$4"
|
||||
|
||||
local cmd="${OPENIM_OUTPUT_HOSTBIN_TOOLS}/${binary_name}"
|
||||
openim::log::info "Starting PATH: ${OPENIM_OUTPUT_HOSTBIN_TOOLS}/${binary_name}..."
|
||||
|
||||
if [ -n "${config}" ]; then
|
||||
printf "Specifying config: %s\n" "${config}"
|
||||
cmd="${cmd} -c ${config}/config.yaml"
|
||||
fi
|
||||
|
||||
if [ -n "${service_port}" ]; then
|
||||
printf "Specifying service port: %s\n" "${service_port}"
|
||||
cmd="${cmd} --port ${service_port}"
|
||||
fi
|
||||
|
||||
if [ -n "${prometheus_port}" ]; then
|
||||
printf "Specifying prometheus port: %s\n" "${prometheus_port}"
|
||||
cmd="${cmd} --prometheus_port ${prometheus_port}"
|
||||
fi
|
||||
openim::log::info "Starting ${binary_name}..."
|
||||
${cmd}
|
||||
}
|
||||
|
||||
function openim::tools::start() {
|
||||
openim::log::info "Starting OpenIM Tools..."
|
||||
for tool in "${OPENIM_TOOLS_NAME_LISTARIES[@]}"; do
|
||||
openim::log::info "Starting ${tool}..."
|
||||
# openim::tools::start_service ${tool}
|
||||
sleep 0.2
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function openim::tools::pre-start() {
|
||||
openim::log::info "Preparing to start OpenIM Tools..."
|
||||
for tool in "${OPENIM_TOOLS_PRE_START_NAME_LISTARIES[@]}"; do
|
||||
openim::log::info "Starting ${tool}..."
|
||||
openim::tools::start_service ${tool} ${OPNEIM_CONFIG}
|
||||
sleep 0.2
|
||||
done
|
||||
}
|
||||
|
||||
function openim::tools::post-start() {
|
||||
openim::log::info "Post-start actions for OpenIM Tools..."
|
||||
for tool in "${OPENIM_TOOLS_POST_START_NAME_LISTARIES[@]}"; do
|
||||
openim::log::info "Starting ${tool}..."
|
||||
# openim::tools::start_service ${tool}
|
||||
sleep 0.2
|
||||
done
|
||||
}
|
||||
|
||||
function openim::tools::stop() {
|
||||
openim::log::info "Stopping OpenIM Tools..."
|
||||
for tool in "${OPENIM_TOOLS_NAME_LISTARIES[@]}"; do
|
||||
openim::log::info "Stopping ${tool}..."
|
||||
# Similarly, place the actual command to stop the tool here.
|
||||
echo "Stopping service for ${tool}"
|
||||
sleep 0.2
|
||||
done
|
||||
}
|
||||
|
||||
function openim::tools::pre-stop() {
|
||||
openim::log::info "Preparing to stop OpenIM Tools..."
|
||||
for tool in "${OPENIM_TOOLS_PRE_START_NAME_LISTARIES[@]}"; do
|
||||
openim::log::info "Setting up pre-stop for ${tool}..."
|
||||
echo "Pre-stop actions for ${tool}"
|
||||
sleep 0.2
|
||||
done
|
||||
}
|
||||
|
||||
function openim::tools::post-stop() {
|
||||
openim::log::info "Post-stop actions for OpenIM Tools..."
|
||||
for tool in "${OPENIM_TOOLS_POST_START_NAME_LISTARIES[@]}"; do
|
||||
openim::log::info "Executing post-stop for ${tool}..."
|
||||
echo "Post-stop cleanup for ${tool}"
|
||||
sleep 0.2
|
||||
done
|
||||
}
|
||||
|
||||
if [[ "$*" =~ openim::tools:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
# The root of the build/dist directory
|
||||
IAM_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
||||
[[ -z ${COMMON_SOURCED} ]] && source ${IAM_ROOT}/scripts/install/common.sh
|
||||
|
||||
# Print the necessary information after installation
|
||||
function openim::redis::info() {
|
||||
cat << EOF
|
||||
Redis Login: redis-cli --no-auth-warning -h ${REDIS_HOST} -p ${REDIS_PORT} -a '${REDIS_PASSWORD}'
|
||||
EOF
|
||||
}
|
||||
|
||||
# 安装
|
||||
function openim::redis::install()
|
||||
{
|
||||
# 1. 安装 Redis
|
||||
openim::common::sudo "apt-get -y install redis-server"
|
||||
|
||||
# 2. 配置 Redis
|
||||
# 2.1 修改 `/etc/redis/redis.conf` 文件,将 daemonize 由 no 改成 yes,表示允许 Redis 在后台启动
|
||||
echo ${LINUX_PASSWORD} | sudo -S sed -i '/^daemonize/{s/no/yes/}' /etc/redis/redis.conf
|
||||
|
||||
# 2.2 在 `bind 127.0.0.1` 前面添加 `#` 将其注释掉,默认情况下只允许本地连接,注释掉后外网可以连接 Redis
|
||||
echo ${LINUX_PASSWORD} | sudo -S sed -i '/^# bind 127.0.0.1/{s/# //}' /etc/redis/redis.conf
|
||||
|
||||
# 2.3 修改 requirepass 配置,设置 Redis 密码
|
||||
echo ${LINUX_PASSWORD} | sudo -S sed -i 's/^# requirepass.*$/requirepass '"${REDIS_PASSWORD}"'/' /etc/redis/redis.conf
|
||||
|
||||
# 2.4 因为我们上面配置了密码登录,需要将 protected-mode 设置为 no,关闭保护模式
|
||||
echo ${LINUX_PASSWORD} | sudo -S sed -i '/^protected-mode/{s/yes/no/}' /etc/redis/redis.conf
|
||||
|
||||
# 3. 为了能够远程连上 Redis,需要执行以下命令关闭防火墙,并禁止防火墙开机启动(如果不需要远程连接,可忽略此步骤)
|
||||
openim::common::sudo "sudo ufw disable"
|
||||
openim::common::sudo "sudo ufw status"
|
||||
|
||||
# 4. 启动 Redis
|
||||
openim::common::sudo "redis-server /etc/redis/redis.conf"
|
||||
|
||||
openim::redis::status || return 1
|
||||
openim::redis::info
|
||||
openim::log::info "install Redis successfully"
|
||||
}
|
||||
|
||||
# 卸载
|
||||
function openim::redis::uninstall()
|
||||
{
|
||||
set +o errexit
|
||||
openim::common::sudo "/etc/init.d/redis-server stop"
|
||||
openim::common::sudo "apt-get -y remove redis-server"
|
||||
openim::common::sudo "rm -rf /var/lib/redis"
|
||||
set -o errexit
|
||||
openim::log::info "uninstall Redis successfully"
|
||||
}
|
||||
|
||||
# 状态检查
|
||||
function openim::redis::status()
|
||||
{
|
||||
if [[ -z "`pgrep redis-server`" ]];then
|
||||
openim::log::error_exit "Redis not running, maybe not installed properly"
|
||||
return 1
|
||||
fi
|
||||
|
||||
redis-cli --no-auth-warning -h ${REDIS_HOST} -p ${REDIS_PORT} -a "${REDIS_PASSWORD}" --hotkeys || {
|
||||
openim::log::error "can not login with ${REDIS_USERNAME}, redis maybe not initialized properly"
|
||||
return 1
|
||||
}
|
||||
|
||||
openim::log::info "redis-server status active"
|
||||
}
|
||||
|
||||
#eval $*
|
||||
if [[ "$*" =~ openim::redis:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
@@ -60,7 +60,7 @@ start_docker_compose() {
|
||||
docker compose up -d
|
||||
fi
|
||||
|
||||
${OPENIM_ROOT}/scripts/docker_check_service.sh
|
||||
${OPENIM_ROOT}/scripts/docker-check-service.sh
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
# Common utilities, variables and checks for all build scripts.
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
source $SCRIPTS_ROOT/style_info.sh
|
||||
|
||||
# docker-compose.yaml file name
|
||||
docker_compose_file_name="docker-compose.yaml"
|
||||
|
||||
trap 'onCtrlC' INT
|
||||
function onCtrlC () {
|
||||
#Capture CTRL+C, terminate the background process of the program when the script is terminated in the form of ctrl+c
|
||||
kill -9 ${do_sth_pid} ${progress_pid}
|
||||
echo
|
||||
echo 'Ctrl+C is captured'
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Load environment variables from .env file
|
||||
source ${OPENIM_ROOT}/.env
|
||||
|
||||
# Get the public internet IP address
|
||||
internet_ip=$(curl ifconfig.me -s)
|
||||
echo -e "${PURPLE_PREFIX}=========> Your public internet IP address is ${internet_ip} ${COLOR_SUFFIX} \n"
|
||||
|
||||
# Replace local IP address with the public IP address in .env file
|
||||
if [ $API_URL == "http://127.0.0.1:10002/object/" ]; then
|
||||
sed -i "s/127.0.0.1/${internet_ip}/" ${OPENIM_ROOT}/.env
|
||||
fi
|
||||
|
||||
if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then
|
||||
sed -i "s/127.0.0.1/${internet_ip}/" ${OPENIM_ROOT}/.env
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
echo -e "${PURPLE_PREFIX}=========> Your minio endpoint is ${MINIO_ENDPOINT} ${COLOR_SUFFIX} \n"
|
||||
|
||||
# Change directory to scripts folder
|
||||
|
||||
chmod +x ${SCRIPTS_ROOT}/*.sh
|
||||
|
||||
# Execute necessary scripts
|
||||
echo -e "${PURPLE_PREFIX}=========> init_pwd.sh ${COLOR_SUFFIX} \n"
|
||||
|
||||
${SCRIPTS_ROOT}/init_pwd.sh
|
||||
|
||||
echo -e "${PURPLE_PREFIX}=========> env_check.sh ${COLOR_SUFFIX} \n"
|
||||
|
||||
${SCRIPTS_ROOT}/env_check.sh
|
||||
|
||||
# Go back to the previous directory
|
||||
cd ${OPENIM_ROOT}
|
||||
|
||||
# Check if docker-compose command is available
|
||||
if command -v docker-compose &> /dev/null
|
||||
then
|
||||
docker-compose up -d
|
||||
else
|
||||
docker compose up -d
|
||||
fi
|
||||
|
||||
${SCRIPTS_ROOT}/docker_check_service.sh
|
||||
@@ -98,6 +98,7 @@ openim::golang::start_script_list() {
|
||||
openim-msgtransfer.sh
|
||||
openim-msggateway.sh
|
||||
openim-crontask.sh
|
||||
openim-tools.sh
|
||||
)
|
||||
local result=()
|
||||
for target in "${targets[@]}"; do
|
||||
|
||||
@@ -51,6 +51,7 @@ export no_proxy="127.0.0.1,localhost${no_proxy:+,${no_proxy}}"
|
||||
|
||||
# This is a symlink to binaries for "this platform", e.g. build tools.
|
||||
export THIS_PLATFORM_BIN="${OPENIM_ROOT}/_output/bin/platforms"
|
||||
export THIS_PLATFORM_BIN_TOOLS="${OPENIM_ROOT}/_output/bin/tools"
|
||||
|
||||
. $(dirname ${BASH_SOURCE})/color.sh
|
||||
. $(dirname ${BASH_SOURCE})/util.sh
|
||||
@@ -66,6 +67,8 @@ openim::util::ensure-bash-version
|
||||
|
||||
OPENIM_OUTPUT_HOSTBIN="${OPENIM_OUTPUT_BINPATH}/$(openim::util::host_platform)"
|
||||
export OPENIM_OUTPUT_HOSTBIN
|
||||
OPENIM_OUTPUT_HOSTBIN_TOOLS="${OPENIM_OUTPUT_BINTOOLPATH}/$(openim::util::host_platform)"
|
||||
export OPENIM_OUTPUT_HOSTBIN_TOOLS
|
||||
|
||||
export OPENIM_NONSERVER_GROUP_VERSIONS
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ openim::log::error_exit() {
|
||||
if [[ ${OPENIM_VERBOSE} -ge 4 ]]; then
|
||||
local source_file=${BASH_SOURCE[${stack_skip}]}
|
||||
local source_line=${BASH_LINENO[$((stack_skip - 1))]}
|
||||
echo_log "!!! Error in ${source_file}:${source_line}" >&2
|
||||
echo_log -e "${COLOR_RED}!!! Error in ${source_file}:${source_line} ${COLOR_SUFFIX}" >&2
|
||||
[[ -z ${1-} ]] || {
|
||||
echo_log " ${1}" >&2
|
||||
}
|
||||
@@ -207,7 +207,7 @@ openim::log::success()
|
||||
return
|
||||
fi
|
||||
timestamp=$(date +"%m%d %H:%M:%S")
|
||||
echo_log -e "${BRIGHT_GREEN_PREFIX}[success ${timestamp}] ${COLOR_SUFFIX}==> " "$@"
|
||||
echo_log -e "${COLOR_GREEN}[success ${timestamp}] ${COLOR_SUFFIX}==> " "$@"
|
||||
}
|
||||
|
||||
function openim::log::test_log() {
|
||||
|
||||
+7
-8
@@ -287,7 +287,7 @@ openim::util::check_ports() {
|
||||
if [[ ${#not_started[@]} -ne 0 ]]; then
|
||||
openim::log::info "### Not started ports:"
|
||||
for port in "${not_started[@]}"; do
|
||||
openim::log::error "Port $port is not started. cat openim log >>> cat ${LOG_FILE}"
|
||||
openim::log::error "Port $port is not started."
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -302,6 +302,7 @@ openim::util::check_ports() {
|
||||
|
||||
# If any of the processes is not running, return a status of 1.
|
||||
if [[ ${#not_started[@]} -ne 0 ]]; then
|
||||
echo "++++ OpenIM Log >> cat ${LOG_FILE}"
|
||||
return 1
|
||||
else
|
||||
openim::log::success "started[@] processes are running."
|
||||
@@ -352,7 +353,7 @@ openim::util::check_process_names() {
|
||||
if [[ ${#not_started[@]} -ne 0 ]]; then
|
||||
openim::log::info "Not started processes:"
|
||||
for process_name in "${not_started[@]}"; do
|
||||
openim::log::error "Process $process_name is not started. cat openim log >>> cat ${LOG_FILE}"
|
||||
openim::log::error "Process $process_name is not started."
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -366,6 +367,7 @@ openim::util::check_process_names() {
|
||||
|
||||
# Return status
|
||||
if [[ ${#not_started[@]} -ne 0 ]]; then
|
||||
echo "++++ OpenIM Log >> cat ${LOG_FILE}"
|
||||
return 1
|
||||
else
|
||||
openim::log::success "All processes are running."
|
||||
@@ -971,9 +973,6 @@ function openim::util::ensure-cfssl {
|
||||
popd > /dev/null || return 1
|
||||
}
|
||||
|
||||
# openim::util::ensure-docker-buildx
|
||||
# Check if we have "docker buildx" commands available
|
||||
#
|
||||
function openim::util::ensure-docker-buildx {
|
||||
# podman returns 0 on `docker buildx version`, docker on `docker buildx`. One of them must succeed.
|
||||
if docker buildx version >/dev/null 2>&1 || docker buildx >/dev/null 2>&1; then
|
||||
@@ -1201,11 +1200,11 @@ function openim::util::get_server_ip() {
|
||||
# Check if IP retrieval was successful
|
||||
if [[ -z "$IP" ]]; then
|
||||
# If not, get the internal IP address
|
||||
IP=$(hostname -I | awk '{print $1}')
|
||||
IP=$(ip addr show | grep 'inet ' | grep -v 127.0.0.1 | awk '{print $2}' | cut -d'/' -f1 | head -n 1)
|
||||
fi
|
||||
else
|
||||
# If curl is not available, get the internal IP address
|
||||
IP=$(hostname -I | awk '{print $1}')
|
||||
IP=$(ip addr show | grep 'inet ' | grep -v 127.0.0.1 | awk '{print $2}' | cut -d'/' -f1 | head -n 1)
|
||||
fi
|
||||
|
||||
# Return the fetched IP address
|
||||
@@ -1280,4 +1279,4 @@ function openim::util::gen_os_arch() {
|
||||
echo -e "${RED_PREFIX}Unsupported OS: $OS${COLOR_SUFFIX}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ go.stop:
|
||||
.PHONY: go.check
|
||||
go.check:
|
||||
@echo "===========> Checking openim"
|
||||
@$(ROOT_DIR)/scripts/check_all.sh
|
||||
@$(ROOT_DIR)/scripts/check-all.sh
|
||||
|
||||
## go.build.verify: Verify that a suitable version of Go exists
|
||||
.PHONY: go.build.verify
|
||||
@@ -147,8 +147,8 @@ go.build.%:
|
||||
$(BIN_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_DIR)/cmd/$(COMMAND)/main.go; \
|
||||
elif [ -f $(ROOT_DIR)/tools/$(COMMAND)/$(COMMAND).go ]; then \
|
||||
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) $(GO) build $(GO_BUILD_FLAGS) -o \
|
||||
$(BIN_TOOLS_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_DIR)/tools/$(COMMAND)/$(COMMAND).go; \
|
||||
chmod +x $(BIN_TOOLS_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT); \
|
||||
$(BIN_TOOLS_DIR)/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_DIR)/tools/$(COMMAND)/$(COMMAND).go; \
|
||||
chmod +x $(BIN_TOOLS_DIR)/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT); \
|
||||
fi \
|
||||
fi
|
||||
|
||||
@@ -156,7 +156,7 @@ go.build.%:
|
||||
.PHONY: go.install
|
||||
go.install:
|
||||
@echo "===========> Installing deployment openim"
|
||||
@$(ROOT_DIR)/scripts/install_im_server.sh
|
||||
@$(ROOT_DIR)/scripts/install-im-server.sh
|
||||
|
||||
## go.multiarch: Build multi-arch binaries
|
||||
.PHONY: go.build.multiarch
|
||||
|
||||
+20
-5
@@ -36,12 +36,21 @@ openim::log::install_errexit
|
||||
# Function to execute the scripts.
|
||||
function execute_scripts() {
|
||||
for script_path in "${OPENIM_SERVER_SCRIPT_START_LIST[@]}"; do
|
||||
# Extract the script name without extension for argument generation.
|
||||
script_name_with_prefix=$(basename "$script_path" .sh)
|
||||
|
||||
# Remove the "openim-" prefix.
|
||||
script_name=${script_name_with_prefix#openim-}
|
||||
|
||||
# Construct the argument based on the script name.
|
||||
arg="openim::${script_name}::start"
|
||||
|
||||
# Check if the script file exists and is executable.
|
||||
if [[ -x "$script_path" ]]; then
|
||||
openim::log::status "Starting script: ${script_path##*/}" # Log the script name.
|
||||
|
||||
# Execute the script.
|
||||
"$script_path"
|
||||
|
||||
# Execute the script with the constructed argument.
|
||||
"$script_path" "$arg"
|
||||
|
||||
# Check if the script executed successfully.
|
||||
if [[ $? -eq 0 ]]; then
|
||||
@@ -52,8 +61,14 @@ function execute_scripts() {
|
||||
else
|
||||
openim::log::errexit "Script ${script_path##*/} is missing or not executable."
|
||||
fi
|
||||
sleep 1
|
||||
sleep 0.5
|
||||
done
|
||||
}
|
||||
|
||||
execute_scripts
|
||||
# TODO Prelaunch tools, simple for now, can abstract functions later
|
||||
TOOLS_START_SCRIPTS_PATH=${START_SCRIPTS_PATH}/openim-tools.sh
|
||||
${TOOLS_START_SCRIPTS_PATH} openim::tools::pre-start
|
||||
|
||||
execute_scripts
|
||||
|
||||
${TOOLS_START_SCRIPTS_PATH} openim::tools::post-start
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
source $SCRIPTS_ROOT/style_info.sh
|
||||
source $SCRIPTS_ROOT/path_info.sh
|
||||
source $SCRIPTS_ROOT/function.sh
|
||||
|
||||
echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}"
|
||||
echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}"
|
||||
echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
|
||||
|
||||
bin_dir="$BIN_DIR"
|
||||
logs_dir="$OPENIM_ROOT/logs"
|
||||
|
||||
cd ${component_check_binary_root}
|
||||
echo -e "${YELLOW_PREFIX}=======>$PWD${COLOR_SUFFIX}"
|
||||
cmd="./${component_check}"
|
||||
echo "==========================start components checking===========================">>$OPENIM_ROOT/logs/openIM.log
|
||||
$cmd
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
+7
-2
@@ -23,8 +23,13 @@ set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
echo "Ready to stop port: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
echo "++ Ready to stop port: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
|
||||
openim::util::stop_services_on_ports ${OPENIM_SERVER_PORT_LISTARIES[@]}
|
||||
openim::util::stop_services_on_ports ${OPENIM_SERVER_PORT_LISTARIES[@]}
|
||||
|
||||
echo -e "\n++ Stop all processes in the path ${OPENIM_OUTPUT_HOSTBIN}"
|
||||
|
||||
openim::util::stop_services_with_name "${OPENIM_OUTPUT_HOSTBIN}"
|
||||
@@ -17,7 +17,7 @@ Learn more about versions of OpenIM:
|
||||
<img src="https://github.com/openimbot/openimbot/blob/main/assets/icon/blue%E9%80%8F%E6%98%8E.png" width="50" height="50" />
|
||||
</a>
|
||||
<a href="https://www.openim.online">
|
||||
<img src="https://github.com/OpenIMSDK/Open-IM-Server/blob/main/assets/logo/openim-logo.png" />
|
||||
<img src="https://github.com/{{ .Env.USERNAME }}/{{ .ProjectName }}/blob/main/assets/logo/openim-logo.png" />
|
||||
</a>
|
||||
<a href="https://github.com/openimbot" style="float: right; margin-left: 10px;">
|
||||
<img src="https://github.com/openimbot/openimbot/blob/main/assets/icon/red%E9%80%8F%E6%98%8E.png" width="50" height="50" />
|
||||
@@ -27,5 +27,5 @@ Learn more about versions of OpenIM:
|
||||
> **Note**
|
||||
> @openimbot and @kubbot have made great contributions to the community as community 🤖robots(@openimsdk/bot), respectively.
|
||||
> Thanks to the @openimsdk/openim team for all their hard work on this release.
|
||||
> Thank you to all the [💕developers and contributors](https://github.com/OpenIMSDK/Open-IM-Server/graphs/contributors), people from all over the world, OpenIM brings us together
|
||||
> Contributions to this project are welcome! Please see [CONTRIBUTING.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md) for details.
|
||||
> Thank you to all the [💕developers and contributors](https://github.com/{{ .Env.USERNAME }}/{{ .ProjectName }}/graphs/contributors), people from all over the world, OpenIM brings us together
|
||||
> Contributions to this project are welcome! Please see [CONTRIBUTING.md](https://github.com/{{ .Env.USERNAME }}/{{ .ProjectName }}/blob/main/CONTRIBUTING.md) for details.
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
# This file is not intended to be run automatically. It is meant to be run
|
||||
# immediately before exporting docs. We do not want to check these documents in
|
||||
# by default.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/hack/lib/init.sh"
|
||||
|
||||
openim::golang::setup_env
|
||||
|
||||
BINS=(
|
||||
cmd/gendocs
|
||||
cmd/genopenimdocs
|
||||
cmd/genman
|
||||
cmd/genyaml
|
||||
)
|
||||
make -C "${OPENIM_ROOT}" WHAT="${BINS[*]}"
|
||||
|
||||
openim::util::ensure-temp-dir
|
||||
|
||||
openim::util::gen-docs "${OPENIM_TEMP}"
|
||||
|
||||
# remove all of the old docs
|
||||
openim::util::remove-gen-docs
|
||||
|
||||
# Copy fresh docs into the repo.
|
||||
# the shopt is so that we get docs/.generated_docs from the glob.
|
||||
shopt -s dotglob
|
||||
cp -af "${OPENIM_TEMP}"/* "${OPENIM_ROOT}"
|
||||
shopt -u dotglob
|
||||
+15
-13
@@ -13,11 +13,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Use this script to test if a given TCP host/port are available
|
||||
WAITFORIT_cmdname=${0##*/}
|
||||
. $(dirname ${BASH_SOURCE})/lib/init.sh
|
||||
|
||||
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then info "$@" 1>&2; fi }
|
||||
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
|
||||
|
||||
usage()
|
||||
{
|
||||
@@ -36,7 +34,7 @@ USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
function wait_for()
|
||||
wait_for()
|
||||
{
|
||||
if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
|
||||
echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
|
||||
@@ -50,7 +48,7 @@ function wait_for()
|
||||
nc -z $WAITFORIT_HOST $WAITFORIT_PORT
|
||||
WAITFORIT_result=$?
|
||||
else
|
||||
(echo > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1
|
||||
(echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1
|
||||
WAITFORIT_result=$?
|
||||
fi
|
||||
if [[ $WAITFORIT_result -eq 0 ]]; then
|
||||
@@ -63,7 +61,7 @@ function wait_for()
|
||||
return $WAITFORIT_result
|
||||
}
|
||||
|
||||
function wait_for_wrapper()
|
||||
wait_for_wrapper()
|
||||
{
|
||||
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
|
||||
if [[ $WAITFORIT_QUIET -eq 1 ]]; then
|
||||
@@ -139,7 +137,7 @@ do
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
warn "Unknown argument: $1"
|
||||
echoerr "Unknown argument: $1"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
@@ -155,16 +153,20 @@ WAITFORIT_STRICT=${WAITFORIT_STRICT:-0}
|
||||
WAITFORIT_CHILD=${WAITFORIT_CHILD:-0}
|
||||
WAITFORIT_QUIET=${WAITFORIT_QUIET:-0}
|
||||
|
||||
# check to see if timeout is from busybox?
|
||||
# Check to see if timeout is from busybox?
|
||||
WAITFORIT_TIMEOUT_PATH=$(type -p timeout)
|
||||
WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH)
|
||||
if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then
|
||||
WAITFORIT_ISBUSY=1
|
||||
WAITFORIT_BUSYTIMEFLAG="-t"
|
||||
|
||||
WAITFORIT_BUSYTIMEFLAG=""
|
||||
if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then
|
||||
WAITFORIT_ISBUSY=1
|
||||
# Check if busybox timeout uses -t flag
|
||||
# (recent Alpine versions don't support -t anymore)
|
||||
if timeout &>/dev/stdout | grep -q -e '-t '; then
|
||||
WAITFORIT_BUSYTIMEFLAG="-t"
|
||||
fi
|
||||
else
|
||||
WAITFORIT_ISBUSY=0
|
||||
WAITFORIT_BUSYTIMEFLAG=""
|
||||
WAITFORIT_ISBUSY=0
|
||||
fi
|
||||
|
||||
if [[ $WAITFORIT_CHILD -gt 0 ]]; then
|
||||
|
||||
+13
-3
@@ -1,6 +1,16 @@
|
||||
// Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
|
||||
|
||||
@@ -12,26 +12,6 @@ As openim is using go1.18's [workspace feature](https://go.dev/doc/tutorial/work
|
||||
You can execute the following commands to do things above:
|
||||
|
||||
```bash
|
||||
# 4dd91a700d3f:/openim# tree
|
||||
# .
|
||||
# ├── LICENSE
|
||||
# ├── README.md
|
||||
# ├── openim-chat
|
||||
# │ ├── bin
|
||||
# │ ├── config
|
||||
# │ ├── logs
|
||||
# │ └── scripts
|
||||
# ├── openim-server
|
||||
# │ ├── bin
|
||||
# │ ├── config
|
||||
# │ ├── logs
|
||||
# │ └── scripts
|
||||
# ├── openkf
|
||||
# │ ├── bin
|
||||
# │ ├── config
|
||||
# │ ├── logs
|
||||
# │ └── scripts
|
||||
# cd tools_code_dir
|
||||
# edit the CRD_NAME and CRD_GROUP to your own
|
||||
export OPENIM_TOOLS_NAME=<Changeme>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package changelog
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user