diff --git a/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..15fe98c2c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md @@ -0,0 +1,37 @@ +--- +name: 🐞 Bug +about: File a bug/issue +title: '[BUG] ' +labels: Bug, Needs Triage +assignees: '' + +--- + +<!-- +Note: Please search to see if an issue already exists for the bug you encountered. +--> + +### Environment: +<!-- linux? windows? or Mac? +Example: +- OS: Ubuntu 20.04 --> + +### Physical Memory Capacity: +<!-- 8G or above is better --> + +### Docker Image: +<!-- Did you pull the docker image before execute docker images --> + +### Code Version: +<!-- Did you pull code from github? Make sure the code is up to date--> + +### Component installation: +<!-- Has etcd, mysql, mongodb, redis or Kafka been installed on the server before Open-IM-Server deployment--> + + +### Log File: +<!-- view log file(logs/openIM.log) content. --> + + +### screenshot: +<!----> \ No newline at end of file diff --git a/.gitignore b/.gitignore index 532c7da35..3d19cc7b8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ logs components logs out-test -.github + diff --git a/README.md b/README.md index ad3aa2129..4964bacb5 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server 4. Start docker-compose with one click(Docker automatically pulls all images) ``` + cd Open-IM-Server docker-compose up -d ``` @@ -99,6 +100,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server ``` ./docker_check_service.sh + ./check_all.sh ``` ![OpenIMServersondockerpng](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/Open-IM-Servers-on-docker.png) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1d64dcd9f..7e58df7af 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,7 +5,8 @@ services: mysql: image: mysql:5.7 ports: - - 3306:3306 + - 13306:3306 + - 23306:33060 container_name: mysql volumes: - ./components/mysql/data:/var/lib/mysql @@ -17,18 +18,23 @@ services: mongodb: image: mongo:4.0 ports: - - 27017:27017 + - 37017:27017 container_name: mongo volumes: - - ./components/mongodb/data:/data/db - environment: - TZ: Asia/Shanghai + - ./components/mongodb/data/db:/data/db + - ./components/mongodb/data/logs:/data/logs + - ./components/mongodb/data/conf:/etc/mongo + # environment: + # - MONGO_INITDB_ROOT_USERNAME=openIM + # - MONGO_INITDB_ROOT_PASSWORD=openIM + + #TZ: Asia/Shanghai restart: always redis: image: redis ports: - - 6379:6379 + - 16379:6379 container_name: redis volumes: - ./components/redis/data:/data @@ -82,38 +88,15 @@ services: restart: always command: /usr/local/bin/etcd --name etcd0 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster etcd0=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new - - #fixme-----build from dockerfile--------- - # open-im-server: - # image: open_im_server - # container_name: open-im-server - # volumes: - # - ./logs:/Open-IM-Server/logs - # - ./config/config.yaml:/Open-IM-Server/config/config.yaml - # restart: always - # build: - # context: . - # dockerfile: deploy.Dockerfile - # depends_on: - # - mysql - # - mongodb - # - redis - # - kafka - # - etcd - # network_mode: "host" - # logging: - # driver: json-file - # options: - # max-size: "1g" - # max-file: "2" - - #fixme----build from docker hub------ - open-im-server: - image: lyt1123/open_im_server - container_name: open-im-server + open_im_server: + image: openim/open_im_server:v1.0.5 + container_name: open_im_server volumes: - ./logs:/Open-IM-Server/logs - ./config/config.yaml:/Open-IM-Server/config/config.yaml + - ./db/sdk:/Open-IM-Server/db/sdk + - ./script:/Open-IM-Server/script + restart: always depends_on: - kafka diff --git a/script/build_image.sh b/script/build_image.sh new file mode 100644 index 000000000..ad37e24e4 --- /dev/null +++ b/script/build_image.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +image=openim/open_im_server:v1.0.5 +rm Open-IM-Server -rf +git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive +cd Open-IM-Server +git checkout tuoyun +cd cmd/Open-IM-SDK-Core/ +git checkout tuoyun +cd ../../ +docker build -t $image . -f deploy.Dockerfile +docker push $image \ No newline at end of file diff --git a/script/docker_check_service.sh b/script/docker_check_service.sh index e380cb3fb..3484c458d 100644 --- a/script/docker_check_service.sh +++ b/script/docker_check_service.sh @@ -1,33 +1,9 @@ #!/usr/bin/env bash +echo "docker-compose ps..........................." +docker-compose ps -source ./style_info.cfg +sleep 20 -docker_compose_components=( - etcd - mongo - mysql - open-im-server - redis - kafka - zookeeper -) +echo "check OpenIM................................." +./check_all.sh -component_server_count=0 - -for ((i = 0; i < ${#docker_compose_components[*]}; i++)); do - component_server="docker-compose ps|grep -w ${docker_compose_components[$i]}|grep Up" - count="${component_server}|wc -l" - - if [ $(eval ${count}) -gt 0 ]; then - echo -e "${SKY_BLUE_PREFIX}docker-compose ${docker_compose_components[$i]} is Up!${COLOR_SUFFIX}" - let component_server_count+=1 - else - echo -e "${RED_PREFIX} ${docker_compose_components[$i]} start failed!${COLOR_SUFFIX}" - fi -done - -if [ ${component_server_count} -eq 7 ]; then - echo -e "${YELLOW_PREFIX}\ndocker-compose all services is Up!${COLOR_SUFFIX}" -else - echo -e "${RED_PREFIX}\nsome docker-compose services start failed,please check red logs on console ${COLOR_SUFFIX}" -fi diff --git a/script/docker_start_all.sh b/script/docker_start_all.sh index 839a46688..f1a1fd859 100644 --- a/script/docker_start_all.sh +++ b/script/docker_start_all.sh @@ -1,24 +1,11 @@ #!/usr/bin/env bash -#fixme This script is the total startup script -#fixme The full name of the shell script that needs to be started is placed in the need_to_start_server_shell array - -#fixme Put the shell script name here -need_to_start_server_shell=( - start_rpc_service.sh - msg_gateway_start.sh - push_start.sh - msg_transfer_start.sh - sdk_svr_start.sh - timer_start.sh -) #fixme The 10 second delay to start the project is for the docker-compose one-click to start openIM when the infrastructure dependencies are not started sleep 10 -for i in ${need_to_start_server_shell[*]}; do - chmod +x $i - ./$i -done +./start_all.sh + +sleep 15 #fixme prevents the openIM service exit after execution in the docker container tail -f /dev/null diff --git a/script/env_check.sh b/script/env_check.sh new file mode 100644 index 000000000..6af30a37b --- /dev/null +++ b/script/env_check.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +source ./style_info.cfg +echo -e "check environment......................................." + +SYSTEM=`uname -s` +if [ $SYSTEM != "Linux" ] ; then + echo -e ${RED_PREFIX}"Warning: Currently only Linux is supported"${COLOR_SUFFIX} +else + echo -e ${GREEN_PREFIX} "Linux system is ok"${COLOR_SUFFIX} +fi + +echo -e "check memory............................................" +available=`free -m | grep Mem | awk '{print $NF}'` +if [ $available -lt 2000 ] ; then + echo -e ${RED_PREFIX}"Warning: Your memory not enough, available is: " "$available"m${COLOR_SUFFIX}"\c" + echo -e ${RED_PREFIX}", must be greater than 2000m"${COLOR_SUFFIX} +else + echo -e ${GREEN_PREFIX} "Memory is ok, available is: "$available"m${COLOR_SUFFIX}" +fi + diff --git a/script/start_rpc_service.sh b/script/start_rpc_service.sh index 9491a4fe8..5b59107d5 100644 --- a/script/start_rpc_service.sh +++ b/script/start_rpc_service.sh @@ -53,6 +53,6 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do nohup ./${service_filename[$i]} -port $j >>../logs/openIM.log 2>&1 & sleep 1 pid="netstat -ntlp|grep $j |awk '{printf \$7}'|cut -d/ -f1" - echo -e "${RED_PREFIX}${service_filename[$i]} Service is started,port number:$j pid:$(eval $pid)$COLOR_SUFFIX" + # echo -e "${RED_PREFIX}${service_filename[$i]} Service is started,port number:$j pid:$(eval $pid)$COLOR_SUFFIX" done done