mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 11:52:10 +08:00
Windows can compile and run.
This commit is contained in:
parent
0267fec106
commit
eeb8041bd5
@ -23,8 +23,8 @@ import (
|
||||
|
||||
func main() {
|
||||
apiCmd := cmd.NewApiCmd(cmd.ApiServer)
|
||||
apiCmd.AddPortFlag()
|
||||
apiCmd.AddPrometheusPortFlag()
|
||||
//apiCmd.AddPortFlag()
|
||||
//apiCmd.AddPrometheusPortFlag()
|
||||
if err := apiCmd.Execute(); err != nil {
|
||||
program.ExitWithError(err)
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
storageLocation: ./_output/logs/
|
||||
storageLocation: ../../../../logs/
|
||||
rotationTime: 24
|
||||
remainRotationCount: 2
|
||||
remainLogLevel: 6
|
||||
|
||||
@ -29,7 +29,7 @@ services:
|
||||
- openim
|
||||
|
||||
redis:
|
||||
image: redis:7.0.0
|
||||
image: "${REDIS_IMAGE}"
|
||||
container_name: redis
|
||||
ports:
|
||||
- "16379:6379"
|
||||
@ -46,7 +46,7 @@ services:
|
||||
- openim
|
||||
|
||||
zookeeper:
|
||||
image: bitnami/zookeeper:3.8
|
||||
image: "${ZOOKEEPER_IMAGE}"
|
||||
container_name: zookeeper
|
||||
ports:
|
||||
- "12181:2181"
|
||||
@ -58,7 +58,7 @@ services:
|
||||
- openim
|
||||
|
||||
kafka:
|
||||
image: 'bitnami/kafka:3.5.1'
|
||||
image: "${KAFKA_IMAGE}"
|
||||
container_name: kafka
|
||||
restart: always
|
||||
user: root
|
||||
@ -83,7 +83,7 @@ services:
|
||||
|
||||
|
||||
minio:
|
||||
image: minio/minio:RELEASE.2024-01-11T07-46-16Z
|
||||
image: "${MINIO_IMAGE}"
|
||||
ports:
|
||||
- "10005:9000"
|
||||
- "19090:9090"
|
||||
|
||||
@ -24,6 +24,7 @@ start_binaries() {
|
||||
# Loop to start binary the specified number of times
|
||||
for ((i=0; i<count; i++)); do
|
||||
echo "Starting $bin_full_path -i $i -c $OPENIM_OUTPUT_CONFIG"
|
||||
cd OPENIM_OUTPUT_HOSTBIN
|
||||
cmd=("$bin_full_path" -i "$i" -c "$OPENIM_OUTPUT_CONFIG")
|
||||
nohup "${cmd[@]}" >> "${OPENIM_INIT_LOG_FILE}" 2> >(tee -a "$OPENIM_INIT_ERR_LOG_FILE" | while read line; do echo -e "\e[31m${line}\e[0m"; done >&2) &
|
||||
done
|
||||
@ -37,6 +38,7 @@ start_tools() {
|
||||
local bin_full_path=$(get_tool_full_path "$binary")
|
||||
cmd=("$bin_full_path" -c "$OPENIM_OUTPUT_CONFIG")
|
||||
echo "Starting ${cmd[@]}"
|
||||
cd OPENIM_OUTPUT_HOSTBIN_TOOLS
|
||||
"${cmd[@]}"
|
||||
ret_val=$?
|
||||
if [ $ret_val -eq 0 ]; then
|
||||
|
||||
37
scripts-new/compile.bat
Normal file
37
scripts-new/compile.bat
Normal file
@ -0,0 +1,37 @@
|
||||
@echo off
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
|
||||
SET "ROOT_DIR=%~dp0..\"
|
||||
SET "OUTPUT_DIR=%ROOT_DIR%_output\bin\platforms\windows\amd64\"
|
||||
|
||||
IF NOT EXIST "%OUTPUT_DIR%" (
|
||||
mkdir "%OUTPUT_DIR%"
|
||||
)
|
||||
|
||||
call :findMainGo "%ROOT_DIR%cmd"
|
||||
|
||||
echo Compilation complete.
|
||||
goto :eof
|
||||
|
||||
:findMainGo
|
||||
FOR /R %1 %%d IN (.) DO (
|
||||
IF EXIST "%%d\main.go" (
|
||||
SET "DIR_PATH=%%d"
|
||||
SET "DIR_NAME=%%~nxd"
|
||||
|
||||
echo Found main.go in %%d
|
||||
echo Compiling %%d...
|
||||
|
||||
|
||||
pushd "%%d"
|
||||
SET "GOOS=windows"
|
||||
SET "GOARCH=amd64"
|
||||
go build -o "!OUTPUT_DIR!!DIR_NAME!.exe" main.go
|
||||
if ERRORLEVEL 1 (
|
||||
echo Failed to compile %%d
|
||||
goto :eof
|
||||
)
|
||||
popd
|
||||
)
|
||||
)
|
||||
goto :eof
|
||||
17
scripts-new/start.bat
Normal file
17
scripts-new/start.bat
Normal file
@ -0,0 +1,17 @@
|
||||
@echo off
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
|
||||
SET "BIN_DIR=%~dp0..\_output\bin\platforms\windows\amd64"
|
||||
|
||||
SET "CONFIG_DIR=%~dp0..\config"
|
||||
|
||||
cd "%BIN_DIR%"
|
||||
|
||||
FOR %%f IN ("%BIN_DIR%\*.exe") DO (
|
||||
echo Starting %%~nf...
|
||||
echo Command: start "" "%%~nf.exe" -i 0 -c "%CONFIG_DIR%"
|
||||
start "" "%%~nf.exe" -i 0 -c "%CONFIG_DIR%"
|
||||
echo %%~nf started.
|
||||
)
|
||||
|
||||
echo All binaries in the directory have been started.
|
||||
Loading…
x
Reference in New Issue
Block a user