feat: add config and images log

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
pull/825/head
Xinwei Xiong(cubxxw-openim) 2 years ago
parent 810b1ccbb3
commit 7327f11794
No known key found for this signature in database
GPG Key ID: 1BAD6F395338EFDE

@ -0,0 +1,87 @@
# Version logging for OpenIM
<!-- BEGIN MUNGE: GENERATED_TOC -->
- [Version logging for OpenIM](#version-logging-for-openim)
- [Unreleased](#unreleased)
- [v3.1.2-beta.3 - 2023-08-09](#v312-beta3---2023-08-09)
- [v3.1.2-beta.2 - 2023-08-09](#v312-beta2---2023-08-09)
- [v3.1.2-beta.1 - 2023-08-09](#v312-beta1---2023-08-09)
- [v3.1.2-beta.0 - 2023-08-08](#v312-beta0---2023-08-08)
- [v3.1.2.beta.0 - 2023-08-08](#v312beta0---2023-08-08)
- [v3.1.1-beta.4 - 2023-08-07](#v311-beta4---2023-08-07)
- [v3.1.1-beta.3 - 2023-08-05](#v311-beta3---2023-08-05)
- [v3.1.1-beta.2 - 2023-08-04](#v311-beta2---2023-08-04)
- [v3.1.1-beta.1 - 2023-08-04](#v311-beta1---2023-08-04)
- [v3.1.1-alpha.3 - 2023-08-03](#v311-alpha3---2023-08-03)
- [v3.1.1-alpha.2 - 2023-08-03](#v311-alpha2---2023-08-03)
- [v3.1.1-alpha.1 - 2023-08-02](#v311-alpha1---2023-08-02)
- [v3.1.0 - 2023-07-28](#v310---2023-07-28)
- [Reverts](#reverts)
- [Pull Requests](#pull-requests)
<!-- END MUNGE: GENERATED_TOC -->
<a name="unreleased"></a>
## [Unreleased]
<a name="v3.1.2-beta.3"></a>
## [v3.1.2-beta.3] - 2023-08-09
<a name="v3.1.2-beta.2"></a>
## [v3.1.2-beta.2] - 2023-08-09
<a name="v3.1.2-beta.1"></a>
## [v3.1.2-beta.1] - 2023-08-09
<a name="v3.1.2-beta.0"></a>
## [v3.1.2-beta.0] - 2023-08-08
<a name="v3.1.2.beta.0"></a>
## [v3.1.2.beta.0] - 2023-08-08
<a name="v3.1.1-beta.4"></a>
## [v3.1.1-beta.4] - 2023-08-07
<a name="v3.1.1-beta.3"></a>
## [v3.1.1-beta.3] - 2023-08-05
<a name="v3.1.1-beta.2"></a>
## [v3.1.1-beta.2] - 2023-08-04
<a name="v3.1.1-beta.1"></a>
## [v3.1.1-beta.1] - 2023-08-04
<a name="v3.1.1-alpha.3"></a>
## [v3.1.1-alpha.3] - 2023-08-03
<a name="v3.1.1-alpha.2"></a>
## [v3.1.1-alpha.2] - 2023-08-03
<a name="v3.1.1-alpha.1"></a>
## [v3.1.1-alpha.1] - 2023-08-02
<a name="v3.1.0"></a>
## v3.1.0 - 2023-07-28
### Reverts
- update etcd to v3.5.2 ([#206](https://github.com/OpenIMSDK/Open-IM-Server/issues/206))
### Pull Requests
- Merge branch 'tuoyun'
[Unreleased]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.2-beta.3...HEAD
[v3.1.2-beta.3]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.2-beta.2...v3.1.2-beta.3
[v3.1.2-beta.2]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.2-beta.1...v3.1.2-beta.2
[v3.1.2-beta.1]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.2-beta.0...v3.1.2-beta.1
[v3.1.2-beta.0]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.2.beta.0...v3.1.2-beta.0
[v3.1.2.beta.0]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-beta.4...v3.1.2.beta.0
[v3.1.1-beta.4]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-beta.3...v3.1.1-beta.4
[v3.1.1-beta.3]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-beta.2...v3.1.1-beta.3
[v3.1.1-beta.2]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-beta.1...v3.1.1-beta.2
[v3.1.1-beta.1]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-alpha.3...v3.1.1-beta.1
[v3.1.1-alpha.3]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-alpha.2...v3.1.1-alpha.3
[v3.1.1-alpha.2]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-alpha.1...v3.1.1-alpha.2
[v3.1.1-alpha.1]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.0...v3.1.1-alpha.1

@ -3,6 +3,8 @@
- [Changelog](#changelog)
- [OpenIM versioning policy](#openim-versioning-policy)
- [command](#command)
- [install](#install)
- [User](#user)
- [create next tag](#create-next-tag)
- [Release version logs](#release-version-logs)
- [Introduction](#introduction)
@ -22,10 +24,68 @@ All notable changes to this project will be documented in this file.
## command
To use git-chglog you need to configure:
1. CHANGELOG templates
2. git-chglog configuration
### install
```bash
$ go get github.com/git-chglog/git-chglog/cmd/git-chglog
```
## User
```bash
$ git-chglog --init
```
**Options**
- What is the URL of your repository?: https://github.com/marmotedu/iam
- What is your favorite style?: github
- Choose the format of your favorite commit message: <type>(<scope>): <subject> -- feat(core): Add new feature
- What is your favorite template style?: standard
- Do you include Merge Commit in CHANGELOG?: n
- Do you include Revert Commit in CHANGELOG?: y
- In which directory do you output configuration files and templates?: .chglog
```bash
git-chglog --tag-filter-pattern 'v2.0.*' -o CHANGELOG-2.0.md
```
**Other uses:**
```bash
$ git-chglog
If <tag query> is not specified, it corresponds to all tags.
This is the simplest example.
$ git-chglog 1.0.0..2.0.0
The above is a command to generate CHANGELOG including commit of 1.0.0 to 2.0.0.
$ git-chglog 1.0.0
The above is a command to generate CHANGELOG including commit of only 1.0.0.
$ git-chglog $(git describe --tags $(git rev-list --tags --max-count=1))
The above is a command to generate CHANGELOG with the commit included in the latest tag.
$ git-chglog --output CHANGELOG.md
The above is a command to output to CHANGELOG.md instead of standard output.
$ git-chglog --config custom/dir/config.yml
The above is a command that uses a configuration file placed other than ".chglog/config.yml".
```
## create next tag
```bash
@ -51,6 +111,7 @@ git tag 2.0.0
+ [OpenIM CHANGELOG-V2.3](CHANGELOG-2.3.md)
+ [OpenIM CHANGELOG-V2.9](CHANGELOG-2.9.md)
+ [OpenIM CHANGELOG-V3.0](CHANGELOG-3.0.md)
+ [OpenIM CHANGELOG-V3.1](CHANGELOG-3.1.md)
## Introduction

@ -12,7 +12,6 @@ OpenIM 支持很多种集群化部署方式,包括但不限于 helm, sealos, k
- https://github.com/showurl/deploy-openim
### 依赖检查
```bash

@ -64,12 +64,11 @@ cmd/*
# config directory
config/* @skiffer-git
# db directory
db/sdk @cubxxw @FGadvancer
# internal directory
internal/ @openimsdk/openim @skiffer-git @FGadvancer
tools @openimsdk/openim @openimsdk/bot @cubxxw @skiffer-git @FGadvancer
# logs directory
logs/* @skiffer-git @FGadvancer

@ -13,44 +13,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set -o pipefail
. $(dirname ${BASH_SOURCE})/lib/init.sh
trap 'echo "Script interrupted."; exit 1' INT
. $(dirname ${BASH_SOURCE})/lib/color.sh
# Function for colored echo
function color_echo() {
COLOR=$1
shift
echo -e "${COLOR}===> $* ${COLOR_SUFFIX}"
}
trap 'openim::color::echo RED_PREFIX "Script interrupted."; exit 1' INT
function print_with_delay() {
print_with_delay() {
text="$1"
delay="$2"
color="$3"
for i in $(seq 0 $((${#text}-1))); do
printf "${color}${text:$i:1}${COLOR_SUFFIX}"
printf "${text:$i:1}"
sleep $delay
done
printf "\n"
}
function print_progress() {
print_progress() {
total="$1"
delay="$2"
color="$3"
printf "${color}["
printf "["
for i in $(seq 1 $total); do
printf "#"
sleep $delay
done
printf "]${COLOR_SUFFIX}\n"
printf "]\n"
}
function openim_logo() {

@ -37,7 +37,8 @@ readonly DOCKER_MACHINE_DRIVER=${DOCKER_MACHINE_DRIVER:-"virtualbox --virtualbox
# This will canonicalize the path
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd -P)
source "${OPENIM_ROOT}/scripts/lib/init.sh"
# Please do not refer to lib after referring to common
. $(dirname ${BASH_SOURCE})/lib/init.sh
# Constants
readonly OPENIM_BUILD_IMAGE_REPO=openim-build

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
# Use of this source code is governed by a MIT style
# license that can be found in the LICENSE file.
# Common utilities, variables and checks for all build scripts.
set -o errexit
set +o nounset
set -o pipefail
# Sourced flag
COMMON_SOURCED=true
# The root of the build/dist directory
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
source "${OPENIM_ROOT}/scripts/lib/init.sh"
source "${OPENIM_ROOT}/scripts/install/environment.sh"
# Execute commands that require root permission without entering a password
function openim::common::sudo {
echo ${LINUX_PASSWORD} | sudo -S $1
}

@ -5,10 +5,10 @@
# license that can be found in the LICENSE file.
# OPENIM 项目源码根目录
IAM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
# 生成文件存放目录
LOCAL_OUTPUT_ROOT="${IAM_ROOT}/${OUT_DIR:-_output}"
LOCAL_OUTPUT_ROOT="${OPENIM_ROOT}/${OUT_DIR:-_output}"
# 设置统一的密码,方便记忆
readonly PASSWORD=${PASSWORD:-'iam59!z$'}
@ -21,7 +21,7 @@ readonly LINUX_PASSWORD=${LINUX_PASSWORD:-${PASSWORD}}
# 设置安装目录
readonly INSTALL_DIR=${INSTALL_DIR:-/tmp/installation}
mkdir -p ${INSTALL_DIR}
readonly ENV_FILE=${IAM_ROOT}/scripts/install/environment.sh
readonly ENV_FILE=${OPENIM_ROOT}/scripts/install/environment.sh
# MariaDB 配置信息
readonly MARIADB_ADMIN_USERNAME=${MARIADB_ADMIN_USERNAME:-root} # MariaDB root 用户

@ -19,6 +19,18 @@
# Usage: `scripts/color.sh`.
################################################################################
# shellcheck disable=SC2034
if [[ ! -v COLOR_OPEN ]]; then
COLOR_OPEN=1
fi
# Function for colored echo
openim::color::echo() {
COLOR=$1
[ $COLOR_OPEN -eq 1 ] && echo -e "${COLOR} $(date '+%Y-%m-%d %H:%M:%S') $@ ${COLOR_SUFFIX}"
shift
}
# Define color variables
# --- Feature ---
COLOR_NORMAL='\033[0m';COLOR_BOLD='\033[1m';COLOR_DIM='\033[2m';COLOR_UNDER='\033[4m';
@ -36,6 +48,21 @@ COLOR_BGREEN='\033[42m';COLOR_BYELLOW='\033[43m';
COLOR_BBLUE='\033[44m';COLOR_BMAGENTA='\033[45m';
COLOR_BCYAN='\033[46m';COLOR_BWHITE='\033[47m';
# --- Color definitions ---
# Color definitions
COLOR_SUFFIX="\033[0m" # End all colors and special effects
BLACK_PREFIX="\033[30m" # Black prefix
RED_PREFIX="\033[31m" # Red prefix
GREEN_PREFIX="\033[32m" # Green prefix
YELLOW_PREFIX="\033[33m" # Yellow prefix
BLUE_PREFIX="\033[34m" # Blue prefix
SKY_BLUE_PREFIX="\033[36m" # Sky blue prefix
WHITE_PREFIX="\033[37m" # White prefix
BOLD_PREFIX="\033[1m" # Bold prefix
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)
@ -46,51 +73,6 @@ yellow=$(tput bold; tput setaf 3)
blue=$(tput bold; tput setaf 6)
timeout=$(if [ "$(uname)" == "Darwin" ]; then echo "1"; else echo "0.1"; fi)
# --- Color definitions ---
# Color definitions
function openim_color() {
COLOR_SUFFIX="\033[0m" # End all colors and special effects
BLACK_PREFIX="\033[30m" # Black prefix
RED_PREFIX="\033[31m" # Red prefix
GREEN_PREFIX="\033[32m" # Green prefix
YELLOW_PREFIX="\033[33m" # Yellow prefix
BLUE_PREFIX="\033[34m" # Blue prefix
SKY_BLUE_PREFIX="\033[36m" # Sky blue prefix
WHITE_PREFIX="\033[37m" # White prefix
BOLD_PREFIX="\033[1m" # Bold prefix
UNDERLINE_PREFIX="\033[4m" # Underline prefix
ITALIC_PREFIX="\033[3m" # Italic prefix
CYAN_PREFIX="\033[0;36m" # Cyan prefix
}
# --- helper functions for logs ---
function info()
{
echo -e "[${GREEN_PREFIX}INFO${COLOR_SUFFIX}] " "$@"
}
function warn()
{
echo -e "[${YELLOW_PREFIX}WARN${COLOR_SUFFIX}] " "$@" >&2
}
function fatal()
{
echo -e "[${RED_PREFIX}ERROR${COLOR_SUFFIX}] " "$@" >&2
exit 1
}
function debug()
{
echo -e "[${BLUE_PREFIX}DEBUG${COLOR_SUFFIX}]===> " "$@"
}
function success()
{
echo -e "${BRIGHT_GREEN_PREFIX}===> [SUCCESS] <===${COLOR_SUFFIX}\n=> " "$@"
}
# Print colors you can use
openim::color::print_color()

@ -38,6 +38,7 @@ OPENIM_OUTPUT_BINPATH="${OPENIM_OUTPUT}/bin/platforms"
OPENIM_OUTPUT_BINTOOLPATH="${OPENIM_OUTPUT}/bin-tools"
OPENIM_OUTPUT_TOOLS="${OPENIM_OUTPUT}/tools"
OPENIM_OUTPUT_TMP="${OPENIM_OUTPUT}/tmp"
OPENIM_OUTPUT_LOGS="${OPENIM_OUTPUT}/logs"
# This controls rsync compression. Set to a value > 0 to enable rsync
# compression for build container

@ -13,10 +13,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Controls verbosity of the script output and logging.
OPENIM_VERBOSE="${OPENIM_VERBOSE:-5}"
if [[ ! -v OPENIM_VERBOSE ]]; then
openim::log::info "OPENIM_VERBOSE is not set; defaulting to \"5\""
OPENIM_OUTPUT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../_output" && pwd -P)"
OPENIM_VERBOSE="${OPENIM_OUTPUT}/logs"
fi
log_file="${OPENIM_OUTPUT_LOGS}/openim_$(date '+%Y%m%d').log"
function echo_log() {
echo_log -e "$@" | tee -a "${log_file}"
}
# MAX_LOG_SIZE=10485760 # 10MB
# Clear logs from 5 days ago
# find $OPENIM_OUTPUT_LOGS -type f -name "*.log" -mtime +5 -exec rm -f {} \;
# Handler for when we exit automatically on an error.
# Borrowed from https://gist.github.com/ahendrix/7030300
openim::log::errexit() {
@ -58,7 +74,7 @@ openim::log::stack() {
local stack_skip=${1:-0}
stack_skip=$((stack_skip + 1))
if [[ ${#FUNCNAME[@]} -gt ${stack_skip} ]]; then
echo "Call stack:" >&2
echo_log_log "Call stack:" >&2
local i
for ((i=1 ; i <= ${#FUNCNAME[@]} - stack_skip ; i++))
do
@ -66,7 +82,7 @@ openim::log::stack() {
local source_file=${BASH_SOURCE[${frame_no}]}
local source_lineno=${BASH_LINENO[$((frame_no - 1))]}
local funcname=${FUNCNAME[${frame_no}]}
echo " ${i}: ${source_file}:${source_lineno} ${funcname}(...)" >&2
echo_log_log " ${i}: ${source_file}:${source_lineno} ${funcname}(...)" >&2
done
fi
}
@ -85,14 +101,14 @@ openim::log::error_exit() {
if [[ ${OPENIM_VERBOSE} -ge 4 ]]; then
local source_file=${BASH_SOURCE[${stack_skip}]}
local source_line=${BASH_LINENO[$((stack_skip - 1))]}
echo "!!! Error in ${source_file}:${source_line}" >&2
echo_log "!!! Error in ${source_file}:${source_line}" >&2
[[ -z ${1-} ]] || {
echo " ${1}" >&2
echo_log " ${1}" >&2
}
openim::log::stack ${stack_skip}
echo "Exiting with status ${code}" >&2
echo_log "Exiting with status ${code}" >&2
fi
exit "${code}"
@ -101,21 +117,21 @@ openim::log::error_exit() {
# Log an error but keep going. Don't dump the stack or exit.
openim::log::error() {
timestamp=$(date +"[%m%d %H:%M:%S]")
echo "!!! ${timestamp} ${1-}" >&2
echo_log "!!! ${timestamp} ${1-}" >&2
shift
for message; do
echo " ${message}" >&2
echo_log " ${message}" >&2
done
}
# Print an usage message to stderr. The arguments are printed directly.
openim::log::usage() {
echo >&2
echo_log >&2
local message
for message; do
echo "${message}" >&2
echo_log "${message}" >&2
done
echo >&2
echo_log >&2
}
openim::log::usage_from_stdin() {
@ -135,14 +151,14 @@ openim::log::info() {
fi
for message; do
echo "${message}"
echo_log "${message}"
done
}
# Just like openim::log::info, but no \n, so you can make a progress bar
openim::log::progress() {
for message; do
echo -e -n "${message}"
echo_log -e -n "${message}"
done
}
@ -163,9 +179,18 @@ openim::log::status() {
fi
timestamp=$(date +"[%m%d %H:%M:%S]")
echo "+++ ${timestamp} ${1}"
echo_log "+++ ${timestamp} ${1}"
shift
for message; do
echo " ${message}"
echo_log " ${message}"
done
}
openim::log::success()
{
local V="${V:-0}"
if [[ ${OPENIM_VERBOSE} < ${V} ]]; then
return
fi
echo_log -e "${BRIGHT_GREEN_PREFIX}===> [success] <===${COLOR_SUFFIX}\n=> " "$@"
}

@ -52,6 +52,12 @@ BIN_TOOLS_DIR := $(OUTPUT_DIR)/bin-tools
$(shell mkdir -p $(BIN_TOOLS_DIR))
endif
# LOGS_DIR: Directory where log files are stored.
ifeq ($(origin LOGS_DIR),undefined)
LOGS_DIR := $(OUTPUT_DIR)/logs
$(shell mkdir -p $(LOGS_DIR))
endif
# TOOLS_DIR: The directory where tools are stored for build and testing.
ifeq ($(origin TOOLS_DIR),undefined)
TOOLS_DIR := $(OUTPUT_DIR)/tools

@ -221,8 +221,8 @@ go.updates: tools.verify.go-mod-outdated
## go.clean: Clean all builds directories and files
.PHONY: go.clean
go.clean:
@echo "===========> Cleaning all builds TMP_DIR($(TMP_DIR)) AND BIN_DIR($(BIN_DIR)) AND BIN_TOOLS_DIR($(BIN_TOOLS_DIR))"
@-rm -vrf $(TMP_DIR) $(BIN_DIR) $(BIN_TOOLS_DIR)
@echo "===========> Cleaning all builds tmp, bin, logs directories and files"
@-rm -vrf $(TMP_DIR) $(BIN_DIR) $(BIN_TOOLS_DIR) $(LOGS_DIR)
@echo "===========> End clean..."
## copyright.help: Show copyright help

Loading…
Cancel
Save