mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-28 22:58:10 +08:00
feat: optimize dockerfile option
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
parent
cf8bba036f
commit
3599d4b7ef
20
.env
20
.env
@ -1,5 +1,19 @@
|
|||||||
|
# Copyright © 2023 OpenIM. All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
USER=root
|
USER=root
|
||||||
PASSWORD=openIM123
|
PASSWORD=openIM123
|
||||||
MINIO_ENDPOINT=http://127.0.0.1:10005
|
MINIO_ENDPOINT=http://14.155.127.181:10005
|
||||||
API_URL=http://127.0.0.1:10002/object/
|
API_URL=http://14.155.127.181:10002/object/
|
||||||
DATA_DIR=./
|
DATA_DIR=/root/workspaces/openim/openim-server
|
||||||
|
|||||||
2
.github/workflows/openimci.yml
vendored
2
.github/workflows/openimci.yml
vendored
@ -49,7 +49,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go_version: ["1.18","1.19","1.20","1.21"]
|
go_version: ["1.18","1.19","1.20","1.21"]
|
||||||
os: [ubuntu-latest,macos-latest]
|
os: [ubuntu-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go ${{ matrix.go_version }}
|
- name: Set up Go ${{ matrix.go_version }}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Copyright © 2023 OpenIM. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the License);
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
@ -13,7 +13,10 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
# Infrastructural configurations, please modify based on your setup
|
# TODO: This config file is the template file
|
||||||
|
# --| source: deployments/templates/openim.yaml
|
||||||
|
# --| env: scripts/install/environment
|
||||||
|
# --| target: config/config.yaml
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
|
|
||||||
###################### Zookeeper ######################
|
###################### Zookeeper ######################
|
||||||
@ -26,8 +29,8 @@
|
|||||||
zookeeper:
|
zookeeper:
|
||||||
schema: openim
|
schema: openim
|
||||||
address: [ 127.0.0.1:2181 ]
|
address: [ 127.0.0.1:2181 ]
|
||||||
username:
|
username: ''
|
||||||
password:
|
password: ''
|
||||||
|
|
||||||
###################### Mysql ######################
|
###################### Mysql ######################
|
||||||
# MySQL configuration
|
# MySQL configuration
|
||||||
@ -57,23 +60,23 @@ mysql:
|
|||||||
# Default MongoDB database name
|
# Default MongoDB database name
|
||||||
# Maximum connection pool size
|
# Maximum connection pool size
|
||||||
mongo:
|
mongo:
|
||||||
uri:
|
uri: ''
|
||||||
address: [ 127.0.0.1:37017 ]
|
address: [ 127.0.0.1:37017 ]
|
||||||
database: openIM_v3
|
database: openIM_v3
|
||||||
username: root
|
username: root
|
||||||
password: openIM123
|
password: openIM123
|
||||||
maxPoolSize: 100
|
maxPoolSize: 100
|
||||||
|
|
||||||
###################### Redis ######################
|
###################### Redis configuration information ######################
|
||||||
# Redis configuration
|
# Redis configuration
|
||||||
#
|
#
|
||||||
# Username is required only for Redis version 6.0+
|
# Username is required only for Redis version 6.0+
|
||||||
redis:
|
redis:
|
||||||
address: [ 127.0.0.1:16379 ]
|
address: [ 127.0.0.1:16379 ]
|
||||||
username:
|
username: ''
|
||||||
password: openIM123
|
password: openIM123
|
||||||
|
|
||||||
###################### Kafka ######################
|
###################### Kafka configuration information ######################
|
||||||
# Kafka configuration
|
# Kafka configuration
|
||||||
#
|
#
|
||||||
# Kafka username
|
# Kafka username
|
||||||
@ -81,8 +84,8 @@ redis:
|
|||||||
# It's not recommended to modify this topic name
|
# It's not recommended to modify this topic name
|
||||||
# Consumer group ID, it's not recommended to modify
|
# Consumer group ID, it's not recommended to modify
|
||||||
kafka:
|
kafka:
|
||||||
username:
|
username: ''
|
||||||
password:
|
password: ''
|
||||||
addr: [ 127.0.0.1:9092 ]
|
addr: [ 127.0.0.1:9092 ]
|
||||||
latestMsgToRedis:
|
latestMsgToRedis:
|
||||||
topic: "latestMsgToRedis"
|
topic: "latestMsgToRedis"
|
||||||
@ -96,16 +99,16 @@ kafka:
|
|||||||
msgToMySql: mysql
|
msgToMySql: mysql
|
||||||
msgToPush: push
|
msgToPush: push
|
||||||
|
|
||||||
###################### RPC ######################
|
###################### RPC configuration information ######################
|
||||||
# RPC configuration
|
# RPC configuration
|
||||||
#
|
#
|
||||||
# IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway
|
# IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway
|
||||||
# Default listen IP is 0.0.0.0
|
# Default listen IP is 0.0.0.0
|
||||||
rpc:
|
rpc:
|
||||||
registerIP:
|
registerIP: ''
|
||||||
listenIP: 0.0.0.0
|
listenIP: 0.0.0.0
|
||||||
|
|
||||||
###################### API ######################
|
###################### API configuration information ######################
|
||||||
# API configuration
|
# API configuration
|
||||||
#
|
#
|
||||||
# API service port
|
# API service port
|
||||||
@ -114,7 +117,7 @@ api:
|
|||||||
openImApiPort: [ 10002 ]
|
openImApiPort: [ 10002 ]
|
||||||
listenIP: 0.0.0.0
|
listenIP: 0.0.0.0
|
||||||
|
|
||||||
###################### Gateway ######################
|
###################### Object configuration information ######################
|
||||||
# Object storage configuration
|
# Object storage configuration
|
||||||
#
|
#
|
||||||
# Use minio for object storage
|
# Use minio for object storage
|
||||||
@ -129,32 +132,34 @@ api:
|
|||||||
# minio.signEndpoint is minio public network address
|
# minio.signEndpoint is minio public network address
|
||||||
object:
|
object:
|
||||||
enable: "minio"
|
enable: "minio"
|
||||||
apiURL: "http://127.0.0.1:10002"
|
apiURL: "http://127.0.0.1:10002/object/"
|
||||||
minio:
|
minio:
|
||||||
bucket: "openim"
|
bucket: "openim"
|
||||||
endpoint: "http://127.0.0.1:10005"
|
endpoint: "http://14.155.127.181:10005"
|
||||||
accessKeyID: "root"
|
accessKeyID: "root"
|
||||||
secretAccessKey: "openIM123"
|
secretAccessKey: "openIM123"
|
||||||
sessionToken: ""
|
sessionToken: ''
|
||||||
signEndpoint: "http://127.0.0.1:10005"
|
signEndpoint: "http://14.155.127.181:10005"
|
||||||
cos:
|
cos:
|
||||||
bucketURL: "https://temp-1252357374.cos.ap-chengdu.myqcloud.com"
|
bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
|
||||||
secretID: ""
|
secretID: ''
|
||||||
secretKey: ""
|
secretKey: ''
|
||||||
sessionToken: ""
|
sessionToken: ''
|
||||||
oss:
|
oss:
|
||||||
endpoint: "https://oss-cn-chengdu.aliyuncs.com"
|
endpoint: "https://oss-cn-chengdu.aliyuncs.com"
|
||||||
bucket: "demo-9999999"
|
bucket: "demo-9999999"
|
||||||
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com"
|
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com"
|
||||||
accessKeyID: ""
|
accessKeyID: ''
|
||||||
accessKeySecret: ""
|
accessKeySecret: ''
|
||||||
sessionToken: ""
|
sessionToken: ''
|
||||||
|
|
||||||
|
|
||||||
|
###################### RPC Port Configuration ######################
|
||||||
# RPC service ports
|
# RPC service ports
|
||||||
# These ports are passed into the program by the script and are not recommended to modify
|
# These ports are passed into the program by the script and are not recommended to modify
|
||||||
# For launching multiple programs, just fill in multiple ports separated by commas
|
# For launching multiple programs, just fill in multiple ports separated by commas
|
||||||
# For example, [10110, 10111]
|
# For example, [10110, 10111]
|
||||||
rpcPort:
|
rpcPort:
|
||||||
openImUserPort: [ 10110 ]
|
openImUserPort: [ 10110 ]
|
||||||
openImFriendPort: [ 10120 ]
|
openImFriendPort: [ 10120 ]
|
||||||
openImMessagePort: [ 10130 ]
|
openImMessagePort: [ 10130 ]
|
||||||
@ -165,6 +170,7 @@ rpcPort:
|
|||||||
openImConversationPort: [ 10180 ]
|
openImConversationPort: [ 10180 ]
|
||||||
openImThirdPort: [ 10190 ]
|
openImThirdPort: [ 10190 ]
|
||||||
|
|
||||||
|
###################### RPC Register Name Configuration ######################
|
||||||
# RPC service names for registration, it's not recommended to modify these
|
# RPC service names for registration, it's not recommended to modify these
|
||||||
rpcRegisterName:
|
rpcRegisterName:
|
||||||
openImUserName: User
|
openImUserName: User
|
||||||
@ -177,6 +183,7 @@ rpcRegisterName:
|
|||||||
openImConversationName: Conversation
|
openImConversationName: Conversation
|
||||||
openImThirdName: Third
|
openImThirdName: Third
|
||||||
|
|
||||||
|
###################### Log Configuration ######################
|
||||||
# Log configuration
|
# Log configuration
|
||||||
#
|
#
|
||||||
# Storage directory
|
# Storage directory
|
||||||
@ -187,14 +194,15 @@ rpcRegisterName:
|
|||||||
# Whether to output in json format
|
# Whether to output in json format
|
||||||
# Whether to include stack trace in logs
|
# Whether to include stack trace in logs
|
||||||
log:
|
log:
|
||||||
storageLocation: ../../../../../logs/
|
storageLocation: /root/workspaces/openim/openim-server/logs/
|
||||||
rotationTime: 24
|
rotationTime: 24
|
||||||
remainRotationCount: 2
|
remainRotationCount: 2
|
||||||
remainLogLevel: 6
|
remainLogLevel: 6
|
||||||
isStdout: false
|
isStdout: false
|
||||||
isJson: false
|
isJson: false
|
||||||
withStack: false
|
withStack: false
|
||||||
|
|
||||||
|
###################### Variables definition ######################
|
||||||
# Long connection server configuration
|
# Long connection server configuration
|
||||||
#
|
#
|
||||||
# Websocket port for msg_gateway
|
# Websocket port for msg_gateway
|
||||||
@ -224,7 +232,7 @@ push:
|
|||||||
channelID: ""
|
channelID: ""
|
||||||
channelName: ""
|
channelName: ""
|
||||||
fcm:
|
fcm:
|
||||||
serviceAccount: "x.json"
|
serviceAccount: x.json
|
||||||
jpns:
|
jpns:
|
||||||
appKey:
|
appKey:
|
||||||
masterSecret:
|
masterSecret:
|
||||||
@ -236,8 +244,8 @@ push:
|
|||||||
# Built-in app manager user IDs
|
# Built-in app manager user IDs
|
||||||
# Built-in app manager nicknames
|
# Built-in app manager nicknames
|
||||||
manager:
|
manager:
|
||||||
userID: [ "openIM123456","openIM654321","openIMAdmin" ]
|
userID: [ "openIM123456", "openIM654321", "openIMAdmin" ]
|
||||||
nickname: [ "system1","system2", "system3" ]
|
nickname: [ "system1", "system2", "system3" ]
|
||||||
|
|
||||||
# Multi-platform login policy
|
# Multi-platform login policy
|
||||||
# For each platform(Android, iOS, Windows, Mac, web), only one can be online at a time
|
# For each platform(Android, iOS, Windows, Mac, web), only one can be online at a time
|
||||||
@ -291,6 +299,7 @@ iosPush:
|
|||||||
badgeCount: true
|
badgeCount: true
|
||||||
production: false
|
production: false
|
||||||
|
|
||||||
|
###################### Third-party service configuration ######################
|
||||||
# Callback configuration
|
# Callback configuration
|
||||||
#
|
#
|
||||||
# Callback URL
|
# Callback URL
|
||||||
@ -360,7 +369,7 @@ callback:
|
|||||||
failedContinue: true
|
failedContinue: true
|
||||||
|
|
||||||
###################### Prometheus ######################
|
###################### Prometheus ######################
|
||||||
# Prometheus configuration
|
# Prometheus configuration for various services
|
||||||
# The number of Prometheus ports per service needs to correspond to rpcPort
|
# The number of Prometheus ports per service needs to correspond to rpcPort
|
||||||
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||||
prometheus:
|
prometheus:
|
||||||
@ -375,4 +384,4 @@ prometheus:
|
|||||||
conversationPrometheusPort: [ 20230 ]
|
conversationPrometheusPort: [ 20230 ]
|
||||||
rtcPrometheusPort: [ 21300 ]
|
rtcPrometheusPort: [ 21300 ]
|
||||||
thirdPrometheusPort: [ 21301 ]
|
thirdPrometheusPort: [ 21301 ]
|
||||||
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ]
|
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # List of ports
|
||||||
|
|||||||
@ -53,7 +53,7 @@ scripts/
|
|||||||
│ └── pre-push # Script to run before each push
|
│ └── pre-push # Script to run before each push
|
||||||
├── init_pwd.sh # Script to initialize password
|
├── init_pwd.sh # Script to initialize password
|
||||||
├── install_im_compose.sh # Script to install IM with Docker Compose
|
├── install_im_compose.sh # Script to install IM with Docker Compose
|
||||||
├── install_im_server.sh # Script to install IM server
|
├── install-im-server.sh # Script to install IM server
|
||||||
├── lib # Library scripts
|
├── lib # Library scripts
|
||||||
│ ├── color.sh # Script for console color manipulation
|
│ ├── color.sh # Script for console color manipulation
|
||||||
│ ├── golang.sh # Script for golang related utility functions
|
│ ├── golang.sh # Script for golang related utility functions
|
||||||
|
|||||||
@ -14,13 +14,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Include shell font styles and some basic information
|
|
||||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
||||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
|
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||||
source "$SCRIPTS_ROOT/style_info.sh"
|
|
||||||
|
|
||||||
echo -e "${GREEN_PREFIX}=========> Check docker-compose status ${COLOR_SUFFIX} \n"
|
|
||||||
|
|
||||||
cd "$OPENIM_ROOT"
|
cd "$OPENIM_ROOT"
|
||||||
|
|
||||||
|
|||||||
@ -22,10 +22,10 @@ source "${OPENIM_ROOT}/scripts/install/common.sh"
|
|||||||
|
|
||||||
trap 'openim::util::onCtrlC' INT
|
trap 'openim::util::onCtrlC' INT
|
||||||
|
|
||||||
nohup ${OPENIM_ROOT}/scripts/start-all.sh > ${LOG_FILE} 2>&1 &
|
nohup ${OPENIM_ROOT}/scripts/start-all.sh >> ${LOG_FILE} 2>&1 &
|
||||||
|
|
||||||
sleep 15
|
sleep 15
|
||||||
|
|
||||||
nohup ${OPENIM_ROOT}/scripts/check-all.sh > ${LOG_FILE} 2>&1 &
|
nohup ${OPENIM_ROOT}/scripts/check-all.sh >> ${LOG_FILE} 2>&1 &
|
||||||
|
|
||||||
tail -f ${LOG_FILE}
|
tail -f ${LOG_FILE}
|
||||||
@ -1,85 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
|
|
||||||
# Common utilities, variables and checks for all build scripts.
|
|
||||||
set -o errexit
|
|
||||||
set -o nounset
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
#Include shell font styles and some basic information
|
|
||||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
||||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|
||||||
|
|
||||||
source $SCRIPTS_ROOT/style_info.sh
|
|
||||||
|
|
||||||
# docker-compose.yaml file name
|
|
||||||
docker_compose_file_name="docker-compose.yaml"
|
|
||||||
|
|
||||||
trap 'onCtrlC' INT
|
|
||||||
function onCtrlC () {
|
|
||||||
#Capture CTRL+C, terminate the background process of the program when the script is terminated in the form of ctrl+c
|
|
||||||
kill -9 ${do_sth_pid} ${progress_pid}
|
|
||||||
echo
|
|
||||||
echo 'Ctrl+C is captured'
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Load environment variables from .env file
|
|
||||||
source ${OPENIM_ROOT}/.env
|
|
||||||
|
|
||||||
# Get the public internet IP address
|
|
||||||
internet_ip=$(curl ifconfig.me -s)
|
|
||||||
echo -e "${PURPLE_PREFIX}=========> Your public internet IP address is ${internet_ip} ${COLOR_SUFFIX} \n"
|
|
||||||
|
|
||||||
# Replace local IP address with the public IP address in .env file
|
|
||||||
if [ $API_URL == "http://127.0.0.1:10002/object/" ]; then
|
|
||||||
sed -i "s/127.0.0.1/${internet_ip}/" ${OPENIM_ROOT}/.env
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then
|
|
||||||
sed -i "s/127.0.0.1/${internet_ip}/" ${OPENIM_ROOT}/.env
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo -e "${PURPLE_PREFIX}=========> Your minio endpoint is ${MINIO_ENDPOINT} ${COLOR_SUFFIX} \n"
|
|
||||||
|
|
||||||
# Change directory to scripts folder
|
|
||||||
|
|
||||||
chmod +x ${SCRIPTS_ROOT}/*.sh
|
|
||||||
|
|
||||||
# Execute necessary scripts
|
|
||||||
echo -e "${PURPLE_PREFIX}=========> init_pwd.sh ${COLOR_SUFFIX} \n"
|
|
||||||
|
|
||||||
${SCRIPTS_ROOT}/init_pwd.sh
|
|
||||||
|
|
||||||
echo -e "${PURPLE_PREFIX}=========> env_check.sh ${COLOR_SUFFIX} \n"
|
|
||||||
|
|
||||||
${SCRIPTS_ROOT}/env_check.sh
|
|
||||||
|
|
||||||
# Go back to the previous directory
|
|
||||||
cd ${OPENIM_ROOT}
|
|
||||||
|
|
||||||
# Check if docker-compose command is available
|
|
||||||
if command -v docker-compose &> /dev/null
|
|
||||||
then
|
|
||||||
docker-compose up -d
|
|
||||||
else
|
|
||||||
docker compose up -d
|
|
||||||
fi
|
|
||||||
|
|
||||||
${SCRIPTS_ROOT}/docker-check-service.sh
|
|
||||||
@ -156,7 +156,7 @@ go.build.%:
|
|||||||
.PHONY: go.install
|
.PHONY: go.install
|
||||||
go.install:
|
go.install:
|
||||||
@echo "===========> Installing deployment openim"
|
@echo "===========> Installing deployment openim"
|
||||||
@$(ROOT_DIR)/scripts/install_im_server.sh
|
@$(ROOT_DIR)/scripts/install-im-server.sh
|
||||||
|
|
||||||
## go.multiarch: Build multi-arch binaries
|
## go.multiarch: Build multi-arch binaries
|
||||||
.PHONY: go.build.multiarch
|
.PHONY: go.build.multiarch
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user