feat: fix scripts and build speed (#790)

* feat: fix scripts and build speed

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

* feat: add docker compose file

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

* fix: fix image

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

* feat: add chat scripts design

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

---------

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
pull/805/head
Xinwei Xiong 1 year ago committed by GitHub
parent 594b16374b
commit 7a448b35d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,10 +40,13 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Download Docker Compose
run: |
curl -o docker-compose.yaml https://gist.githubusercontent.com/cubxxw/b1d5cbd2edfa23fee911118aa3e8249e/raw/openim-server.sh
shell: bash
- name: Start Docker Compose - name: Start Docker Compose
run: | run: |
sudo docker compose stop
sudo sleep 30
sudo docker compose up -d sudo docker compose up -d
sudo sleep 60 sudo sleep 60
continue-on-error: true continue-on-error: true

@ -16,8 +16,8 @@ RUN go mod download
# Copy all files to the container # Copy all files to the container
ADD . . ADD . .
RUN /bin/sh -c "make clean" RUN make clean
RUN /bin/sh -c "make build" RUN make build
FROM ghcr.io/openim-sigs/openim-bash-image:latest FROM ghcr.io/openim-sigs/openim-bash-image:latest
@ -28,6 +28,4 @@ COPY --from=builder ${OPENIM_SERVER_CMDDIR} /openim/openim-server/scripts
COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config
COPY --from=builder ${SERVER_WORKDIR}/_output/bin/platforms /openim/openim-server/_output/bin/platforms COPY --from=builder ${SERVER_WORKDIR}/_output/bin/platforms /openim/openim-server/_output/bin/platforms
VOLUME ["/openim/openim-server/logs","/openim/openim-server/config","/openim/openim-server/scripts"]
CMD ["bash","-c","${OPENIM_SERVER_CMDDIR}/docker_start_all.sh"] CMD ["bash","-c","${OPENIM_SERVER_CMDDIR}/docker_start_all.sh"]

@ -43,4 +43,4 @@ COPY --from=builder /openim/openim-server/config /openim/openim-server/config
EXPOSE ${10002} EXPOSE ${10002}
CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-api --port 10002 -c ${SERVER_WORKDIR}/config"] CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-api --port 10002 -c ${SERVER_WORKDIR}/config"]

@ -42,4 +42,4 @@ WORKDIR /openim/openim-server
COPY --from=builder ${SERVER_WORKDIR}/_output/bin/platforms /openim/openim-server/_output/bin/platforms COPY --from=builder ${SERVER_WORKDIR}/_output/bin/platforms /openim/openim-server/_output/bin/platforms
COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config
CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-cmdutils"] CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-cmdutils"]

@ -41,4 +41,4 @@ 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/_output/bin/platforms /openim/openim-server/_output/bin/platforms
COPY --from=builder /openim/openim-server/config /openim/openim-server/config COPY --from=builder /openim/openim-server/config /openim/openim-server/config
CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-crontask"] CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-crontask"]

@ -49,4 +49,4 @@ COPY --from=builder /openim/openim-server/config /openim/openim-server/config
EXPOSE 10160 EXPOSE 10160
CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-auth --port 10160 -c ${SERVER_WORKDIR}/config"] CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-auth --port 10160 -c ${SERVER_WORKDIR}/config"]

@ -56,4 +56,4 @@ COPY --from=builder /openim/openim-server/config /openim/openim-server/config
EXPOSE 10230 EXPOSE 10230
EXPOSE 20230 EXPOSE 20230
CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-conversation --port 10230 --prometheus_port 20230 -c ${SERVER_WORKDIR}/config"] CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-conversation --port 10230 --prometheus_port 20230 -c ${SERVER_WORKDIR}/config"]

@ -56,4 +56,4 @@ COPY --from=builder /openim/openim-server/config /openim/openim-server/config
EXPOSE 10120 EXPOSE 10120
EXPOSE 20120 EXPOSE 20120
CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-friend --port 10120 --prometheus_port 20120 -c ${SERVER_WORKDIR}/config"] CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-friend --port 10120 --prometheus_port 20120 -c ${SERVER_WORKDIR}/config"]

@ -56,4 +56,4 @@ COPY --from=builder /openim/openim-server/config /openim/openim-server/config
EXPOSE 10150 EXPOSE 10150
EXPOSE 20150 EXPOSE 20150
CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-group --port 10150 --prometheus_port 20150 -c ${SERVER_WORKDIR}/config"] CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-group --port 10150 --prometheus_port 20150 -c ${SERVER_WORKDIR}/config"]

@ -56,4 +56,4 @@ COPY --from=builder /openim/openim-server/config /openim/openim-server/config
EXPOSE 10130 EXPOSE 10130
EXPOSE 20130 EXPOSE 20130
CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-msg --port 10130 --prometheus_port 20130 -c ${SERVER_WORKDIR}/config"] CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-msg --port 10130 --prometheus_port 20130 -c ${SERVER_WORKDIR}/config"]

@ -55,4 +55,4 @@ COPY --from=builder /openim/openim-server/config /openim/openim-server/config
EXPOSE 10200 EXPOSE 10200
CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-third --port 10200 -c ${SERVER_WORKDIR}/config"] CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-third --port 10200 -c ${SERVER_WORKDIR}/config"]

@ -55,4 +55,4 @@ COPY --from=builder /openim/openim-server/config /openim/openim-server/config
EXPOSE 10110 EXPOSE 10110
CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-user --port 10110 -c ${SERVER_WORKDIR}/config"] CMD ["bash", "-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-user --port 10110 -c ${SERVER_WORKDIR}/config"]

@ -52,7 +52,6 @@ services:
net.core.somaxconn: 1024 net.core.somaxconn: 1024
command: redis-server --requirepass ${PASSWORD} --appendonly yes command: redis-server --requirepass ${PASSWORD} --appendonly yes
zookeeper: zookeeper:
image: wurstmeister/zookeeper image: wurstmeister/zookeeper
ports: ports:
@ -64,7 +63,6 @@ services:
TZ: Asia/Shanghai TZ: Asia/Shanghai
restart: always restart: always
kafka: kafka:
image: wurstmeister/kafka image: wurstmeister/kafka
container_name: kafka container_name: kafka
@ -98,9 +96,8 @@ services:
restart: always restart: always
command: minio server /data --console-address ':9090' command: minio server /data --console-address ':9090'
openim_server: openim_server:
image: ghcr.io/openim-sigs/openim-server:v1.0.0-debug.11 #ghcr.io/openimsdk/openim-server:main image: ghcr.io/openimsdk/openim-server:latest
container_name: openim-server container_name: openim-server
volumes: volumes:
- ./logs:/openim/openim-server/logs - ./logs:/openim/openim-server/logs
@ -122,7 +119,7 @@ services:
max-file: "2" max-file: "2"
openim-chat: openim-chat:
image: ghcr.io/openim-sigs/openim-chat:v1.0.0-debug.11 # ghcr.io/openimsdk/openim-chat:main image: ghcr.io/openimsdk/openim-chat:latest
container_name: openim-chat container_name: openim-chat
volumes: volumes:
- ./_output/openim/openim-chat/logs:/openim/openim-chat/logs - ./_output/openim/openim-chat/logs:/openim/openim-chat/logs

@ -16,10 +16,10 @@ package controller
import ( import (
"context" "context"
unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation" "time"
"github.com/OpenIMSDK/protocol/user"
unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation" unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/protocol/user"
"github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/tx" "github.com/OpenIMSDK/tools/tx"

@ -30,7 +30,6 @@ echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
bin_dir="$BIN_DIR" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/"
ulimit -n 200000 ulimit -n 200000

@ -28,7 +28,6 @@ echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
bin_dir="$BIN_DIR" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/"
cd $OPENIM_ROOT cd $OPENIM_ROOT

@ -32,7 +32,6 @@ echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
bin_dir="$BIN_DIR" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/"
cd "$OPENIM_ROOT/scripts/" cd "$OPENIM_ROOT/scripts/"

@ -38,7 +38,6 @@ fi
bin_dir="$OPENIM_ROOT/_output/bin" bin_dir="$OPENIM_ROOT/_output/bin"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/"
if [ ! -d "$bin_dir" ]; then if [ ! -d "$bin_dir" ]; then
mkdir -p "$bin_dir" mkdir -p "$bin_dir"

@ -30,7 +30,6 @@ echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
bin_dir="$BIN_DIR" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/"
#Check if the service exists #Check if the service exists
#If it is exists,kill this process #If it is exists,kill this process

@ -23,7 +23,6 @@ source $OPENIM_ROOT/scripts/path_info.sh
bin_dir="$BIN_DIR" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/"
cd "$SCRIPTS_ROOT" cd "$SCRIPTS_ROOT"

Loading…
Cancel
Save