mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 22:39:18 +08:00
Compare commits
21 Commits
v3.8.1
...
v3.3.0-beta.0
| Author | SHA1 | Date | |
|---|---|---|---|
| f82b1be0bc | |||
| c7316a35c1 | |||
| 4401a5a650 | |||
| ed23dc8a4b | |||
| 5d4fd6110d | |||
| bac711e29f | |||
| 2849b85f89 | |||
| c9da2b0744 | |||
| d70a98ee9a | |||
| 0675110e40 | |||
| f7ba123a6c | |||
| d411117b87 | |||
| c734270126 | |||
| 25c3518931 | |||
| 562e4f8322 | |||
| d857f6e7d1 | |||
| 049bc49c7f | |||
| a4dccb8504 | |||
| caae41500c | |||
| a1871558dd | |||
| 72c7d58777 |
@@ -16,4 +16,4 @@ USER=root
|
||||
PASSWORD=openIM123
|
||||
MINIO_ENDPOINT=http://127.0.0.1:10005
|
||||
API_URL=http://127.0.0.1:10002
|
||||
DATA_DIR=./
|
||||
DATA_DIR=./
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
OpenIMSDK/openim-docker:
|
||||
- source: ./config
|
||||
dest: ./openim-server/release/config
|
||||
@@ -10,7 +24,7 @@ OpenIMSDK/openim-docker:
|
||||
replace: true
|
||||
- source: ./scripts
|
||||
dest: ./scripts
|
||||
replace: true
|
||||
replace: false
|
||||
- source: ./Makefile
|
||||
dest: ./Makefile
|
||||
replace: true
|
||||
replace: false
|
||||
|
||||
@@ -51,4 +51,5 @@ jobs:
|
||||
echo "OWNER: $OWNER"
|
||||
echo "REPO: $REPO"
|
||||
git clone -b develop https://github.com/${OWNER}/${REPO}.git; cd ${REPO}
|
||||
docker compose up -d
|
||||
docker compose up -d
|
||||
continue-on-error: true
|
||||
@@ -28,13 +28,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/first-interaction@v1.1.1
|
||||
with:
|
||||
repo-token: ${{ secrets.REDBOT_GITHUB_TOKEN }}
|
||||
issue-message: |
|
||||
Hello! Thank you for filing an issue.
|
||||
|
||||
If this is a bug report, please include relevant logs to help us debug the problem.
|
||||
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) to connect and communicate with our developers.
|
||||
repo-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
pr-message: |
|
||||
Hello! Thank you for your contribution.
|
||||
|
||||
@@ -42,4 +36,12 @@ jobs:
|
||||
|
||||
If you are implementing a feature request, please check with the maintainers that the feature will be accepted first.
|
||||
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) to connect and communicate with our developers.
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) to connect and communicate with our developers.
|
||||
|
||||
issue-message: |
|
||||
Hello! Thank you for filing an issue.
|
||||
|
||||
If this is a bug report, please include relevant logs to help us debug the problem.
|
||||
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) to connect and communicate with our developers.
|
||||
continue-on-error: true
|
||||
@@ -32,4 +32,4 @@ jobs:
|
||||
body: |
|
||||
This issue is available for anyone to work on. **Make sure to reference this issue in your pull request.** :sparkles: Thank you for your contribution! :sparkles:
|
||||
[Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) to connect and communicate with our developers.
|
||||
If you wish to accept this assignment, please leave a comment in the comments section: `/accept`.🎯
|
||||
If you wish to accept this assignment, please leave a comment in the comments section: `/accept`.🎯
|
||||
|
||||
@@ -31,6 +31,6 @@ jobs:
|
||||
steps:
|
||||
- uses: alex-page/github-project-automation-plus@v0.8.3
|
||||
with:
|
||||
project: OpenIM-V3.1
|
||||
project: openim-powerful
|
||||
column: In Progress
|
||||
repo-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
@@ -6,10 +6,6 @@
|
||||
name: Synchronize kubecub public code to other repositories
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- scripts/*
|
||||
- docs/*
|
||||
- config/*
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ ENV GOPROXY=$GOPROXY
|
||||
# Set up the working directory
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY go.mod go.sum go.work ./
|
||||
#RUN go mod download
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files to the container
|
||||
ADD . .
|
||||
|
||||
@@ -58,6 +58,16 @@ export USAGE_OPTIONS
|
||||
init:
|
||||
@$(MAKE) gen.init
|
||||
|
||||
## init-githooks: Initialize git hooks ✨
|
||||
.PHONY: init-githooks
|
||||
init-githooks:
|
||||
@$(MAKE) gen.init-githooks
|
||||
|
||||
## gen: Generate all necessary files. ✨
|
||||
.PHONY: gen
|
||||
gen:
|
||||
@$(MAKE) gen.run
|
||||
|
||||
## demo: Run demo get started with Makefiles quickly ✨
|
||||
.PHONY: demo
|
||||
demo:
|
||||
@@ -190,11 +200,6 @@ push.multiarch:
|
||||
tools:
|
||||
@$(MAKE) tools.install
|
||||
|
||||
## gen: Generate all necessary files. ✨
|
||||
.PHONY: gen
|
||||
gen:
|
||||
@$(MAKE) gen.run
|
||||
|
||||
## swagger: Generate swagger document. ✨
|
||||
.PHONY: swagger
|
||||
swagger:
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# Building OpenIM
|
||||
|
||||
Building OpenIM is easy if you take advantage of the containerized build environment. This document will help guide you through understanding this build process.
|
||||
|
||||
## Requirements
|
||||
|
||||
1. Docker, using one of the following configurations:
|
||||
* **macOS** Install Docker for Mac. See installation instructions [here](https://docs.docker.com/docker-for-mac/).
|
||||
**Note**: You will want to set the Docker VM to have at least 4GB of initial memory or building will likely fail.
|
||||
* **Linux with local Docker** Install Docker according to the [instructions](https://docs.docker.com/installation/#installation) for your OS.
|
||||
* **Windows with Docker Desktop WSL2 backend** Install Docker according to the [instructions](https://docs.docker.com/docker-for-windows/wsl-tech-preview/). Be sure to store your sources in the local Linux file system, not the Windows remote mount at `/mnt/c`.
|
||||
|
||||
**Note**: You will need to check if Docker CLI plugin buildx is properly installed (`docker-buildx` file should be present in `~/.docker/cli-plugins`). You can install buildx according to the [instructions](https://github.com/docker/buildx/blob/master/README.md#installing).
|
||||
|
||||
2. **Optional** [Google Cloud SDK](https://developers.google.com/cloud/sdk/)
|
||||
|
||||
You must install and configure Google Cloud SDK if you want to upload your release to Google Cloud Storage and may safely omit this otherwise.
|
||||
|
||||
## Actions
|
||||
|
||||
About [Images packages](https://github.com/orgs/OpenIMSDK/packages?repo_name=Open-IM-Server)
|
||||
|
||||
All files in the `build/images` directory are not templated and are instead rendered by Github Actions, which is an automated process.
|
||||
|
||||
Trigger condition:
|
||||
1. create a new tag with the format `vX.Y.Z` (e.g. `v1.0.0`)
|
||||
2. push the tag to the remote repository
|
||||
3. wait for the build to finish
|
||||
4. download the artifacts from the release page
|
||||
|
||||
## Make images
|
||||
|
||||
**help info:**
|
||||
|
||||
```bash
|
||||
$ make image.help
|
||||
```
|
||||
|
||||
**build images:**
|
||||
|
||||
```bash
|
||||
$ make image
|
||||
```
|
||||
|
||||
## Overview
|
||||
|
||||
While it is possible to build OpenIM using a local golang installation, we have a build process that runs in a Docker container. This simplifies initial set up and provides for a very consistent build and test environment.
|
||||
|
||||
|
||||
## Basic Flow
|
||||
|
||||
The scripts directly under [`build/`](.) are used to build and test. They will ensure that the `kube-build` Docker image is built (based on [`build/build-image/Dockerfile`](build-image/Dockerfile) and after base image's `KUBE_BUILD_IMAGE_CROSS_TAG` from Dockerfile is replaced with one of those actual tags of the base image, like `v1.13.9-2`) and then execute the appropriate command in that container. These scripts will both ensure that the right data is cached from run to run for incremental builds and will copy the results back out of the container. You can specify a different registry/name and version for `kube-cross` by setting `KUBE_CROSS_IMAGE` and `KUBE_CROSS_VERSION`, see [`common.sh`](common.sh) for more details.
|
||||
|
||||
The `kube-build` container image is built by first creating a "context" directory in `_output/images/build-image`. It is done there instead of at the root of the OpenIM repo to minimize the amount of data we need to package up when building the image.
|
||||
|
||||
There are 3 different containers instances that are run from this image. The first is a "data" container to store all data that needs to persist across to support incremental builds. Next there is an "rsync" container that is used to transfer data in and out to the data container. Lastly there is a "build" container that is used for actually doing build actions. The data container persists across runs while the rsync and build containers are deleted after each use.
|
||||
|
||||
`rsync` is used transparently behind the scenes to efficiently move data in and out of the container. This will use an ephemeral port picked by Docker. You can modify this by setting the `KUBE_RSYNC_PORT` env variable.
|
||||
|
||||
All Docker names are suffixed with a hash derived from the file path (to allow concurrent usage on things like CI machines) and a version number. When the version number changes all state is cleared and clean build is started. This allows the build infrastructure to be changed and signal to CI systems that old artifacts need to be deleted.
|
||||
|
||||
## Build artifacts
|
||||
The build system output all its products to a top level directory in the source repository named `_output`.
|
||||
These include the binary compiled packages (e.g. kubectl, kube-scheduler etc.) and archived Docker images.
|
||||
If you intend to run a component with a docker image you will need to import it from this directory with
|
||||
+116
-2
@@ -255,6 +255,114 @@ builds:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: infra
|
||||
id: infra
|
||||
main: ./tools/infra/infra.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: ncpu
|
||||
id: ncpu
|
||||
main: ./tools/ncpu/ncpu.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: component
|
||||
id: component
|
||||
main: ./tools/component/component.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: versionchecker
|
||||
id: versionchecker
|
||||
main: ./tools/versionchecker/versionchecker.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: changelog
|
||||
id: changelog
|
||||
main: ./tools/changelog/changelog.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
- binary: yamlfmt
|
||||
id: yamlfmt
|
||||
main: ./tools/yamlfmt/yamlfmt.go
|
||||
goos:
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch:
|
||||
- s390x
|
||||
- mips64
|
||||
- mips64le
|
||||
- amd64
|
||||
- ppc64le
|
||||
- arm64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
archives:
|
||||
- format: tar.gz
|
||||
# this name template makes the OS and Arch compatible with the results of uname.
|
||||
@@ -269,7 +377,11 @@ archives:
|
||||
files:
|
||||
- LICENSE
|
||||
- README.md
|
||||
- README-zh_CN.md
|
||||
- CODE_OF_CONDUCT.md
|
||||
- CHANGELOG/*
|
||||
- scripts/*
|
||||
- Makefile
|
||||
- CONTRIBUTING.md
|
||||
- docs/*
|
||||
- src: "*.md"
|
||||
@@ -339,7 +451,9 @@ changelog:
|
||||
# - image_templates:
|
||||
# - "openimsdk/open-im-server:{{ .Tag }}-amd64"
|
||||
# - "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-amd64"
|
||||
# dockerfile: Dockerfile
|
||||
# dockerfile: build/images/openim-api/Dockerfile.release
|
||||
# ids:
|
||||
# - openim-api
|
||||
# use: buildx
|
||||
# build_flag_templates:
|
||||
# - "--pull"
|
||||
@@ -359,7 +473,7 @@ changelog:
|
||||
# - image_templates:
|
||||
# - "goreleaser/goreleaser:{{ .Tag }}-arm64"
|
||||
# - "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-arm64"
|
||||
# dockerfile: Dockerfile
|
||||
# dockerfile: build/images/openim-api/Dockerfile.release
|
||||
# use: buildx
|
||||
# build_flag_templates:
|
||||
# - "--pull"
|
||||
|
||||
@@ -43,7 +43,10 @@ COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-s
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
ENV PORT 10002
|
||||
ENV CONFIG=/openim/openim-server/config
|
||||
|
||||
EXPOSE ${PORT}
|
||||
EXPOSE $PORT
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-api --port ${PORT} -c ${SERVER_WORKDIR}/config"]
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-api /usr/bin/openim-api
|
||||
|
||||
CMD ["bash", "-c", "openim-api -c $CONFIG --port $PORT"]
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
COPY openim-api /usr/bin/
|
||||
|
||||
# nosemgrep: dockerfile.security.missing-user.missing-user
|
||||
ENTRYPOINT ["/usr/bin/openim-api"]
|
||||
# nosemgrep: dockerfile.security.missing-user.missing-user
|
||||
CMD ["--help"]
|
||||
@@ -42,4 +42,8 @@ WORKDIR /openim/openim-server
|
||||
COPY --from=builder $OPENIM_SERVER_BINDIR/platforms /openim/openim-server/_output/bin/platforms
|
||||
COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-cmdutils"]
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-cmdutils /usr/bin/openim-cmdutils
|
||||
|
||||
ENTRYPOINT ["openim-cmdutils"]
|
||||
|
||||
CMD ["--help"]
|
||||
|
||||
@@ -41,4 +41,8 @@ WORKDIR /openim/openim-server
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-crontask"]
|
||||
ENV CONFIG=/openim/openim-server/config
|
||||
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-crontask /usr/bin/openim-crontask
|
||||
|
||||
CMD ["bash", "-c", "openim-crontask -c $CONFIG"]
|
||||
|
||||
@@ -41,10 +41,13 @@ WORKDIR /openim/openim-server
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
ENV PORT 10140
|
||||
ENV WS_PORT 10001
|
||||
ENV CONFIG=/openim/openim-server/config
|
||||
|
||||
EXPOSE 10140
|
||||
EXPOSE 10001
|
||||
EXPOSE $PORT
|
||||
EXPOSE $WS_PORT
|
||||
|
||||
CMD ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msggateway --port 10140 --ws_port 10001
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msggateway /usr/bin/openim-msggateway
|
||||
|
||||
CMD ["bash", "-c", "openim-msggateway -c $CONFIG --port $PORT --ws_port $WS_PORT"]
|
||||
@@ -36,12 +36,11 @@ RUN make build BINS=openim-msgtransfer
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
CMD ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msgtransfer
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msgtransfer /usr/bin/openim-msgtransfer
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then openim-msgtransfer -c $CONFIG --prometheus_port $PROMETHEUS_PORT; else openim-msgtransfer -c $CONFIG; fi"]
|
||||
@@ -15,6 +15,7 @@
|
||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# Set go mod installation source and proxy
|
||||
# docker run -e "PORT=10003" -e "PROMETHEUSORT=4321" --network host -it 67ef891ad1ff
|
||||
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
@@ -38,12 +39,15 @@ FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10170
|
||||
ENV PORT 10170 \
|
||||
PROMETHEUS_PORT 20170 \
|
||||
CONFIG=/openim/openim-server/config
|
||||
|
||||
CMD ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-push --port 10170
|
||||
EXPOSE $PORT
|
||||
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-push /usr/bin/openim-push
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then openim-push -c $CONFIG --port $PORT --prometheus_port $PROMETHEUS_PORT; else openim-push -c $CONFIG --port $PORT; fi"]
|
||||
@@ -33,20 +33,20 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
# RUN make build BINS=openim-rpc
|
||||
|
||||
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth ./cmd/openim-rpc/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-auth
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10160
|
||||
ENV PORT 10160
|
||||
ENV CONFIG=/openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-auth --port 10160 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE $PORT
|
||||
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-auth /usr/bin/openim-rpc-auth
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-auth --port $PORT -c $CONFIG" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-auth --port $PORT -c $CONFIG"; fi"]
|
||||
@@ -33,27 +33,22 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation ./cmd/openim-rpc/openim-rpc-conversation
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-conversation
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10230
|
||||
EXPOSE 20230
|
||||
ENV PORT 10230 \
|
||||
PROMETHEUS_PORT 20230 \
|
||||
CONFIG=/openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-conversation --port 10230 --prometheus_port 20230 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE $PORT
|
||||
EXPOSE $PROMETHEUS_PORT
|
||||
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-conversation /usr/bin/openim-rpc-conversation
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-conversation --port $PORT -c $CONFIG" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-conversation --port $PORT -c $CONFIG"; fi"]
|
||||
@@ -33,27 +33,22 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend ./cmd/openim-rpc/openim-rpc-friend
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-friend
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10120
|
||||
EXPOSE 20120
|
||||
ENV PORT 10120 \
|
||||
PROMETHEUS_PORT 20120 \
|
||||
CONFIG=/openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-friend --port 10120 --prometheus_port 20120 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE $PORT
|
||||
EXPOSE $PROMETHEUS_PORT
|
||||
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-friend /usr/bin/openim-rpc-friend
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-friend --port $PORT -c $CONFIG" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-friend --port $PORT -c $CONFIG"; fi"]
|
||||
|
||||
@@ -33,27 +33,22 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group ./cmd/openim-rpc/openim-rpc-group
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-group
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10150
|
||||
EXPOSE 20150
|
||||
ENV PORT 10150 \
|
||||
PROMETHEUS_PORT 20150 \
|
||||
CONFIG=/openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-group --port 10150 --prometheus_port 20150 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE $PORT
|
||||
EXPOSE $PROMETHEUS_PORT
|
||||
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-group /usr/bin/openim-rpc-group
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-group --port $PORT -c $CONFIG" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-group --port $PORT -c $CONFIG"; fi"]
|
||||
@@ -33,27 +33,22 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg ./cmd/openim-rpc/openim-rpc-msg
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-msg
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10130
|
||||
EXPOSE 20130
|
||||
ENV PORT 10130 \
|
||||
PROMETHEUS_PORT 20130 \
|
||||
CONFIG=/openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-msg --port 10130 --prometheus_port 20130 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE $PORT
|
||||
EXPOSE $PROMETHEUS_PORT
|
||||
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-msg /usr/bin/openim-rpc-msg
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-msg --port $PORT -c $CONFIG" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-msg --port $PORT -c $CONFIG"; fi"]
|
||||
@@ -33,26 +33,21 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third ./cmd/openim-rpc/openim-rpc-third
|
||||
RUN make build BINS=openim-rpc-third
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10200
|
||||
ENV PORT 10200 \
|
||||
CONFIG=/openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-third --port 10200 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE $PORT
|
||||
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-third /usr/bin/openim-rpc-third
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-third --port $PORT -c $CONFIG" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-third --port $PORT -c $CONFIG"; fi"]
|
||||
|
||||
@@ -33,26 +33,20 @@ COPY . .
|
||||
|
||||
RUN make clean
|
||||
|
||||
RUN make build BINS=openim-rpc
|
||||
# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user ./cmd/openim-rpc/openim-rpc-user
|
||||
|
||||
RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
|
||||
rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
|
||||
RUN make build BINS=openim-rpc-user
|
||||
|
||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
ENV OS ${OS}
|
||||
ENV ARCH ${ARCH}
|
||||
|
||||
COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
|
||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
EXPOSE 10110
|
||||
ENV PORT 10110 \
|
||||
CONFIG=/openim/openim-server/config
|
||||
|
||||
CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-user --port 10110 -c ${SERVER_WORKDIR}/config"]
|
||||
EXPOSE $PORT
|
||||
|
||||
RUN cp -r ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-user /usr/bin/openim-rpc-user
|
||||
|
||||
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-user --port $PORT -c $CONFIG" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-user --port $PORT -c $CONFIG"; fi"]
|
||||
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-api ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-api","--port", "10002"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-crontask ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-crontask"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-rpc-msg_gateway ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-rpc-msg_gateway","--port", "10140" "--ws_port", "10001", "--prometheus_port", "20240"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-msgtransfer ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-msgtransfer","--prometheus_port", "21400"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-push ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-push", "--port", "10170", "--prometheus_port", "20170"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-rpc-auth ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-rpc-auth", "--port", "10160"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-rpc-conversation ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-rpc-conversation", "--port", "10230", "--prometheus_port","20230"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-rpc-friend ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-rpc-friend", "--port", "10120", "--prometheus_port","20120"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-rpc-group ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-rpc-group", "--port", "10150", "--prometheus_port","20150"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-rpc-msg ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-rpc-msg", "--port", "10130", "--prometheus_port","20130"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-rpc-third ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-rpc-third", "--port", "10200"]
|
||||
@@ -1,32 +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.
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
WORKDIR /openim/openim-server/bin
|
||||
|
||||
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
|
||||
&&apt-get install net-tools
|
||||
#Non-interactive operation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install -y vim curl tzdata gawk
|
||||
#Time zone adjusted to East eighth District
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
COPY ./openim-rpc-user ./
|
||||
|
||||
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
|
||||
|
||||
CMD ["./openim-rpc-user", "--port", "10110"]
|
||||
@@ -103,11 +103,11 @@ services:
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:main
|
||||
# image: openim/openim-server:main
|
||||
container_name: openim-server
|
||||
# healthcheck:
|
||||
# test: ["CMD-SHELL", "./scripts/check-all.sh"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 5
|
||||
healthcheck:
|
||||
test: ["CMD", "./scripts/check-all.sh"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
volumes:
|
||||
- ./logs:/openim/openim-server/logs
|
||||
- ./config:/openim/openim-server/config
|
||||
@@ -127,35 +127,6 @@ services:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
# openim-chat:
|
||||
# # 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
|
||||
# volumes:
|
||||
# - 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:
|
||||
# - mysql
|
||||
# - mongodb
|
||||
# - redis
|
||||
# - minio
|
||||
# - openim-server
|
||||
# network_mode: "host"
|
||||
# logging:
|
||||
# driver: json-file
|
||||
# options:
|
||||
# max-size: "1g"
|
||||
# max-file: "2"
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus
|
||||
volumes:
|
||||
@@ -185,4 +156,4 @@ services:
|
||||
# container_name: node-exporter
|
||||
# restart: always
|
||||
# ports:
|
||||
# - "9100:9100"
|
||||
# - "9100:9100"
|
||||
@@ -0,0 +1,116 @@
|
||||
|
||||
|
||||
# OpenIM Offline Deployment Design
|
||||
|
||||
## 1. Base Images
|
||||
|
||||
Below are the base images and their versions you'll need:
|
||||
|
||||
- wurstmeister/kafka
|
||||
- redis:7.0.0
|
||||
- mongo:6.0.2
|
||||
- mysql:5.7
|
||||
- wurstmeister/zookeeper
|
||||
- minio/minio
|
||||
|
||||
Use the following commands to pull these base images:
|
||||
|
||||
```
|
||||
docker pull wurstmeister/kafka
|
||||
docker pull redis:7.0.0
|
||||
docker pull mongo:6.0.2
|
||||
docker pull mysql:5.7
|
||||
docker pull wurstmeister/zookeeper
|
||||
docker pull minio/minio
|
||||
```
|
||||
|
||||
## 2. OpenIM & Chat Images
|
||||
|
||||
**For detailed understanding of version management and storage of OpenIM and Chat**: [version.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
|
||||
|
||||
### OpenIM Image
|
||||
|
||||
- Get image version info: [images.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md)
|
||||
- Depending on the required version, execute the following command:
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/openimsdk/openim-server:<version-name>
|
||||
```
|
||||
|
||||
### Chat Image
|
||||
|
||||
- Execute the following command to pull the image:
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/openimsdk/openim-server:<version-name>
|
||||
```
|
||||
|
||||
## 3. Image Storage Selection
|
||||
|
||||
**Repositories**:
|
||||
|
||||
- Alibaba Cloud: `registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server`
|
||||
- Docker Hub: `openim/openim-server`
|
||||
|
||||
**Version Selection**:
|
||||
|
||||
- Stable: e.g. release-v3.2 (or 3.1, 3.3)
|
||||
- Latest: latest
|
||||
- Latest of main: main
|
||||
|
||||
## 4. Version Selection
|
||||
|
||||
You can select from the following versions:
|
||||
|
||||
- Stable: e.g. release-v3.2
|
||||
- Latest: latest
|
||||
- Latest from main branch: main
|
||||
|
||||
## 5. Offline Deployment Steps
|
||||
|
||||
1. **Pull images**: Execute the above `docker pull` commands to pull all required images locally.
|
||||
2. **Save images**:
|
||||
|
||||
```
|
||||
docker save -o <tar-file-name>.tar <image-name>
|
||||
```
|
||||
|
||||
1. **Fetch code**: Clone the repository:
|
||||
|
||||
```
|
||||
git clone https://github.com/OpenIMSDK/openim-docker.git
|
||||
```
|
||||
|
||||
Or download the code from [Releases](https://github.com/OpenIMSDK/openim-docker/releases/).
|
||||
|
||||
1. **Transfer files**: Use `scp` to transfer all images and code to the intranet server.
|
||||
|
||||
```
|
||||
scp <tar-file-name>.tar user@remote-ip:/path/on/remote/server
|
||||
```
|
||||
|
||||
Or choose other transfer methods such as a hard drive.
|
||||
|
||||
1. **Import images**: On the intranet server:
|
||||
|
||||
```
|
||||
docker load -i <tar-file-name>.tar
|
||||
```
|
||||
|
||||
1. **Deploy**: Navigate to the `openim-docker` repository directory and follow the README guide for deployment.
|
||||
2. **Deploy using Docker-compose**:
|
||||
|
||||
```
|
||||
docker-compose up -d
|
||||
|
||||
# Verify
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
> **Note**: If you're using a version of Docker prior to 20, make sure you've installed `docker-compose`.
|
||||
|
||||
## 6. Reference Links
|
||||
|
||||
- [OpenIMSDK Issue #432](https://github.com/OpenIMSDK/Open-IM-Server/issues/432)
|
||||
- [Notion Link](https://nsddd.notion.site/435ee747c0bc44048da9300a2d745ad3?pvs=25)
|
||||
- [OpenIMSDK Issue #474](https://github.com/OpenIMSDK/Open-IM-Server/issues/474)
|
||||
@@ -1,4 +1,4 @@
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
use (
|
||||
.
|
||||
@@ -7,5 +7,6 @@ use (
|
||||
./tools/imctl
|
||||
./tools/infra
|
||||
./tools/ncpu
|
||||
./tools/versionchecker
|
||||
./tools/yamlfmt
|
||||
)
|
||||
|
||||
@@ -1 +1 @@
|
||||
v3.1.0
|
||||
v3.2.0
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
urllib "net/url"
|
||||
"time"
|
||||
@@ -41,7 +40,7 @@ func Get(url string) (response []byte, err error) {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package kafka
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package tls
|
||||
|
||||
import (
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# package, the build will produce executable files under $(OUT_DIR)/bin/platforms OR $(OUT_DIR)/bin—tools/platforms.
|
||||
# If not specified, "everything" will be built.
|
||||
# Usage: `scripts/build-all-service.sh`.
|
||||
# Example: `hack/build-go.sh WHAT=cmd/kubelet`.
|
||||
# Example: `scripts/build-go.sh WHAT=cmd/kubelet`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
@@ -30,9 +30,6 @@ OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
|
||||
# CPU core number
|
||||
# Check the system type
|
||||
system_type=$(uname)
|
||||
|
||||
pushd ""${OPENIM_ROOT}"/tools/ncpu" >/dev/null
|
||||
cpu_count=$(go run .)
|
||||
popd >/dev/null
|
||||
|
||||
@@ -28,6 +28,8 @@ source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
OPENIM_VERBOSE=4
|
||||
|
||||
openim::log::info "\n# Begin to check all openim service"
|
||||
|
||||
# OpenIM status
|
||||
# Elegant printing function
|
||||
print_services_and_ports() {
|
||||
@@ -55,7 +57,7 @@ print_services_and_ports OPENIM_DEPENDENCY_TARGETS OPENIM_DEPENDENCY_PORT_TARGET
|
||||
|
||||
# OpenIM check
|
||||
echo "++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
echo "## Check all dependent service ports"
|
||||
openim::log::info "\n## Check all dependent service ports"
|
||||
echo "+++ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}"
|
||||
|
||||
set +e
|
||||
@@ -69,10 +71,10 @@ else
|
||||
fi
|
||||
set -e
|
||||
|
||||
echo -e "\n## Check OpenIM service name"
|
||||
openim::log::info "\n## Check OpenIM service name"
|
||||
. $(dirname ${BASH_SOURCE})/install/openim-msgtransfer.sh openim::msgtransfer::check
|
||||
|
||||
echo -e "\n## Check all OpenIM service ports"
|
||||
openim::log::info "\n## Check all OpenIM service ports"
|
||||
echo "+++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
openim::util::check_ports ${OPENIM_SERVER_PORT_LISTARIES[@]}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
|
||||
@@ -14,18 +14,24 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
#fixme This scripts is the total startup scripts
|
||||
#fixme The full name of the shell scripts that needs to be started is placed in the need_to_start_server_shell array
|
||||
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
openim::log::info "\n# Use Docker to start all openim service"
|
||||
|
||||
trap 'openim::util::onCtrlC' INT
|
||||
|
||||
nohup "${OPENIM_ROOT}"/scripts/start-all.sh >> ${LOG_FILE} 2>&1 &
|
||||
"${OPENIM_ROOT}"/scripts/start-all.sh
|
||||
|
||||
sleep 15
|
||||
sleep 5
|
||||
|
||||
nohup "${OPENIM_ROOT}"/scripts/check-all.sh >> ${LOG_FILE} 2>&1 &
|
||||
"${OPENIM_ROOT}"/scripts/check-all.sh
|
||||
|
||||
tail -f ${LOG_FILE}
|
||||
+16
-13
@@ -24,27 +24,30 @@ OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
|
||||
# 定义一个配置文件数组,其中包含需要生成的配置文件的名称路径 (en: Define a profile array that contains the name path of the profile to be generated.)
|
||||
readonly ENV_FILE=${ENV_FILE:-"${OPENIM_ROOT}"/scripts/install/environment.sh}
|
||||
# 定义一个配置文件数组,其中包含需要生成的配置文件的名称路径
|
||||
# (en: Define a profile array that contains the name path of the profile to be generated.)
|
||||
readonly ENV_FILE=${ENV_FILE:-"${OPENIM_ROOT}/scripts/install/environment.sh"}
|
||||
|
||||
# 定义关联数组,其中键是模板文件,值是对应的输出文件 (en: Defines an associative array where the keys are the template files and the values are the corresponding output files.)
|
||||
# 定义关联数组,其中键是模板文件,值是对应的输出文件
|
||||
# (en: Defines an associative array where the keys are the template files and the values are the corresponding output files.)
|
||||
declare -A TEMPLATES=(
|
||||
[""${OPENIM_ROOT}"/deployments/templates/env_template.yaml"]=""${OPENIM_ROOT}"/.env"
|
||||
[""${OPENIM_ROOT}"/deployments/templates/openim.yaml"]=""${OPENIM_ROOT}"/config/config.yaml"
|
||||
["${OPENIM_ROOT}/deployments/templates/env_template.yaml"]="${OPENIM_ROOT}/.env"
|
||||
["${OPENIM_ROOT}/deployments/templates/openim.yaml"]="${OPENIM_ROOT}/config/config.yaml"
|
||||
)
|
||||
|
||||
for template in "${!TEMPLATES[@]}"; do
|
||||
output_file=${TEMPLATES[$template]}
|
||||
|
||||
if [[ ! -f "${template}" ]]; then
|
||||
openim::log::error_exit "template file ${template} does not exist..."
|
||||
fi
|
||||
|
||||
openim::log::info "⌚ Working with template file: ${template} to ${output_file}..."
|
||||
""${OPENIM_ROOT}"/scripts/genconfig.sh" "${ENV_FILE}" "${template}" > "${output_file}" || {
|
||||
openim::log::error "Error processing template file ${template}"
|
||||
exit 1
|
||||
}
|
||||
IFS=';' read -ra OUTPUT_FILES <<< "${TEMPLATES[$template]}"
|
||||
for output_file in "${OUTPUT_FILES[@]}"; do
|
||||
openim::log::info "⌚ Working with template file: ${template} to ${output_file}..."
|
||||
"${OPENIM_ROOT}/scripts/genconfig.sh" "${ENV_FILE}" "${template}" > "${output_file}" || {
|
||||
openim::log::error "Error processing template file ${template}"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
done
|
||||
|
||||
openim::log::success "✨ All configuration files have been successfully generated!"
|
||||
openim::log::success "✨ All configuration files have been successfully generated!"
|
||||
|
||||
@@ -22,6 +22,8 @@ set -o pipefail
|
||||
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd -P)
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
openim::log::info "\n# Begin Install OpenIM Config"
|
||||
|
||||
for file in "${OPENIM_SERVER_TARGETS[@]}"; do
|
||||
VARNAME="$(echo $file | tr '[:lower:]' '[:upper:]' | tr '.' '_' | tr '-' '_')"
|
||||
VARVALUE="$OPENIM_OUTPUT_HOSTBIN/$file"
|
||||
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# -----------------------------------------------------------------------------
|
||||
# init-githooks.sh
|
||||
#
|
||||
# This script assists in managing Git hooks for the OpenIM project.
|
||||
# When executed:
|
||||
# 1. It prompts the user to enable git hooks.
|
||||
# 2. If the user accepts, it copies predefined hook scripts to the appropriate
|
||||
# Git directory, making them executable.
|
||||
# 3. If requested, it can delete the added hooks.
|
||||
#
|
||||
# This script equal runs `make init-githooks` command.
|
||||
# Usage:
|
||||
# ./init-githooks.sh Prompt to enable git hooks.
|
||||
# ./init-githooks.sh --delete Delete previously added git hooks.
|
||||
# ./init-githooks.sh --help Show the help message.
|
||||
#
|
||||
# Example: `scripts/build-go.sh --help`.
|
||||
# Documentation & related context can be found at:
|
||||
# https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694
|
||||
#
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
HOOKS_DIR=".git/hooks"
|
||||
|
||||
help_info() {
|
||||
echo "Usage: $0 [options]"
|
||||
echo
|
||||
echo "This script helps to manage git hooks."
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -h, --help Show this help message and exit."
|
||||
echo " -d, --delete Delete the hooks that have been added."
|
||||
echo " By default, it will prompt to enable git hooks."
|
||||
}
|
||||
|
||||
delete_hooks() {
|
||||
for file in scripts/githooks/*.sh; do
|
||||
hook_name=$(basename "$file" .sh)
|
||||
rm -f "$HOOKS_DIR/$hook_name"
|
||||
done
|
||||
echo "Git hooks have been deleted."
|
||||
}
|
||||
|
||||
enable_hooks() {
|
||||
echo "Would you like to enable git hooks mode? [y/n]"
|
||||
read -r choice
|
||||
|
||||
if [[ $choice == "y" || $choice == "Y" ]]; then
|
||||
for file in scripts/githooks/*.sh; do
|
||||
cp -f "$file" "$HOOKS_DIR/$(basename "$file" .sh)"
|
||||
done
|
||||
|
||||
chmod +x $HOOKS_DIR/*
|
||||
|
||||
echo "Git hooks mode has been enabled."
|
||||
echo "With git hooks enabled, every time you perform a git action (e.g. git commit), the corresponding hooks script will be triggered automatically."
|
||||
echo "This means that if the size of the file you're committing exceeds the set limit (e.g. 42MB), the commit will be rejected."
|
||||
else
|
||||
echo "Git hooks mode remains disabled."
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
help_info
|
||||
;;
|
||||
-d|--delete)
|
||||
delete_hooks
|
||||
;;
|
||||
*)
|
||||
enable_hooks
|
||||
;;
|
||||
esac
|
||||
@@ -102,7 +102,7 @@ def "MONGO_MAX_POOL_SIZE" "100" # 最
|
||||
|
||||
###################### Object 配置信息 ######################
|
||||
def "OBJECT_ENABLE" "minio" # 对象是否启用
|
||||
def "OBJECT_APIURL" "http://${IP}:10002" # 对象的API地址
|
||||
def "OBJECT_APIURL" "http://${IP}:10002" # 对象的API地址
|
||||
def "MINIO_BUCKET" "openim" # MinIO的存储桶名称
|
||||
def "MINIO_PORT" "10005" # MinIO的端口
|
||||
# MinIO的端点URL
|
||||
@@ -147,7 +147,7 @@ def "RPC_LISTEN_IP" "0.0.0.0" # RPC的监听IP
|
||||
|
||||
###################### API 配置信息 ######################
|
||||
# API的开放端口, 只能设置一个端口
|
||||
def "API_OPENIM_PORT" "10002"
|
||||
readonly API_OPENIM_PORT=${API_OPENIM_PORT:-'10002'}
|
||||
def "API_LISTEN_IP" "0.0.0.0" # API的监听IP
|
||||
|
||||
###################### RPC Port Configuration Variables ######################
|
||||
@@ -195,7 +195,8 @@ def "LOG_IS_JSON" "false" # 日志是否为JSON格式
|
||||
def "LOG_WITH_STACK" "false" # 日志是否带有堆栈信息
|
||||
|
||||
###################### Variables definition ######################
|
||||
def "OPENIM_WS_PORT" "10001" # OpenIM WS端口
|
||||
# OpenIM WS端口
|
||||
readonly OPENIM_WS_PORT=${OPENIM_WS_PORT:-'10001'}
|
||||
def "WEBSOCKET_MAX_CONN_NUM" "100000" # Websocket最大连接数
|
||||
def "WEBSOCKET_MAX_MSG_LEN" "4096" # Websocket最大消息长度
|
||||
def "WEBSOCKET_TIMEOUT" "10" # Websocket超时
|
||||
@@ -232,16 +233,27 @@ def "IOS_PRODUCTION" "false" # IOS生产
|
||||
|
||||
###################### Prometheus 配置信息 ######################
|
||||
def "PROMETHEUS_ENABLE" "false" # 是否启用 Prometheus
|
||||
def "USER_PROM_PORT" "20110" # User 服务的 Prometheus 端口
|
||||
def "FRIEND_PROM_PORT" "20120" # Friend 服务的 Prometheus 端口
|
||||
def "MESSAGE_PROM_PORT" "20130" # Message 服务的 Prometheus 端口
|
||||
def "MSG_GATEWAY_PROM_PORT" "20140" # Message Gateway 服务的 Prometheus 端口
|
||||
def "GROUP_PROM_PORT" "20150" # Group 服务的 Prometheus 端口
|
||||
def "AUTH_PROM_PORT" "20160" # Auth 服务的 Prometheus 端口
|
||||
def "PUSH_PROM_PORT" "20170" # Push 服务的 Prometheus 端口
|
||||
def "CONVERSATION_PROM_PORT" "20230" # Conversation 服务的 Prometheus 端口
|
||||
def "RTC_PROM_PORT" "21300" # RTC 服务的 Prometheus 端口
|
||||
def "THIRD_PROM_PORT" "21301" # Third 服务的 Prometheus 端口
|
||||
# User 服务的 Prometheus 端口
|
||||
readonly USER_PROM_PORT=${USER_PROM_PORT:-'20110'}
|
||||
# Friend 服务的 Prometheus 端口
|
||||
readonly FRIEND_PROM_PORT=${FRIEND_PROM_PORT:-'20120'}
|
||||
# Message 服务的 Prometheus 端口
|
||||
readonly MESSAGE_PROM_PORT=${MESSAGE_PROM_PORT:-'20130'}
|
||||
# Message Gateway 服务的 Prometheus 端口
|
||||
readonly MSG_GATEWAY_PROM_PORT=${MSG_GATEWAY_PROM_PORT:-'20140'}
|
||||
# Group 服务的 Prometheus 端口
|
||||
readonly GROUP_PROM_PORT=${GROUP_PROM_PORT:-'20150'}
|
||||
# Auth 服务的 Prometheus 端口
|
||||
readonly AUTH_PROM_PORT=${AUTH_PROM_PORT:-'20160'}
|
||||
# Push 服务的 Prometheus 端口
|
||||
readonly PUSH_PROM_PORT=${PUSH_PROM_PORT:-'20170'}
|
||||
# Conversation 服务的 Prometheus 端口
|
||||
readonly CONVERSATION_PROM_PORT=${CONVERSATION_PROM_PORT:-'20230'}
|
||||
# RTC 服务的 Prometheus 端口
|
||||
readonly RTC_PROM_PORT=${RTC_PROM_PORT:-'21300'}
|
||||
# Third 服务的 Prometheus 端口
|
||||
readonly THIRD_PROM_PORT=${THIRD_PROM_PORT:-'21301'}
|
||||
|
||||
# Message Transfer 服务的 Prometheus 端口列表
|
||||
readonly MSG_TRANSFER_PROM_PORT=${MSG_TRANSFER_PROM_PORT:-'21400, 21401, 21402, 21403'}
|
||||
|
||||
|
||||
@@ -33,32 +33,36 @@ function openim::msggateway::start()
|
||||
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_MESSAGE_GATEWAY_PORTS=$(openim::util::list-to-string ${OPENIM_MESSAGE_GATEWAY_PORT} )
|
||||
read -a OPENIM_MSGGATEWAY_PORTS_ARRAY <<< ${OPENIM_MESSAGE_GATEWAY_PORTS}
|
||||
|
||||
# OpenIM WS port
|
||||
OPENIM_WS_PORTS=$(openim::util::list-to-string ${OPENIM_WS_PORT} )
|
||||
read -a OPENIM_WS_PORTS_ARRAY <<< ${OPENIM_WS_PORTS}
|
||||
|
||||
# Message Gateway Prometheus port of the service
|
||||
MSG_GATEWAY_PROM_PORTS=$(openim::util::list-to-string ${MSG_GATEWAY_PROM_PORT} )
|
||||
read -a MSG_GATEWAY_PROM_PORTS_ARRAY <<< ${MSG_GATEWAY_PROM_PORTS}
|
||||
|
||||
openim::log::status "OpenIM RPC ports: ${OPENIM_RPC_PORTS[*]}"
|
||||
openim::log::status "OpenIM Mssage Getway ports: ${OPENIM_MESSAGE_GATEWAY_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}"
|
||||
|
||||
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
|
||||
if [ ${#OPENIM_MSGGATEWAY_PORTS_ARRAY[@]} -ne ${#OPENIM_WS_PORTS_ARRAY[@]} ]; then
|
||||
openim::log::error_exit "ws_ports does not match push_rpc_ports or prome_ports in quantity!!!"
|
||||
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_ARRAY[@]}; i++)); do
|
||||
openim::log::info "start push process, port: ${OPENIM_MSGGATEWAY_PORTS_ARRAY[$i]}, prometheus port: ${MSG_GATEWAY_PROM_PORTS_ARRAY[$i]}"
|
||||
|
||||
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 &
|
||||
PROMETHEUS_PORT_OPTION=""
|
||||
if [[ -n "${MSG_GATEWAY_PROM_PORTS_ARRAY[$i]}" ]]; then
|
||||
PROMETHEUS_PORT_OPTION="--prometheus_port ${MSG_GATEWAY_PROM_PORTS_ARRAY[$i]}"
|
||||
fi
|
||||
|
||||
nohup ${OPENIM_MSGGATEWAY_BINARY} --port ${OPENIM_MSGGATEWAY_PORTS_ARRAY[$i]} --ws_port ${OPENIM_WS_PORTS_ARRAY[$i]} $PROMETHEUS_PORT_OPTION -c ${OPENIM_MSGGATEWAY_CONFIG} >> ${LOG_FILE} 2>&1 &
|
||||
done
|
||||
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
|
||||
@@ -127,15 +127,19 @@ function openim::rpc::start() {
|
||||
|
||||
# Get the service and Prometheus ports.
|
||||
OPENIM_RPC_SERVICE_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_PORT_LISTARIES[$i]}) )
|
||||
read -a OPENIM_RPC_SERVICE_PORTS_ARRAY <<< ${OPENIM_RPC_SERVICE_PORTS}
|
||||
|
||||
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
|
||||
read -a OPENIM_RPC_PROM_PORTS_ARRAY <<< ${OPENIM_RPC_PROM_PORTS}
|
||||
|
||||
for ((j = 0; j < ${#OPENIM_RPC_SERVICE_PORTS_ARRAY[@]}; j++)); do
|
||||
openim::log::info "Starting ${OPENIM_RPC_SERVICE_LISTARIES[$i]} service, port: ${OPENIM_RPC_SERVICE_PORTS[j]}, prometheus port: ${OPENIM_RPC_PROM_PORTS[j]}, binary root: ${OPENIM_OUTPUT_HOSTBIN}/${OPENIM_RPC_SERVICE_LISTARIES[$i]}"
|
||||
openim::rpc::start_service "${OPENIM_RPC_SERVICE_LISTARIES[$i]}" "${OPENIM_RPC_SERVICE_PORTS[j]}" "${OPENIM_RPC_PROM_PORTS[j]}"
|
||||
sleep 0.5
|
||||
done
|
||||
done
|
||||
|
||||
sleep 0.5
|
||||
|
||||
openim::util::check_ports ${OPENIM_RPC_PORT_TARGETS[@]}
|
||||
# openim::util::check_ports ${OPENIM_RPC_PROM_PORT_TARGETS[@]}
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ readonly OPENIM_TOOLS_PRE_START_NAME_LISTARIES=("${OPENIM_TOOLS_PRE_START_NAME_T
|
||||
openim::tools::post_start_name() {
|
||||
local targets=(
|
||||
infra
|
||||
versionchecker
|
||||
)
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
|
||||
@@ -212,11 +212,11 @@ openim::log::success()
|
||||
|
||||
function openim::log::test_log() {
|
||||
echo_log "test log"
|
||||
openim::log::error "openim::log::error"
|
||||
openim::log::info "openim::log::info"
|
||||
openim::log::progress "openim::log::progress"
|
||||
openim::log::status "openim::log::status"
|
||||
openim::log::success "openim::log::success"
|
||||
openim::log::error "openim::log::error"
|
||||
openim::log::error_exit "openim::log::error_exit"
|
||||
}
|
||||
|
||||
|
||||
+22
-16
@@ -267,25 +267,29 @@ openim::util::check_ports() {
|
||||
openim::log::info "Checking ports: $*"
|
||||
# Iterate over each given port.
|
||||
for port in "$@"; do
|
||||
# Use the `lsof` command to find process information related to the given port.
|
||||
local info=$(lsof -i :$port -n -P | grep LISTEN || true)
|
||||
# Use the `ss` command to find process information related to the given port.
|
||||
local info=$(ss -ltnp | grep -w ":$port" || true)
|
||||
|
||||
# If there's no process information, it means the process associated with the port is not running.
|
||||
if [[ -z $info ]]; then
|
||||
not_started+=($port)
|
||||
else
|
||||
# If there's process information, extract relevant details:
|
||||
# Process ID, Command Name, and Start Time.
|
||||
local pid=$(echo $info | awk '{print $2}')
|
||||
local command=$(echo $info | awk '{print $1}')
|
||||
local start_time=$(ps -o lstart= -p $pid)
|
||||
started+=("Port $port - Command: $command, PID: $pid, Start time: $start_time")
|
||||
# Extract relevant details: Process Name, PID, and FD.
|
||||
local details=$(echo $info | sed -n 's/.*users:(("\([^"]*\)",pid=\([^,]*\),fd=\([^)]*\))).*/\1 \2 \3/p')
|
||||
local command=$(echo $details | awk '{print $1}')
|
||||
local pid=$(echo $details | awk '{print $2}')
|
||||
local fd=$(echo $details | awk '{print $3}')
|
||||
|
||||
# Get the start time of the process using the PID
|
||||
local start_time=$(ps -p $pid -o lstart=)
|
||||
|
||||
started+=("Port $port - Command: $command, PID: $pid, FD: $fd, Started: $start_time")
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
||||
# Print information about ports whose processes are not running.
|
||||
if [[ ${#not_started[@]} -ne 0 ]]; then
|
||||
openim::log::info "### Not started ports:"
|
||||
openim::log::info "\n### Not started ports:"
|
||||
for port in "${not_started[@]}"; do
|
||||
openim::log::error "Port $port is not started."
|
||||
done
|
||||
@@ -293,8 +297,7 @@ openim::util::check_ports() {
|
||||
|
||||
# Print information about ports whose processes are running.
|
||||
if [[ ${#started[@]} -ne 0 ]]; then
|
||||
echo
|
||||
openim::log::info "### Started ports:"
|
||||
openim::log::info "\n### Started ports:"
|
||||
for info in "${started[@]}"; do
|
||||
openim::log::info "$info"
|
||||
done
|
||||
@@ -305,11 +308,14 @@ openim::util::check_ports() {
|
||||
echo "++++ OpenIM Log >> cat ${LOG_FILE}"
|
||||
return 1
|
||||
else
|
||||
openim::log::success "started[@] processes are running."
|
||||
openim::log::success "All specified processes are running."
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
# openim::util::check_ports 10002 1004
|
||||
# set +o errexit
|
||||
# Sample call for testing:
|
||||
# openim::util::check_ports 10002 1004 12345 13306
|
||||
# set -o errexit
|
||||
|
||||
# The `openim::util::check_process_names` function analyzes the state of processes based on given names.
|
||||
# It accepts multiple process names as arguments and prints:
|
||||
@@ -895,13 +901,13 @@ function openim::util::list-to-string() {
|
||||
# 2. Replace commas with spaces
|
||||
# 3. Remove opening and closing brackets
|
||||
ports_array=$(echo "$ports_list" | sed 's/ //g; s/,/ /g; s/^\[\(.*\)\]$/\1/')
|
||||
|
||||
# For external use, we might want to echo the result so that it can be captured by callers
|
||||
echo "$ports_array"
|
||||
}
|
||||
# MSG_GATEWAY_PROM_PORTS=$(openim::util::list-to-string "10023, 2323, 34 34")
|
||||
# read -a MSG_GATEWAY_PROM_PORTS <<< $(openim::util::list-to-string "10023, 2323, 34 34")
|
||||
# echo ${MSG_GATEWAY_PROM_PORTS}
|
||||
|
||||
# echo "${#MSG_GATEWAY_PROM_PORTS[@]}"
|
||||
# Downloads cfssl/cfssljson/cfssl-certinfo into $1 directory if they do not already exist in PATH
|
||||
#
|
||||
# Assumed vars:
|
||||
|
||||
@@ -140,10 +140,6 @@ ifndef V
|
||||
MAKEFLAGS += --no-print-directory
|
||||
endif
|
||||
|
||||
# Copy githook scripts when execute makefile
|
||||
# TODO! GIT_FILE_SIZE_LIMIT=42000000 git commit -m "This commit is allowed file sizes up to 42MB"
|
||||
COPY_GITHOOK:=$(shell cp -f scripts/githooks/* .git/hooks/; chmod +x .git/hooks/*)
|
||||
|
||||
# COMMA: Concatenate multiple strings to form a list of strings
|
||||
COMMA := ,
|
||||
# SPACE: Used to separate strings
|
||||
|
||||
@@ -28,6 +28,12 @@ gen.init:
|
||||
@echo "===========> Initializing openim server project"
|
||||
@${ROOT_DIR}/scripts/init-config.sh
|
||||
|
||||
## gen.init-githooks: Initialize git hooks ✨
|
||||
.PHONY: gen.init-githooks
|
||||
gen.init-githooks:
|
||||
@echo "===========> Initializing git hooks"
|
||||
@${ROOT_DIR}/scripts/init-githooks.sh
|
||||
|
||||
## gen.run: Generate necessary files and docs ✨
|
||||
.PHONY: gen.run
|
||||
#gen.run: gen.errcode gen.docgo
|
||||
|
||||
@@ -22,6 +22,8 @@ set -o pipefail
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
openim::log::info "\n# Begin to start all openim service scripts"
|
||||
|
||||
set +o errexit
|
||||
openim::golang::check_openim_binaries
|
||||
if [[ $? -ne 0 ]]; then
|
||||
@@ -61,16 +63,21 @@ function execute_scripts() {
|
||||
else
|
||||
openim::log::errexit "Script ${script_path##*/} is missing or not executable."
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
sleep 0.5
|
||||
}
|
||||
|
||||
|
||||
# TODO Prelaunch tools, simple for now, can abstract functions later
|
||||
TOOLS_START_SCRIPTS_PATH=${START_SCRIPTS_PATH}/openim-tools.sh
|
||||
|
||||
openim::log::info "\n## Pre Starting OpenIM services"
|
||||
${TOOLS_START_SCRIPTS_PATH} openim::tools::pre-start
|
||||
|
||||
openim::log::info "\n## Starting OpenIM services"
|
||||
execute_scripts
|
||||
|
||||
openim::log::info "\n## Post Starting OpenIM services"
|
||||
${TOOLS_START_SCRIPTS_PATH} openim::tools::post-start
|
||||
|
||||
openim::log::success "✨ All OpenIM services have been successfully started!"
|
||||
@@ -26,6 +26,8 @@ OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
openim::log::info "\n# Begin to stop all openim service"
|
||||
|
||||
echo "++ Ready to stop port: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||
|
||||
openim::util::stop_services_on_ports ${OPENIM_SERVER_PORT_LISTARIES[@]}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/test/typecheck
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
require golang.org/x/tools v0.12.0
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/changelog
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/component
|
||||
|
||||
go 1.19
|
||||
go 1.18
|
||||
|
||||
+66
-24
@@ -1,47 +1,89 @@
|
||||
# OpenIM CTL 模块
|
||||
# [RFC #0005] OpenIM CTL Module Proposal
|
||||
|
||||
## Meta
|
||||
|
||||
## 为什么设计这个模块
|
||||
- Name: OpenIM CTL Module Enhancement
|
||||
- Start Date: 2023-08-23
|
||||
- Author(s): @cubxxw
|
||||
- Status: Draft
|
||||
- RFC Pull Request: (leave blank)
|
||||
- OpenIMSDK Pull Request: (leave blank)
|
||||
- OpenIMSDK Issue: https://github.com/OpenIMSDK/Open-IM-Server/issues/924
|
||||
- Supersedes: N/A
|
||||
|
||||
OpenIM 后期功能扩展,不能总依赖一些单独的模块,而是整合到 Imctl 中。
|
||||
## 📇Topics
|
||||
|
||||
测试同学做自动化测试或者是 e2e 测试,接口测试等等,每一次调用 API 很麻烦,用 imctl 的方式为 api 的调用提供了方便
|
||||
- RFC #0000 OpenIMSDK CTL Module Proposal
|
||||
- [Meta](#meta)
|
||||
- [Summary](#summary)
|
||||
- [Definitions](#definitions)
|
||||
- [Motivation](#motivation)
|
||||
- [What it is](#what-it-is)
|
||||
- [How it Works](#how-it-works)
|
||||
- [Migration](#migration)
|
||||
- [Drawbacks](#drawbacks)
|
||||
- [Alternatives](#alternatives)
|
||||
- [Prior Art](#prior-art)
|
||||
- [Unresolved Questions](#unresolved-questions)
|
||||
- [Spec. Changes (OPTIONAL)](#spec-changes-optional)
|
||||
- [History](#history)
|
||||
|
||||
和 scripts 深度交互,同样减少了 IM 本身的耦合度,提高了 IM 的可扩展性。
|
||||
## Summary
|
||||
|
||||
The OpenIM CTL module proposal aims to provide an integrated tool for the OpenIM system, offering utilities for user management, system monitoring, debugging, configuration, and more. This tool will enhance the extensibility of the OpenIM system and reduce dependencies on individual modules.
|
||||
|
||||
## 功能设计
|
||||
## Definitions
|
||||
|
||||
+ 用户管理:例如,添加、删除或禁用用户账户。
|
||||
- **OpenIM**: An Instant Messaging system.
|
||||
- **`imctl`**: The control command-line tool for OpenIM.
|
||||
- **E2E Testing**: End-to-End Testing.
|
||||
- **API**: Application Programming Interface.
|
||||
|
||||
+ 系统监控:查看在线用户数量、消息传送速率等关键性能指标。
|
||||
## Motivation
|
||||
|
||||
+ 调试:如查看日志、调整日志级别、查看系统状态等。
|
||||
- Improve the OpenIM system's extensibility and reduce dependencies on individual modules.
|
||||
- Simplify the process for testers to perform automated tests.
|
||||
- Enhance interaction with scripts and reduce the system's coupling.
|
||||
- Implement a consistent tool similar to kubectl for a streamlined user experience.
|
||||
|
||||
+ 配置管理:更新系统设置、管理插件或模块等。
|
||||
## What it is
|
||||
|
||||
+ 数据管理:备份和恢复数据、导入和导出数据等。
|
||||
`imctl` is a command-line utility designed for OpenIM to provide functionalities including:
|
||||
|
||||
+ 系统维护:例如,执行更新、重启服务、进行维护模式等。
|
||||
- User Management: Add, delete, or disable user accounts.
|
||||
- System Monitoring: View metrics like online users, message transfer rate.
|
||||
- Debugging: View logs, adjust log levels, check system states.
|
||||
- Configuration Management: Update system settings, manage plugins/modules.
|
||||
- Data Management: Backup, restore, import, or export data.
|
||||
- System Maintenance: Update, restart services, or maintenance mode.
|
||||
|
||||
## How it Works
|
||||
|
||||
## 设计思路
|
||||
`imctl`, inspired by kubectl, will have sub-commands and options for the functionalities mentioned. Developers, operations, and testers can invoke these commands to manage and monitor the OpenIM system.
|
||||
|
||||
参考 kubectl, 方便 开发、运维、测试同学使用系统功能,并且实现自动化功能。
|
||||
## Migration
|
||||
|
||||
**自动化设计思路:**
|
||||
1. 为后面的扩展子模块或者子命令提供自动化的功能,提供子命令 `imctl new` 自动创建新的子命令
|
||||
2. 以通过 imctl 对用户、密钥和策略进行CURD操作
|
||||
3. 设置 imctl 自动补全脚本
|
||||
4. 版本管理,问题:https://github.com/OpenIMSDK/Open-IM-Server/issues/574,做 IM 自动化的版本管理,查看 IM 系统版本
|
||||
Currently, the `imctl` will be housed in `tools/imctl`, and later on, the plan is to move it to `cmd/imctl`. Migration guidelines will be provided to ensure smooth transitions.
|
||||
|
||||
一些简单的 IM 解决方案可能不需要这样的工具,而复杂、高度定制的系统可能会从中受益。
|
||||
## Drawbacks
|
||||
|
||||
所以暂时将这个模块放在 tools/imctl 中,后面迁移到 cmd/imctl 中
|
||||
- Overhead in learning and adapting to a new tool for existing users.
|
||||
- Potential complexities in implementing some of the advanced functionalities.
|
||||
|
||||
## Alternatives
|
||||
|
||||
## 目录结构设计
|
||||
- Continue using individual modules for OpenIM management.
|
||||
- Utilize third-party tools or platforms with similar functionalities, customizing them for OpenIM.
|
||||
|
||||
为了方便迁移,将 imctl 工程化设计,命令工具放入到 tools/imctl/cmd 中,其他的模块放入到 tools/imctl/pkg 中
|
||||
## Prior Art
|
||||
|
||||
```
|
||||
Kubectl from Kubernetes is a significant inspiration for `imctl`, offering a comprehensive command-line tool for managing clusters.
|
||||
|
||||
## Unresolved Questions
|
||||
|
||||
- What other functionalities might be required in future versions of `imctl`?
|
||||
- What's the expected timeline for transitioning from `tools/imctl` to `cmd/imctl`?
|
||||
|
||||
## Spec. Changes (OPTIONAL)
|
||||
|
||||
As of now, there are no proposed changes to the core specifications or extensions. Future changes based on community feedback might necessitate spec changes, which will be documented accordingly.
|
||||
@@ -0,0 +1,243 @@
|
||||
// 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 genericclioptions
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/AlekSi/pointer"
|
||||
"github.com/marmotedu/marmotedu-sdk-go/rest"
|
||||
"github.com/marmotedu/marmotedu-sdk-go/tools/clientcmd"
|
||||
"github.com/spf13/pflag"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// Defines flag for imctl.
|
||||
const (
|
||||
FlagIMConfig = "imconfig"
|
||||
FlagBearerToken = "user.token"
|
||||
FlagUsername = "user.username"
|
||||
FlagPassword = "user.password"
|
||||
FlagSecretID = "user.secret-id"
|
||||
FlagSecretKey = "user.secret-key"
|
||||
FlagCertFile = "user.client-certificate"
|
||||
FlagKeyFile = "user.client-key"
|
||||
FlagTLSServerName = "server.tls-server-name"
|
||||
FlagInsecure = "server.insecure-skip-tls-verify"
|
||||
FlagCAFile = "server.certificate-authority"
|
||||
FlagAPIServer = "server.address"
|
||||
FlagTimeout = "server.timeout"
|
||||
FlagMaxRetries = "server.max-retries"
|
||||
FlagRetryInterval = "server.retry-interval"
|
||||
)
|
||||
|
||||
// RESTClientGetter is an interface that the ConfigFlags describe to provide an easier way to mock for commands
|
||||
// and eliminate the direct coupling to a struct type. Users may wish to duplicate this type in their own packages
|
||||
// as per the golang type overlapping.
|
||||
type RESTClientGetter interface {
|
||||
// ToRESTConfig returns restconfig
|
||||
ToRESTConfig() (*rest.Config, error)
|
||||
// ToRawIMConfigLoader return imconfig loader as-is
|
||||
ToRawIMConfigLoader() clientcmd.ClientConfig
|
||||
}
|
||||
|
||||
var _ RESTClientGetter = &ConfigFlags{}
|
||||
|
||||
// ConfigFlags composes the set of values necessary
|
||||
// for obtaining a REST client config.
|
||||
type ConfigFlags struct {
|
||||
IMConfig *string
|
||||
|
||||
BearerToken *string
|
||||
Username *string
|
||||
Password *string
|
||||
SecretID *string
|
||||
SecretKey *string
|
||||
|
||||
Insecure *bool
|
||||
TLSServerName *string
|
||||
CertFile *string
|
||||
KeyFile *string
|
||||
CAFile *string
|
||||
|
||||
APIServer *string
|
||||
Timeout *time.Duration
|
||||
MaxRetries *int
|
||||
RetryInterval *time.Duration
|
||||
|
||||
clientConfig clientcmd.ClientConfig
|
||||
lock sync.Mutex
|
||||
// If set to true, will use persistent client config and
|
||||
// propagate the config to the places that need it, rather than
|
||||
// loading the config multiple times
|
||||
usePersistentConfig bool
|
||||
}
|
||||
|
||||
// ToRESTConfig implements RESTClientGetter.
|
||||
// Returns a REST client configuration based on a provided path
|
||||
// to a .imconfig file, loading rules, and config flag overrides.
|
||||
// Expects the AddFlags method to have been called.
|
||||
func (f *ConfigFlags) ToRESTConfig() (*rest.Config, error) {
|
||||
return f.ToRawIMConfigLoader().ClientConfig()
|
||||
}
|
||||
|
||||
// ToRawIMConfigLoader binds config flag values to config overrides
|
||||
// Returns an interactive clientConfig if the password flag is enabled,
|
||||
// or a non-interactive clientConfig otherwise.
|
||||
func (f *ConfigFlags) ToRawIMConfigLoader() clientcmd.ClientConfig {
|
||||
if f.usePersistentConfig {
|
||||
return f.toRawIMPersistentConfigLoader()
|
||||
}
|
||||
|
||||
return f.toRawIMConfigLoader()
|
||||
}
|
||||
|
||||
func (f *ConfigFlags) toRawIMConfigLoader() clientcmd.ClientConfig {
|
||||
config := clientcmd.NewConfig()
|
||||
if err := viper.Unmarshal(&config); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return clientcmd.NewClientConfigFromConfig(config)
|
||||
}
|
||||
|
||||
// toRawIMPersistentConfigLoader binds config flag values to config overrides
|
||||
// Returns a persistent clientConfig for propagation.
|
||||
func (f *ConfigFlags) toRawIMPersistentConfigLoader() clientcmd.ClientConfig {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
if f.clientConfig == nil {
|
||||
f.clientConfig = f.toRawIMConfigLoader()
|
||||
}
|
||||
|
||||
return f.clientConfig
|
||||
}
|
||||
|
||||
// AddFlags binds client configuration flags to a given flagset.
|
||||
func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet) {
|
||||
if f.IMConfig != nil {
|
||||
flags.StringVar(f.IMConfig, FlagIMConfig, *f.IMConfig,
|
||||
fmt.Sprintf("Path to the %s file to use for CLI requests", FlagIMConfig))
|
||||
}
|
||||
|
||||
if f.BearerToken != nil {
|
||||
flags.StringVar(
|
||||
f.BearerToken,
|
||||
FlagBearerToken,
|
||||
*f.BearerToken,
|
||||
"Bearer token for authentication to the API server",
|
||||
)
|
||||
}
|
||||
|
||||
if f.Username != nil {
|
||||
flags.StringVar(f.Username, FlagUsername, *f.Username, "Username for basic authentication to the API server")
|
||||
}
|
||||
|
||||
if f.Password != nil {
|
||||
flags.StringVar(f.Password, FlagPassword, *f.Password, "Password for basic authentication to the API server")
|
||||
}
|
||||
|
||||
if f.SecretID != nil {
|
||||
flags.StringVar(f.SecretID, FlagSecretID, *f.SecretID, "SecretID for JWT authentication to the API server")
|
||||
}
|
||||
|
||||
if f.SecretKey != nil {
|
||||
flags.StringVar(f.SecretKey, FlagSecretKey, *f.SecretKey, "SecretKey for jwt authentication to the API server")
|
||||
}
|
||||
|
||||
if f.CertFile != nil {
|
||||
flags.StringVar(f.CertFile, FlagCertFile, *f.CertFile, "Path to a client certificate file for TLS")
|
||||
}
|
||||
if f.KeyFile != nil {
|
||||
flags.StringVar(f.KeyFile, FlagKeyFile, *f.KeyFile, "Path to a client key file for TLS")
|
||||
}
|
||||
if f.TLSServerName != nil {
|
||||
flags.StringVar(f.TLSServerName, FlagTLSServerName, *f.TLSServerName, ""+
|
||||
"Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used")
|
||||
}
|
||||
if f.Insecure != nil {
|
||||
flags.BoolVar(f.Insecure, FlagInsecure, *f.Insecure, ""+
|
||||
"If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure")
|
||||
}
|
||||
if f.CAFile != nil {
|
||||
flags.StringVar(f.CAFile, FlagCAFile, *f.CAFile, "Path to a cert file for the certificate authority")
|
||||
}
|
||||
|
||||
if f.APIServer != nil {
|
||||
flags.StringVarP(f.APIServer, FlagAPIServer, "s", *f.APIServer, "The address and port of the IM API server")
|
||||
}
|
||||
|
||||
if f.Timeout != nil {
|
||||
flags.DurationVar(
|
||||
f.Timeout,
|
||||
FlagTimeout,
|
||||
*f.Timeout,
|
||||
"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.",
|
||||
)
|
||||
}
|
||||
|
||||
if f.MaxRetries != nil {
|
||||
flag.IntVar(f.MaxRetries, FlagMaxRetries, *f.MaxRetries, "Maximum number of retries.")
|
||||
}
|
||||
|
||||
if f.RetryInterval != nil {
|
||||
flags.DurationVar(
|
||||
f.RetryInterval,
|
||||
FlagRetryInterval,
|
||||
*f.RetryInterval,
|
||||
"The interval time between each attempt.",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// WithDeprecatedPasswordFlag enables the username and password config flags.
|
||||
func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags {
|
||||
f.Username = pointer.ToString("")
|
||||
f.Password = pointer.ToString("")
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
// WithDeprecatedSecretFlag enables the secretID and secretKey config flags.
|
||||
func (f *ConfigFlags) WithDeprecatedSecretFlag() *ConfigFlags {
|
||||
f.SecretID = pointer.ToString("")
|
||||
f.SecretKey = pointer.ToString("")
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
// NewConfigFlags returns ConfigFlags with default values set.
|
||||
func NewConfigFlags(usePersistentConfig bool) *ConfigFlags {
|
||||
return &ConfigFlags{
|
||||
IMConfig: pointer.ToString(""),
|
||||
|
||||
BearerToken: pointer.ToString(""),
|
||||
Insecure: pointer.ToBool(false),
|
||||
TLSServerName: pointer.ToString(""),
|
||||
CertFile: pointer.ToString(""),
|
||||
KeyFile: pointer.ToString(""),
|
||||
CAFile: pointer.ToString(""),
|
||||
|
||||
APIServer: pointer.ToString(""),
|
||||
Timeout: pointer.ToDuration(30 * time.Second),
|
||||
MaxRetries: pointer.ToInt(0),
|
||||
RetryInterval: pointer.ToDuration(1 * time.Second),
|
||||
usePersistentConfig: usePersistentConfig,
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,10 +1,9 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/imctl
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/MakeNowJust/heredoc/v2 v2.0.1
|
||||
github.com/marmotedu/iam v1.7.0
|
||||
github.com/mitchellh/go-wordwrap v1.0.1
|
||||
github.com/moby/term v0.5.0
|
||||
github.com/russross/blackfriday v1.6.0
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
cliflag "github.com/marmotedu/component-base/pkg/cli/flag"
|
||||
"github.com/marmotedu/iam/pkg/cli/genericclioptions"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
@@ -36,7 +37,7 @@ func NewDefaultIMCtlCommand() *cobra.Command {
|
||||
}
|
||||
|
||||
// NewIAMCtlCommand returns new initialized instance of 'imctl' root command.
|
||||
func NewIAMCtlCommand(in io.Reader, out, err io.Writer) *cobra.Command {
|
||||
func NewIMCtlCommand(in io.Reader, out, err io.Writer) *cobra.Command {
|
||||
// Parent command to which all subcommands are added.
|
||||
cmds := &cobra.Command{
|
||||
Use: "imctl",
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/infra
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/ncpu
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
require go.uber.org/automaxprocs v1.5.3
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/versionchecker
|
||||
|
||||
go 1.18
|
||||
@@ -0,0 +1,115 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"time"
|
||||
)
|
||||
|
||||
func executeCommand(cmdName string, args ...string) (string, error) {
|
||||
cmd := exec.Command(cmdName, args...)
|
||||
var out bytes.Buffer
|
||||
var stderr bytes.Buffer
|
||||
cmd.Stdout = &out
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Error executing %s: %v", cmdName, err)
|
||||
}
|
||||
return out.String(), nil
|
||||
}
|
||||
|
||||
func printTime() string {
|
||||
currentTime := time.Now()
|
||||
|
||||
// 使用 Format 函数以优雅的方式格式化日期和时间
|
||||
// 2006-01-02 15:04:05 是 Go 中的标准时间格式
|
||||
formattedTime := currentTime.Format("2006-01-02 15:04:05")
|
||||
|
||||
return fmt.Sprintf("Current Date & Time:", formattedTime)
|
||||
}
|
||||
|
||||
func getGoVersion() string {
|
||||
version := runtime.Version()
|
||||
goos := runtime.GOOS
|
||||
goarch := runtime.GOARCH
|
||||
return fmt.Sprintf("Go Version: %s\nOS: %s\nArchitecture: %s", version, goos, goarch)
|
||||
}
|
||||
|
||||
func getDockerVersion() string {
|
||||
version, err := executeCommand("docker", "--version")
|
||||
if err != nil {
|
||||
return "Docker is not installed. Please install it to get the version."
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
func getDockerComposeVersion() string {
|
||||
version, err := executeCommand("docker-compose", "--version")
|
||||
if err != nil {
|
||||
return "Docker Compose is not installed. Please install it to get the version."
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
func getKubernetesVersion() string {
|
||||
version, err := executeCommand("kubectl", "version", "--client", "--short")
|
||||
if err != nil {
|
||||
return "Kubernetes is not installed. Please install it to get the version."
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
func getGitVersion() string {
|
||||
version, err := executeCommand("git", "branch", "--show-current")
|
||||
if err != nil {
|
||||
return "Git is not installed. Please install it to get the version."
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
// NOTE: You'll need to provide appropriate commands for OpenIM versions.
|
||||
func getOpenIMServerVersion() string {
|
||||
// Placeholder
|
||||
return "OpenIM Server: v3.2"
|
||||
}
|
||||
|
||||
func getOpenIMClientVersion() string {
|
||||
// Placeholder
|
||||
return "OpenIM Client: v3.2"
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Println(printTime())
|
||||
fmt.Println("# Diagnostic Tool Result\n")
|
||||
fmt.Println("## Go Version")
|
||||
fmt.Println(getGoVersion())
|
||||
fmt.Println("## Branch Type")
|
||||
fmt.Println(getGitVersion())
|
||||
fmt.Println("## Docker Version")
|
||||
fmt.Println(getDockerVersion())
|
||||
fmt.Println("## Docker Compose Version")
|
||||
fmt.Println(getDockerComposeVersion())
|
||||
fmt.Println("## Kubernetes Version")
|
||||
fmt.Println(getKubernetesVersion())
|
||||
fmt.Println("## OpenIM Versions")
|
||||
fmt.Println(getOpenIMServerVersion())
|
||||
fmt.Println(getOpenIMClientVersion())
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/yamlfmt
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/likexian/gokit v0.25.13
|
||||
|
||||
Reference in New Issue
Block a user