Skip to content

Commit

Permalink
Merge branch 'feature/EarthShaker' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
trydofor committed Jun 21, 2023
2 parents 11fac72 + 9f89128 commit 62d19e7
Show file tree
Hide file tree
Showing 286 changed files with 3,225 additions and 1,742 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ buildNumber.properties
*.bak
*.jfr

# local db
*.db

# BlueJ files
*.ctxt

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#spring.datasource.url=jdbc:mysql://localhost:3306/wings_example\
# ?autoReconnect=true&useSSL=false\
# &useUnicode=true&characterEncoding=UTF-8\
# &connectionTimeZone=%2B08:00&forceConnectionTimeZoneToSession=true

spring.datasource.url=jdbc:h2:mem:wings-example\
;USER=trydofor;PASSWORD=moilioncircle\
;MODE=MySQL;CASE_INSENSITIVE_IDENTIFIERS=TRUE\
;AUTO_RECONNECT=TRUE;
spring.datasource.url=jdbc:mysql://localhost:3306/wings_example\
?connectionTimeZone=%2B08:00&forceConnectionTimeZoneToSession=true\
&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true\
&characterEncoding=UTF-8&useUnicode=true

#spring.datasource.url=jdbc:h2:./wings-example\
#;USER=trydofor;PASSWORD=moilioncircle\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"spring.datasource.url=" + Devops0ProjectConstant.JDBC_URL,
"spring.datasource.username=" + Devops0ProjectConstant.JDBC_USER,
"spring.datasource.password=" + Devops0ProjectConstant.JDBC_PASS,
"debug = true"
})
class Devops1SchemaManagerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"spring.datasource.url=" + Devops0ProjectConstant.JDBC_URL,
"spring.datasource.username=" + Devops0ProjectConstant.JDBC_USER,
"spring.datasource.password=" + Devops0ProjectConstant.JDBC_PASS,
"debug = true"
})
@Disabled("日志表管理")
@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"spring.datasource.url=" + Devops0ProjectConstant.JDBC_URL,
"spring.datasource.username=" + Devops0ProjectConstant.JDBC_USER,
"spring.datasource.password=" + Devops0ProjectConstant.JDBC_PASS,
"debug = true"
})
@Disabled("分表分库")
public class Devops6ShardingManagerTest {
Expand Down
2 changes: 1 addition & 1 deletion observe/docs
Submodule docs updated 225 files
2 changes: 1 addition & 1 deletion observe/meepo
Submodule meepo updated from 185eb0 to bafb7e
2 changes: 1 addition & 1 deletion observe/mirana
55 changes: 29 additions & 26 deletions observe/scripts/wings-mysql-dump.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
THIS_VERSION=2022-02-14
THIS_VERSION=2023-04-14

cat << EOF
#################################################
Expand All @@ -10,22 +10,26 @@ cat << EOF
- {db-ts}-tbl.log dump的表及结果信息
- {db-ts}-tip.txt scp及restore手册
# Usage $0 db [cnf] [opt]
- db - 需要dump的database,必填
# Usage $0 cnf [db] [opt]
- cnf - 配置文件,参考'--defaults-extra-file'
- db - 需要dump的database,空时显示所有db
- opt - dump参数,如 '--no-data'
# option 详细参考client和mysqldump段
- https://dev.mysql.com/doc/refman/8.0/en/option-files.html
#################################################
EOF

database=$1
extracnf=$2
extracnf=$1
database=$2
dumpopts=${*:3}
if [[ "$database" == "" ]]; then
echo -e "\033[0;31mWARN: need param-1=database to dump\033[m"
echo "./wings-mysql-dump.sh database wings-mysql-client.cnf --no-data"
echo "defaults-extra-file example"

logxopts="--no-data"
confopts=--defaults-extra-file=$extracnf
if [[ -f "$extracnf" ]]; then
echo -e "\033[0;33mNOTE: defaults-extra-file \033[m"
grep -E "^(host|port|user)" "$extracnf"
else
echo -e "\033[0;31mERROR: should specific mysql config(at param-1), eg. ~/my.cnf\033[m"
cat << 'EOF'
[client]
protocol=tcp
Expand All @@ -44,13 +48,15 @@ EOF
exit
fi

confopts=""
if [[ -f "$extracnf" ]]; then
echo -e "\033[0;33mNOTE: defaults-extra-file \033[m"
grep -E "^(host|port|user)" "$extracnf"
confopts=--defaults-extra-file=$extracnf
else
echo -e "\033[0;31mNOTE: use mysql default(my.cnf), something like\033[m"
unalias mysql >/dev/null 2>&1
unalias mysqldump >/dev/null 2>&1

if [[ "$database" == "" ]]; then
echo -e "\033[0;31mWARN: need database(at param-2) to dump, eg.\033[m"
echo "./wings-mysql-dump.sh wings-mysql-client.cnf database --no-data"
echo -e "\033[0;33mNOTE:current databases \033[m"
mysql $confopts -N -e "show databases;"
exit
fi

###
Expand All @@ -62,9 +68,6 @@ dump_tip_file="$dump_head.tip"
dump_tar_file="$dump_head.tgz"
dump_md5_file="$dump_head.md5"

unalias mysql >/dev/null 2>&1
unalias mysqldump >/dev/null 2>&1

# shellcheck disable=SC2086
if ! mysql $confopts -D "$database" -N -e "show tables" > "$dump_tbl_file"; then
echo -e "\033[37;41;1mERROR: failed to show tables of $database \033[0m"
Expand All @@ -80,7 +83,7 @@ else
echo -e "\033[0;33mNOTE: dump logs tables without data, count=$logs_cnt\033[m"

# shellcheck disable=SC2046,SC2086
if mysqldump $confopts $dumpopts --no-data \
if mysqldump $confopts $dumpopts $logxopts \
"$database" $(grep -E '\$|__' "$dump_tbl_file") > "$dump_logs_file"; then
echo "successfully dump logs"
else
Expand Down Expand Up @@ -113,13 +116,14 @@ ls -lsh |grep "$dump_head" | tee -a "$dump_tbl_file"

echo -e "\033[0;33mNOTE: tips for zip, scp, restore \033[m"
tee -a "$dump_tip_file" << EOF
md5sum -c $dump_md5_file
md5sum -c $dump_md5_file # checksum
tar -tzf $dump_tar_file
tar -xzf $dump_tar_file
tar -xzf $dump_tar_file $dump_tip_file
tar -tzf $dump_tar_file # list files
tar -xzf $dump_tar_file # extract files
tar -xzf $dump_tar_file $dump_tip_file # extract tips
scp ${dump_head}.* trydofor@moilioncircle:/data/mysql-dump/
scp -P 2022 ${dump_head}.* trydofor@moilioncircle:/data/mysql-dump/
rsync -azP -e "ssh -p 2022" ${dump_head}.* trydofor@moilioncircle:/data/mysql-dump/
unalias mysql
newdb="$dump_head"
Expand All @@ -144,4 +148,3 @@ echo -e "\033[0;33mNOTE: tar files into $dump_tar_file \033[m"
tar -czf "$dump_tar_file" "$dump_tip_file" "$dump_tbl_file" "$dump_logs_file" "$dump_main_file" \
&& md5sum "$dump_tar_file" | tee "$dump_md5_file" \
&& rm -f "$dump_tbl_file" "$dump_logs_file" "$dump_main_file"

55 changes: 26 additions & 29 deletions observe/scripts/wings-mysql-user.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/bash
THIS_VERSION=2023-02-14
THIS_VERSION=2023-04-14

cat << EOF
cat <<EOF
#################################################
# Version $THIS_VERSION # test on Mac and Lin
# 创建database以及和访问的用户
- {user_pre}{name_pre}raw SELECT, TEMPORARY TABLE
- {user_pre}{name_pre}app {raw} + INSERT, UPDATE, DELETE, EXECUTE
- {user_pre}{name_pre}dev ALL - Drop
- {user_pre}{name_pre}dba ALL + SELECT on mysql/sys
- FLUSH PRIVILEGES;
# Usage $0 {create|grant|passwd|help} userenv [option]
- create/grant/passwd - 创建/授权/改密码
# Usage $0 userenv {create|grant|passwd|help} [option]
- userenv - 环境脚本(bash语法),wings-mysql-user.env
- create/grant/passwd - 创建/授权/改密码
- option - 存在时,使用'--defaults-extra-file'
# option 详细参考client段
- https://dev.mysql.com/doc/refman/8.0/en/option-files.html
Expand All @@ -27,14 +28,14 @@ function passwd24() {
#####
execute=false
name_pre=_
command="$1"
userenv="$2"
userenv="$1"
command="$2"
option="$3"

if [[ "$command" == "" || "$command" == "help" ]]; then
echo -e '\033[37;42;1mNOTE: users env file\033[m'
# https://dev.mysql.com/doc/refman/8.0/en/account-management-statements.html
cat << 'EOF'
if [[ "$command" == "" || "$command" == "help" || ! -f "$userenv" ]]; then
echo -e '\033[37;42;1mNOTE: users env file\033[m'
# https://dev.mysql.com/doc/refman/8.0/en/account-management-statements.html
cat <<'EOF'
execute=false
# 用户名前缀
user_pre=devall
Expand All @@ -53,20 +54,18 @@ host_app=10.11.%
host_dev=%
host_dba=%
EOF
echo -e '\033[37;42;1mNOTE: user manage\033[m'
cat << 'EOF'
echo -e '\033[37;42;1mNOTE: user manage\033[m'
cat <<'EOF'
RENAME USER 'trydofor'@'%' TO 'trydofor'@'127.0.%';
DROP USER IF EXISTS 'trydofor'@'%';
EOF
exit
exit
fi

declare more_dba
if [[ -f "$userenv" ]]; then
echo "load users option from $userenv"
# shellcheck disable=SC1090
source "$userenv"
fi
echo "load users option from $userenv"
# shellcheck disable=SC1090
source "$userenv"

declare user_pre
if [[ "$user_pre" == "" ]]; then
Expand Down Expand Up @@ -104,7 +103,7 @@ if [[ "$execute" == "true" ]]; then
fi

echo -e '\033[37;42;1mNOTE: users and passwd\033[m'
grep -v '^#' << EOF
grep -v '^#' <<EOF
${user_raw}${user_pre}${name_pre}raw $pass_raw
${user_app}${user_pre}${name_pre}app $pass_app
${user_dev}${user_pre}${name_pre}dev $pass_dev
Expand All @@ -114,7 +113,7 @@ EOF
echo -e '\033[37;42;1mNOTE: sql script to execute\033[m'

if [[ "$command" == "create" ]]; then
grep -v '^#' << EOF | tee /dev/tty | $exec_cmd
grep -v '^#' <<EOF | tee /dev/tty | $exec_cmd
-- create
${user_raw}CREATE USER '${user_pre}${name_pre}raw'@'$host_raw' IDENTIFIED BY '$pass_raw';
${user_app}CREATE USER '${user_pre}${name_pre}app'@'$host_app' IDENTIFIED BY '$pass_app';
Expand All @@ -124,8 +123,8 @@ EOF
fi

if [[ "$command" == "grant" ]]; then
for db_main in $grant_db; do
grep -v '^#' << EOF | tee /dev/tty | $exec_cmd
for db_main in $grant_db; do
grep -v '^#' <<EOF | tee /dev/tty | $exec_cmd
-- grant
${user_raw}GRANT SELECT, CREATE TEMPORARY TABLES ON \`$db_main\`.* TO '${user_pre}${name_pre}raw'@'$host_raw';
${user_app}GRANT SELECT, CREATE TEMPORARY TABLES, INSERT, UPDATE, DELETE, EXECUTE ON \`$db_main\`.* TO '${user_pre}${name_pre}app'@'$host_app';
Expand All @@ -134,22 +133,20 @@ ${user_dev}REVOKE DROP ON \`$db_main\`.* FROM '${user_pre}${name_pre}dev'@'$host
${user_dba}GRANT ALL ON \`$db_main\`.* TO '${user_pre}${name_pre}dba'@'$host_dba';
${user_dba}GRANT RELOAD,SHOW VIEW,EXECUTE,PROCESS,REPLICATION CLIENT,REPLICATION SLAVE ON *.* TO '${user_pre}${name_pre}dba'@'$host_dba';
EOF
for mb in $more_dba; do
grep -v '^#' << EOF | tee /dev/tty | $exec_cmd
for mb in $more_dba; do
grep -v '^#' <<EOF | tee /dev/tty | $exec_cmd
${user_dba}GRANT SELECT ON \`$mb\`.* TO '${user_pre}${name_pre}dba'@'$host_dba';
EOF
done
done
done
done
fi

if [[ "$command" == "passwd" ]]; then
grep -v '^#' << EOF | tee /dev/tty | $exec_cmd
grep -v '^#' <<EOF | tee /dev/tty | $exec_cmd
-- change passwd
${user_raw}ALTER USER '${user_pre}${name_pre}raw'@'$host_raw' IDENTIFIED BY '$pass_raw';
${user_app}ALTER USER '${user_pre}${name_pre}app'@'$host_app' IDENTIFIED BY '$pass_app';
${user_dev}ALTER USER '${user_pre}${name_pre}dev'@'$host_dev' IDENTIFIED BY '$pass_dev';
${user_dba}ALTER USER '${user_pre}${name_pre}dba'@'$host_dba' IDENTIFIED BY '$pass_dba';
EOF
fi


2 changes: 1 addition & 1 deletion observe/scripts/wings-release.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ winx-front-*-SNAPSHOT.jar'

#USER_RUN="$USER" # 用来启动程序的用户
#WORK_DIR='' # 工程目录,及工作目录
#DEST_DIR='' # 目标列表,本地或远程目录,支持scp://[user@]host[:port][/path]
#DEST_DIR='' # 目标列表,本地或远程目录 [user@]host:[path] or scp://[user@]host[:port][/path]
#PACK_JAR='*-SNAPSHOT.jar' # 打包文件或目录的列表
#SUB_FLAT=true # 打包产物是目录时,传送内容或整个目录
#SCP_ARGS='-l 500' # 共通的scp 参数项
Expand Down
12 changes: 10 additions & 2 deletions observe/scripts/wings-release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
THIS_VERSION=2022-07-07
THIS_VERSION=2023-05-25

cat <<EOF
#################################################
Expand Down Expand Up @@ -89,6 +89,8 @@ function build_mvn() {
echo -e "\033[32m ==== git status ==== \033[0m"
rm -f "$_git_log" "$_res_log"
git status
echo -e "\033[32m ==== mvn version ==== \033[0m"
mvn --version
}

function build_web() {
Expand Down Expand Up @@ -141,6 +143,11 @@ function build_web() {
echo "skip append git hash to $_jar"
fi
done

echo -e "\033[32m ==== node version ==== \033[0m"
node --version
echo -e "\033[32m ==== $_cmd version ==== \033[0m"
$_cmd --version
}

function build_auto() {
Expand Down Expand Up @@ -211,6 +218,7 @@ case "$1" in
git pull
echo -e "\033[37;42;1m ==== DONE $WORK_DIR ==== \033[0m"
git status
git log --pretty=format:'%H - %an, %ad %d : %s' --graph -10
;;
pack)
echo -e "\033[37;42;1m ==== BUILD $WORK_DIR ==== \033[0m"
Expand Down Expand Up @@ -273,7 +281,7 @@ case "$1" in
_tgt=$_dst
if [[ ! -d "$_dst" ]]; then
_cmd="scp -r $SCP_ARGS"
# scp://[user@]host[:port][/path]
# [user@]host:[path] scp://[user@]host[:port][/path]
if [[ $_dst =~ scp:// && "$(man scp | grep scp://)" == "" ]]; then
pt=$(echo "$_dst" | sed -E 's=scp://([^:]*:)([0-9]*)(.*)=\2=')
if [[ $pt =~ ^[0-9]+$ ]]; then
Expand Down
14 changes: 7 additions & 7 deletions observe/scripts/wings-starter.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ BOOT_LOG='winx-devops.log'
#BOOT_OUT='' # 控制台日志【/data/boot/wings.out】默认 $BOOT_JAR.out
#BOOT_LOG='' # 程序日志【/data/logs/wings.log】需要外部指定,用来tail
#BOOT_PID='' # 主程序pid【/data/logs/wings.pid】默认 $BOOT_JAR.pid
#BOOT_CNF='' # 外部配置【/data/conf/wings/common/,/data/conf/wings/front/】通过env覆盖
#BOOT_ARG='' # jar的参数【--app.test=one】通过env覆盖
#JAVA_XMS='2G' # jvm的参数。通过env覆盖
#JAVA_XMX='4G' # jvm的参数。通过env覆盖
#BOOT_CNF='' # 外部配置【/data/conf/wings/common/,/data/conf/wings/front/】
#BOOT_ARG='' # jar的参数【--app.test=one】可延时求值
#JDK8_ARG='' # Java8的参数。可延时求值
#JDK9_ARG="$JDK9_ARG --add-opens java.base/java.net=ALL-UNNAMED" # Java9+的参数。可延时求值
#JAVA_ARG='' # JVM的参数。可延时求值
#JAVA_XMS='2G' # jvm的参数。
#JAVA_XMX='4G' # jvm的参数。
#JDK_HOME='' # 指定jdk版本【/data/java/jdk-11.0.2】
#JDK8_ARG='' # Java8的参数
#JDK9_ARG='' # Java9+的参数
#JAVA_ARG='' # JVM的参数
#TIME_ZID='' # java时区【UTC|GMT+8|Asia/Shanghai】
#JAVA_EXT='' # Java的补充参数,直接追加到JAVA_ARG后面
#BOOT_EXT='' # BOOT的补充参数,直接追加到BOOT_ARG后面
Expand Down
Loading

0 comments on commit 62d19e7

Please sign in to comment.