Skip to content

Commit

Permalink
feat(release-v3.4): Enhanced Build, Deployment, and Configuration Man…
Browse files Browse the repository at this point in the history
…agement for Optimized Performance and Automation (#1255)

* docs: add openim docs

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* docs: add openim images test

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* feat: fix openim ci and deployment

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* feat: fix openim ci and deployment

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* feat: add openim flag api configpath env set

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* fix: fix openim push logger

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* fix: fix openim config path

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* fix: fix openim config path

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* fix: fix openim config path

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

---------

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
  • Loading branch information
cubxxw committed Oct 21, 2023
1 parent c69d4da commit 363deff
Show file tree
Hide file tree
Showing 71 changed files with 505 additions and 1,182 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- # Ignore files and directories starting with a dot
# Ignore files and directories starting with a dot

# Ignore specific files
.dockerignore
Expand Down Expand Up @@ -29,4 +29,4 @@ assets/
components/

# Ignore tools and scripts
.github/ -->
.github/
3 changes: 2 additions & 1 deletion .github/workflows/bot-cherry-pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ on:
jobs:
cherry-pick:
name: Cherry Pick
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/cherry-pick') && github.event.comment.user.login=='kubbot'
# && github.event.comment.user.login=='kubbot'
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/cherry-pick')
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ jobs:
uses: docker/metadata-action@v5.0.0
with:
images: ghcr.io/openimsdk/openim-server
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
Expand Down
43 changes: 7 additions & 36 deletions .github/workflows/build-openim-web-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,12 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# ghcr.io/openimsdk/openim-web:latest
- name: Extract metadata (tags, labels) for Docker
id: meta2
uses: docker/metadata-action@v5.0.0
with:
install: true
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
images: ghcr.io/openimsdk/openim-web

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -131,38 +128,12 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker openim-web
id: meta1
uses: docker/metadata-action@v5.0.0
with:
images: ghcr.io/openimsdk/openim-web

- name: Build and push Docker image for openim-web
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./build/images/openim-tools/openim-web/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta1.outputs.tags }}
labels: ${{ steps.meta1.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Extract metadata (tags, labels) for Docker openim-web
id: meta2
uses: docker/metadata-action@v5.0.0
with:
images: ghcr.io/openimsdk/component

- name: Build and push Docker image for component
uses: docker/build-push-action@v5
with:
context: .
file: ./build/images/openim-tools/component/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta2.outputs.tags }}
labels: ${{ steps.meta2.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
labels: ${{ steps.meta2.outputs.labels }}
2 changes: 1 addition & 1 deletion .github/workflows/openimci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

strategy:
matrix:
go_version: ["1.18","1.19","1.20","1.21"]
go_version: ["1.19","1.20","1.21"]
os: [ubuntu-latest]

steps:
Expand Down
5 changes: 5 additions & 0 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ OpenIM 我们的目标是建立一个顶级的开源社区。我们有一套标

+ [接口标准](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/interface.md)

+ [OpenIM配置和环境变量设置](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md)

> **Note**
> 针对中国的用户,阅读我们的 [Docker 镜像标准](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md) 以便使用国内 aliyun 的镜像地址。OpenIM 也有针对中国的 gitee 同步仓库,你可以在 [gitee.com](https://gitee.com/openimsdk) 上找到它。
## :link: 链接

+ **[完整文档](https://doc.rentsoft.cn/)**
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ It is recommended to use Docker Compose for deployment, which can easily and qui
<details> <summary>Compile from Source</summary>
Ur need `Go 1.18` or higher version, and `make`.
Ur need `Go 1.20` or higher version, and `make`.
```bash
Expand Down Expand Up @@ -212,6 +212,8 @@ Before you start, please make sure your changes are in demand. The best for that
- [Interface Standards](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/api.md)
- [Log Standards](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/logging.md)
- [Error Code Standards](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/error_code.md)
- [OpenIM configuration and environment variable Settings](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md)


## :busts_in_silhouette: Community

Expand Down
10 changes: 10 additions & 0 deletions build/images/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM BASE_IMAGE

WORKDIR ${SERVER_WORKDIR}

# Set HTTP proxy
ARG BINARY_NAME

COPY BINARY_NAME ./bin/BINARY_NAME

ENTRYPOINT ["./bin/BINARY_NAME"]
13 changes: 4 additions & 9 deletions build/images/openim-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,15 @@ RUN go mod download

COPY . .

RUN make clean
RUN make build BINS=openim-api

RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-api /usr/bin/openim-api

# FROM ghcr.io/openim-sigs/openim-bash-image:latest
FROM ghcr.io/openim-sigs/openim-bash-image:latest

WORKDIR /openim/openim-server

COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
COPY --from=builder /openim/openim-server/config /openim/openim-server/config

ENV PORT 10002
EXPOSE 10002

RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-api /usr/bin/openim-api
COPY --from=builder /usr/bin/openim-api ./bin/openim-api

ENTRYPOINT ["bash", "-c", "openim-api -c $OPENIM_SERVER_CONFIG_NAME --port $PORT"]
ENTRYPOINT ["./bin/openim-api"]
8 changes: 0 additions & 8 deletions build/images/openim-api/Dockerfile.release

This file was deleted.

10 changes: 3 additions & 7 deletions build/images/openim-cmdutils/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,15 @@ RUN go mod download

COPY . .

RUN go mod download
RUN make clean
RUN make build BINS=openim-cmdutils
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-cmdutils /usr/bin/openim-cmdutils

FROM ghcr.io/openim-sigs/openim-bash-image:latest

WORKDIR /openim/openim-server

COPY --from=builder $OPENIM_SERVER_BINDIR/platforms /openim/openim-server/_output/bin/platforms
COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config

RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-cmdutils /usr/bin/openim-cmdutils
COPY --from=builder /usr/bin/openim-cmdutils ./bin/openim-cmdutils

ENTRYPOINT ["openim-cmdutils"]
ENTRYPOINT ["./bin/openim-cmdutils"]

CMD ["--help"]
13 changes: 5 additions & 8 deletions build/images/openim-crontask/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@ RUN go mod download

COPY . .

RUN make clean
RUN make build BINS=openim-crontask

RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-crontask /usr/bin/openim-crontask

# FROM ghcr.io/openim-sigs/openim-bash-image:latest
FROM ghcr.io/openim-sigs/openim-bash-image:latest

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 OPENIM_SERVER_CONFIG_NAME=/openim/openim-server/config

RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-crontask /usr/bin/openim-crontask
COPY --from=builder /usr/bin/openim-crontask ./bin/openim-crontask

CMD ["bash", "-c", "openim-crontask -c $OPENIM_SERVER_CONFIG_NAME"]
ENTRYPOINT ["./bin/openim-crontask"]
17 changes: 5 additions & 12 deletions build/images/openim-msggateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,15 @@ RUN go mod download

COPY . .

RUN make clean
RUN make build BINS=openim-msggateway

RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-msggateway /usr/bin/openim-msggateway

# FROM ghcr.io/openim-sigs/openim-bash-image:latest
FROM ghcr.io/openim-sigs/openim-bash-image:latest

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 PORT 10140 \
WS_PORT 10001

EXPOSE 10140
EXPOSE 10001

RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msggateway /usr/bin/openim-msggateway
COPY --from=builder /usr/bin/openim-msggateway ./bin/openim-msggateway

CMD ["bash", "-c", "openim-msggateway -c $OPENIM_SERVER_CONFIG_NAME --port $PORT --ws_port $WS_PORT"]
ENTRYPOINT ["./bin/openim-msggateway"]
11 changes: 5 additions & 6 deletions build/images/openim-msgtransfer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ RUN go mod download

COPY . .

RUN make clean
RUN make build BINS=openim-msgtransfer

RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-msgtransfer /usr/bin/openim-msgtransfer

# FROM ghcr.io/openim-sigs/openim-bash-image:latest
FROM ghcr.io/openim-sigs/openim-bash-image:latest

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

RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msgtransfer /usr/bin/openim-msgtransfer
COPY --from=builder /usr/bin/openim-msgtransfer ./bin/openim-msgtransfer

ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then openim-msgtransfer -c $OPENIM_SERVER_CONFIG_NAME --prometheus_port $PROMETHEUS_PORT; else openim-msgtransfer -c $OPENIM_SERVER_CONFIG_NAME; fi"]
ENTRYPOINT ["./bin/openim-msgtransfer"]
17 changes: 5 additions & 12 deletions build/images/openim-push/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# 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

Expand All @@ -32,21 +31,15 @@ RUN go mod download

COPY . .

RUN make clean
RUN make build BINS=openim-push

RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-push /usr/bin/openim-push

# FROM ghcr.io/openim-sigs/openim-bash-image:latest
FROM ghcr.io/openim-sigs/openim-bash-image:latest

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 PORT 10170 \
PROMETHEUS_PORT 20170

EXPOSE 10170

RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-push /usr/bin/openim-push
COPY --from=builder /usr/bin/openim-push ./bin/openim-push

ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then openim-push -c $OPENIM_SERVER_CONFIG_NAME --port $PORT --prometheus_port $PROMETHEUS_PORT; else openim-push -c $OPENIM_SERVER_CONFIG_NAME --port $PORT; fi"]
ENTRYPOINT ["./bin/openim-push"]
17 changes: 5 additions & 12 deletions build/images/openim-rpc-auth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,15 @@ RUN go mod download

COPY . .

RUN make clean

RUN make build BINS=openim-rpc-auth

RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth /usr/bin/openim-rpc-auth

# FROM ghcr.io/openim-sigs/openim-bash-image:latest
FROM ghcr.io/openim-sigs/openim-bash-image:latest

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 PORT 10160 \
PROMETHEUS_PORT 20160

EXPOSE 10160

RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-auth /usr/bin/openim-rpc-auth
COPY --from=builder /usr/bin/openim-rpc-auth ./bin/openim-rpc-auth

ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-auth --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-auth --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
ENTRYPOINT ["./bin/openim-rpc-auth"]
17 changes: 5 additions & 12 deletions build/images/openim-rpc-conversation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,15 @@ RUN go mod download

COPY . .

RUN make clean

RUN make build BINS=openim-rpc-conversation

RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation /usr/bin/openim-rpc-conversation

# FROM ghcr.io/openim-sigs/openim-bash-image:latest
FROM ghcr.io/openim-sigs/openim-bash-image:latest

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 PORT 10230 \
PROMETHEUS_PORT 20230

EXPOSE 10230

RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-conversation /usr/bin/openim-rpc-conversation
COPY --from=builder /usr/bin/openim-rpc-conversation ./bin/openim-rpc-conversation

ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-conversation --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-conversation --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
ENTRYPOINT ["./bin/openim-rpc-conversation"]
Loading

0 comments on commit 363deff

Please sign in to comment.