-
Notifications
You must be signed in to change notification settings - Fork 12
106 lines (89 loc) · 3.15 KB
/
wescale_wesql_performance_docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: "Ubuntu Docker Cluster"
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
setup:
name: "Ubuntu Docker Cluster"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Start MySQL Server
run: |
chmod -R 777 .
chown -R $(whoami) .
cd ./examples/wesql-server && ./start_mysql_server.sh
- name: Install MySQL client
run: |
sudo apt-get update && sudo apt-get install -y mysql-client
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.1
- name: Compile source
timeout-minutes: 30
run: |
pwd
ls -alF examples/wesql-server/vtdataroot
whoami
make failpoint-enable
make build
make failpoint-disable
- name: Start WeScale
run: |
cd ./examples/wesql-server
# 在一个终端会话中运行初始化脚本并通过 tee 输出日志
./init_single_node_cluster.sh 2>&1 | tee init_script_logs.txt &
INIT_PID=$!
# 实时显示日志文件内容
tail -f init_script_logs.txt &
TAIL_PID=$!
echo "Waiting for WeScale to be ready..."
if timeout 10 bash -c 'until nc -z localhost 15306; do sleep 2; echo "Waiting for port 15306..."; done'; then
echo "Port 15306 is now available"
# 停止 tail
kill $TAIL_PID
wait $INIT_PID
echo "Initialization completed successfully"
else
echo "Timeout waiting for port 15306"
# 停止 tail 和初始化脚本
kill $TAIL_PID
kill $INIT_PID
echo "=== Final logs ==="
cat init_script_logs.txt
exit 1
fi
- name: Check Vitess Tablets
if: always()
run: |
# Attempt to connect and execute command, display logs if failed
if ! mysql -h127.0.0.1 -P15306 -uroot -ppasswd -e "show vitess_tablets"; then
echo "Failed to execute MySQL command"
echo "=== Initialization Script Logs ==="
cat ./examples/wesql-server/init_script_logs.txt
exit 1
fi
- name: Install Tmate
run: sudo apt-get install tmate
- name: Start Tmate session
run: |
tmate -S /tmp/tmate.sock new-session -d
tmate -S /tmp/tmate.sock wait tmate-ready
echo "SSH access: $(tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}')"
echo "Web access: $(tmate -S /tmp/tmate.sock display -p '#{tmate_web}')"
TIMEOUT=1800 # 30 minutes
INTERVAL=1 # 1 second
START_TIME=$(date +%s)
while true; do
sleep "$INTERVAL"
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
# Check if timeout is reached
if [ "$ELAPSED_TIME" -ge "$TIMEOUT" ]; then
echo "Timeout reached while waiting for the container."
break
fi
done
continue-on-error: true