fix: images bug find tput in make demo (#918)

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

14
.env

@ -1,3 +1,17 @@
# 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
PASSWORD=openIM123
MINIO_ENDPOINT=http://127.0.0.1:10005

@ -1,6 +1,6 @@
# 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 obtain a copy of the License at
#
@ -13,7 +13,10 @@
# 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 ######################
@ -64,7 +67,7 @@ mongo:
password: openIM123
maxPoolSize: 100
###################### Redis ######################
###################### Redis configuration information ######################
# Redis configuration
#
# Username is required only for Redis version 6.0+
@ -73,7 +76,7 @@ redis:
username:
password: openIM123
###################### Kafka ######################
###################### Kafka configuration information ######################
# Kafka configuration
#
# Kafka username
@ -96,7 +99,7 @@ kafka:
msgToMySql: mysql
msgToPush: push
###################### RPC ######################
###################### RPC configuration information ######################
# RPC configuration
#
# IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway
@ -105,7 +108,7 @@ rpc:
registerIP:
listenIP: 0.0.0.0
###################### API ######################
###################### API configuration information ######################
# API configuration
#
# API service port
@ -114,7 +117,7 @@ api:
openImApiPort: [ 10002 ]
listenIP: 0.0.0.0
###################### Gateway ######################
###################### Object configuration information ######################
# Object storage configuration
#
# Use minio for object storage
@ -150,6 +153,7 @@ object:
accessKeySecret: ""
sessionToken: ""
###################### RPC Port Configuration ######################
# RPC service ports
# 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
@ -165,6 +169,7 @@ rpcPort:
openImConversationPort: [ 10180 ]
openImThirdPort: [ 10190 ]
###################### RPC Register Name Configuration ######################
# RPC service names for registration, it's not recommended to modify these
rpcRegisterName:
openImUserName: User
@ -177,6 +182,7 @@ rpcRegisterName:
openImConversationName: Conversation
openImThirdName: Third
###################### Log Configuration ######################
# Log configuration
#
# Storage directory
@ -195,6 +201,7 @@ log:
isJson: false
withStack: false
###################### Variables definition ######################
# Long connection server configuration
#
# Websocket port for msg_gateway
@ -291,6 +298,7 @@ iosPush:
badgeCount: true
production: false
###################### Third-party service configuration ######################
# Callback configuration
#
# Callback URL
@ -360,7 +368,7 @@ callback:
failedContinue: true
###################### Prometheus ######################
# Prometheus configuration
# Prometheus configuration for various services
# 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
prometheus:
@ -375,4 +383,4 @@ prometheus:
conversationPrometheusPort: [ 20230 ]
rtcPrometheusPort: [ 21300 ]
thirdPrometheusPort: [ 21301 ]
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ]
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # List of ports

@ -18,6 +18,7 @@
- [4. Stopping Services by Process Names](#4-stopping-services-by-process-names)
- [Function: `openim::util::stop_services_with_name`](#function-openimutilstop_services_with_name)
- [Example:](#example-3)
- [system management and installation of openim via Linux system](#system-management-and-installation-of-openim-via-linux-system)
- [examples](#examples)
@ -25,64 +26,92 @@ This document outlines the directory structure for scripts in the OpenIM Server
```bash
scripts/
├── LICENSE # License related files
│ ├── LICENSE # The license file
│ └── LICENSE_TEMPLATES # Template for license file
├── README.md # Readme file for scripts directory
├── advertise.sh # Script for advertisement services
├── batch_start-all.sh # Script to start all services in batch
├── build.cmd # Windows build command script
├── build-all-service.sh # Script to build all services
├── build_push_k8s_images.sh # Script to build and push images for Kubernetes
├── check-all.sh # Script to check status of all services
├── common.sh # Contains common functions used by other scripts
├── coverage.awk # AWK script for coverage report generation
├── coverage.sh # Script for generating coverage reports
├── docker-check-service.sh # Docker specific service check script
├── docker-start-all-all.sh # Script to start all services in a docker environment
├── ensure_tag.sh # Script to ensure proper tagging of docker images
├── enterprise # Scripts specific to enterprise version
│ ├── check-all.sh # Check status of all enterprise services
│ ├── function.sh # Functions specific to enterprise version
│ └── path_info.cfg # Path information configuration for enterprise version
├── env_check.sh # Script to check the environment
├── function.sh # Contains functions used by other scripts
├── githooks # Git hook scripts
│ ├── commit-msg # Script to validate commit message
│ ├── pre-commit # Script to run before each commit
│ └── pre-push # Script to run before each push
├── init_pwd.sh # Script to initialize password
├── install_im_compose.sh # Script to install IM with Docker Compose
├── install-im-server.sh # Script to install IM server
├── lib # Library scripts
│ ├── color.sh # Script for console color manipulation
│ ├── golang.sh # Script for golang related utility functions
│ ├── init.sh # Script for initialization tasks
│ ├── logging.sh # Script for logging related utility functions
│ ├── release.sh # Script for release related utility functions
│ ├── util.sh # Script for generic utility functions
│ └── version.sh # Script for versioning related tasks
├── make-rules # Makefile rules
│ ├── common.mk # Common Make rules
│ ├── copyright.mk # Copyright related Make rules
│ ├── dependencies.mk # Dependencies related Make rules
│ ├── gen.mk # Make rules for code generation
│ ├── golang.mk # Golang specific Make rules
│ ├── image.mk # Make rules for image building
│ ├── release.mk # Make rules for release process
│ ├── swagger.mk # Make rules for swagger documentation
│ └── tools.mk # Make rules for tools and utilities
├── mongo-init.sh # Script to initialize MongoDB
├── openim-msggateway.sh # Script to start message gateway service
├── openim-msgtransfer.sh # Script to start message transfer service
├── path_info.sh # Script containing path information
├── openim-push.sh # Script to start push service
├── release.sh # Script to perform release process
├── start-all.sh # Script to start all services
├── openim-crontask.sh # Script to start cron jobs
├── openim-rpc.sh # Script to start RPC service
├── stop-all.sh # Script to stop all services
└── style_info.sh # Script containing style related information
├── README.md # Documentation for the scripts directory.
├── advertise.sh # Script to advertise or broadcast services.
├── batch_start_all.sh # Batch script to start all services.
├── build-all-service.sh # Script to build all services.
├── build.cmd # Command script for building (usually for Windows).
├── check-all.sh # Check script for all components or services.
├── cherry-pick.sh # Helper script for git cherry-pick operations.
├── common.sh # Common utilities and shared functions.
├── coverage.awk # AWK script for processing code coverage data.
├── coverage.sh # Script to gather and report code coverage.
├── demo.sh # Demonstration or example script.
├── docker-check-service.sh # Docker script to check services' status.
├── docker-start-all.sh # Docker script to start all containers/services.
├── ensure_tag.sh # Ensure correct tags or labeling.
├── env_check.sh # Environment verification and checking.
├── gen-swagger-docs.sh # Script to generate Swagger documentation.
├── genconfig.sh # Generate configuration files.
├── gendoc.sh # General documentation generation script.
├── githooks # Directory containing git hooks.
│ ├── commit-msg # Git hook for commit messages.
│ ├── pre-commit # Pre-commit git hook.
│ └── pre-push # Pre-push git hook.
├── golangci.yml # Configuration for GolangCI linting.
├── init-config.sh # Initialize configurations.
├── init-env.sh # Initialize the environment.
├── init_pwd.sh # Initialize or set password.
├── install # Installation scripts directory.
│ ├── README.md # Installation documentation.
│ ├── common.sh # Common utilities for installation.
│ ├── dependency.sh # Script to install dependencies.
│ ├── environment.sh # Set up the environment during installation.
│ ├── install-protobuf.sh # Install Protocol Buffers.
│ ├── install.sh # Main installation script.
│ ├── openim-api.sh # Install OpenIM API.
│ ├── openim-crontask.sh # Install OpenIM crontask.
│ ├── openim-man.sh # Install OpenIM management tool.
│ ├── openim-msggateway.sh # Install OpenIM message gateway.
│ ├── openim-msgtransfer.sh # Install OpenIM message transfer.
│ ├── openim-push.sh # Install OpenIM push service.
│ ├── openim-rpc.sh # Install OpenIM RPC.
│ ├── openim-tools.sh # Install OpenIM tools.
│ ├── test.sh # Installation testing script.
│ └── vimrc # Vim configuration file.
├── install-im-server.sh # Script to install the OpenIM server.
├── install_im_compose.sh # Install OpenIM using Docker Compose.
├── lib # Library or utility scripts directory.
│ ├── chat.sh # Utilities related to chat.
│ ├── color.sh # Color-related utilities.
│ ├── golang.sh # Golang utilities.
│ ├── init.sh # Initialization utilities.
│ ├── logging.sh # Logging utilities.
│ ├── release.sh # Release related utilities.
│ ├── util.sh # General utility functions.
│ └── version.sh # Version management utilities.
├── list-feature-tests.sh # Script to list feature tests.
├── make-rules # Makefile rule templates.
│ ├── common.mk # Common make rules.
│ ├── copyright.mk # Copyright related make rules.
│ ├── dependencies.mk # Dependency management rules.
│ ├── gen.mk # Generic or general rules.
│ ├── golang.mk # Golang-specific make rules.
│ ├── image.mk # Image or container-related rules.
│ ├── release.mk # Release specific rules.
│ ├── swagger.mk # Swagger documentation rules.
│ └── tools.mk # Tooling-related make rules.
├── mongo-init.sh # MongoDB initialization script.
├── release.sh # Script for releasing or deployment.
├── run-in-gopath.sh # Script to run commands within GOPATH.
├── start-all.sh # Script to start all services.
├── start.bat # Batch file to start services (usually for Windows).
├── stop-all.sh # Script to stop all services.
├── template # Directory containing template files.
│ ├── LICENSE # License template.
│ ├── LICENSE_TEMPLATES # Collection of license templates.
│ ├── boilerplate.txt # Boilerplate template.
│ ├── footer.md.tmpl # Footer template for markdown.
│ ├── head.md.tmpl # Header template for markdown.
│ └── project_README.md # Project README template.
├── update-generated-docs.sh # Update generated documentation.
├── update-yamlfmt.sh # Update YAML formatting.
├── verify-pkg-names.sh # Verify package names.
├── verify-shellcheck.sh # Shell script linting verification.
├── verify-spelling.sh # Spelling verification script.
├── verify-typecheck.sh # Type checking verification.
├── verify-yamlfmt.sh # Verify YAML format.
└── wait-for-it.sh # Script to wait for a condition or service to be ready.
```
The purpose of having a structured scripts directory like this is to make the operations of OpenIM Server clear and easy to manage. Each script has its own responsibility, making it easier to maintain and update. It's also helpful for newcomers who can easily understand what each part of the system is doing by just looking at this directory structure.
@ -120,7 +149,7 @@ Is the `demo.sh` script teaching you how to quickly get started with OpenIM deve
Steps to run demo:
```sh
make demo
$ make demo
```
More about `make` read:
@ -168,7 +197,7 @@ This function checks the status of services running on specified ports.
**Usage**:
```bash
openim::util::check_ports <port1> <port2> ...
$ openim::util::check_ports <port1> <port2> ...
```
**Design**:
@ -182,7 +211,7 @@ openim::util::check_ports <port1> <port2> ...
#### Example:
```bash
openim::util::check_ports 8080 8081 8082
$ openim::util::check_ports 8080 8081 8082
```
### 2. Checking the Status of Services by Process Names
@ -194,7 +223,7 @@ This function checks the status of services based on their process names.
**Usage**:
```bash
openim::util::check_process_names <process_name1> <process_name2> ...
$ openim::util::check_process_names <process_name1> <process_name2> ...
```
**Design**:
@ -207,7 +236,7 @@ openim::util::check_process_names <process_name1> <process_name2> ...
#### Example:
```bash
openim::util::check_process_names nginx mysql redis
$ openim::util::check_process_names nginx mysql redis
```
### 3. Stopping Services by Ports
@ -219,7 +248,7 @@ This function attempts to stop services running on the specified ports.
**Usage**:
```bash
openim::util::stop_services_on_ports <port1> <port2> ...
$ openim::util::stop_services_on_ports <port1> <port2> ...
```
**Design**:
@ -232,7 +261,7 @@ openim::util::stop_services_on_ports <port1> <port2> ...
#### Example:
```bash
openim::util::stop_services_on_ports 8080 8081 8082
$ openim::util::stop_services_on_ports 8080 8081 8082
```
### 4. Stopping Services by Process Names
@ -244,7 +273,7 @@ This function attempts to stop services based on their process names.
**Usage**:
```bash
openim::util::stop_services_with_name <process_name1> <process_name2> ...
$ openim::util::stop_services_with_name <process_name1> <process_name2> ...
```
**Design**:
@ -257,9 +286,14 @@ openim::util::stop_services_with_name <process_name1> <process_name2> ...
#### Example:
```bash
openim::util::stop_services_with_name nginx apache
$ openim::util::stop_services_with_name nginx apache
```
### system management and installation of openim via Linux system
```bash
$ ./scripts/install/install.sh
```
## examples
Scripts to perform various build, install, analysis, etc operations.

@ -13,46 +13,83 @@
# See the License for the specific language governing permissions and
# limitations under the License.
readonly t_reset=$(tput sgr0)
readonly green=$(tput bold; tput setaf 2)
readonly yellow=$(tput bold; tput setaf 3)
readonly blue=$(tput bold; tput setaf 6)
readonly timeout=$(if [ "$(uname)" == "Darwin" ]; then echo "1"; else echo "0.1"; fi)
readonly ipv6regex='(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))'
clear
. $(dirname ${BASH_SOURCE})/lib/util.sh
trap 'openim::util::onCtrlC' INT
openim::util::desc "========> Welcome to the OpenIM Demo"
openim::util::desc "========> We'll help you get started with OpenIM quickly"
openim::util::desc "========> Press Enter to continue...."
openim::util::run "make advertise"
function openim::util::onCtrlC() {
echo -e "\n${t_reset}Ctrl+C Press it. It's exiting openim make init..."
exit 0
}
# openim::util::desc "========> Welcome to the OpenIM Demo"
# openim::util::desc "========> We'll help you get started with OpenIM quickly"
# openim::util::desc "========> Press Enter to continue...."
# openim::util::run "make advertise"
# clear
# openim::util::desc "========> Initialize the project and generate configuration files"
# openim::util::run "make init"
# openim::util::desc "========> You can look git diff"
# openim::util::run "git diff"
# clear
# openim::util::desc "You can learn a lot about automation using make help"
# openim::util::run "make help"
# clear
# openim::util::desc "You can learn a lot about automation using make help-all"
# openim::util::run "make help-all"
# clear
# openim::util::desc "First, let's verify and install some necessary tools"
# openim::util::run "make tools"
# clear
# openim::util::desc "The specification is pretty high, you need to be bound on your branch name, as well as commit messages"
# openim::util::run "git commit -a -s -m 'feta: commit demo against specification'"
# openim::util::run "# git commit -a -s -m 'feat: commit demo against specification' --amend"
# clear
# openim::util::desc "How did we teach you how to build OpenIM"
# openim::util::desc "A full build startup check"
# openim::util::run "# make all"
# clear
# openim::util::desc "Build one OpenIM binary"
# openim::util::desc "BINS: openim-api openim-cmdutils openim-crontask openim-msggateway openim-msgtransfer openim-push openim-rpc changelog infra ncpu yamlfmt"
# openim::util::run "make build BINS=openim-api"
# openim::util::desc "Build binaries for all platforms"
# openim::util::run "make multiarch -j BINS=openim-crontask PLATFORMS='linux_arm64 linux_amd64' "
# openim::util::desc "If you wish to use dlv for debugging, either binary or process"
# openim::util::desc "You need to enable debug mode"
# openim::util::run "make build BINS=openim-cmdutils DEBUG=1"
# clear
openim::util::desc "Next, let's learn how to start the OpenIM service. For starting, we have two ways"
openim::util::desc "The first is Background startup"
openim::util::run "make start"
openim::util::desc "The second way is through the Linux system way"
openim::util::run "./scripts/install/install.sh --help"
clear
openim::util::desc "========> Initialize the project and generate configuration files"
openim::util::run "make init"
openim::util::desc "========> You can look git diff"
openim::util::run "git diff"
openim::util::desc "Next, let's learn how to check the OpenIM service. For checking, we have two ways"
openim::util::run "make check"
clear
openim::util::desc "You can learn a lot about automation using make help"
openim::util::run "make help"
clear
openim::util::desc "You can learn a lot about automation using make help-all"
openim::util::run "make help-all"
clear
openim::util::desc "How did we teach you how to build OpenIM"
openim::util::desc "A full build startup check"
openim::util::run "make all"
openim::util::desc "Build one OpenIM binary"
openim::util::desc "BINS: openim-api openim-cmdutils openim-crontask openim-msggateway openim-msgtransfer openim-push openim-rpc changelog infra ncpu yamlfmt"
openim::util::run "make build BINS=openim-api"
openim::util::desc "Build binaries for all platforms"
openim::util::run "make multiarch -j BINS=openim-api PLATFORMS='linux_arm64 linux_amd64' "
openim::util::desc "If you wish to use dlv for debugging, either binary or process"
openim::util::desc "You need to enable debug mode"
openim::util::run "make build BINS=openim-api DEBUG=1"
openim::util::desc "Next, let's learn how to stop the OpenIM service. For stopping, we have two ways"
openim::util::run "make stop"
clear
openim::util::desc "Run tidy to format and fix imports"
@ -60,22 +97,22 @@ openim::util::run "make tidy"
clear
openim::util::desc "Vendor go.mod dependencies"
openim::util::run "make vendor"
openim::util::run "# make vendor"
clear
openim::util::desc "Run unit tests"
openim::util::run "make test"
openim::util::run "# make test"
clear
openim::util::desc "Run unit tests and get test coverage"
openim::util::run "make cover"
openim::util::run "# make cover"
clear
openim::util::desc "Check for updates to go.mod dependencies"
openim::util::run "make updates"
openim::util::run "# make updates"
clear
openim::util::desc "Clean all generated files"
openim::util::desc "You can learn a lot about automation using make clean, remove all files that are created by building"
openim::util::run "make clean"
clear

@ -69,17 +69,6 @@ UNDERLINE_PREFIX="\033[4m" # Underline prefix
ITALIC_PREFIX="\033[3m" # Italic prefix
CYAN_PREFIX="\033[0;36m" # Cyan prefix
# --- make demo (run demo) ---
reset=$(tput sgr0)
bold=$(tput bold)
black=$(tput setaf 0)
red=$(tput setaf 1)
green=$(tput bold; tput setaf 2)
yellow=$(tput bold; tput setaf 3)
blue=$(tput bold; tput setaf 6)
timeout=$(if [ "$(uname)" == "Darwin" ]; then echo "1"; else echo "0.1"; fi)
# Print colors you can use
openim::color::print_color()
{

Loading…
Cancel
Save