-
Notifications
You must be signed in to change notification settings - Fork 12
169 lines (157 loc) · 6.06 KB
/
wescale_wesql_performance_colima.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: "Colima MacOS K8s Cluster"
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
wescale_image_tag:
description: "WeScale Image Tag"
required: true
default: "0.3.0"
wesql_image_tag:
description: "WeSQL Server Image Tag"
required: true
default: "8.0.35-6.alpha10.20240918.g18ad68b.27"
jobs:
setup:
name: "Setup WeScale WeSQL Server Cluster"
runs-on: macos-latest
steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Install kubectl
- name: Install kubectl
run: brew install kubectl
# Step 3: Install Docker CLI
- name: Install Docker CLI
run: brew install docker
# Step 4: Install Colima
- name: Install Colima
run: |
brew install colima
LIMACTL_PATH=$(brew --prefix)/bin/limactl
sudo curl -L -o $LIMACTL_PATH https://github.com/mikekazakov/lima-nohvf/raw/master/limactl && sudo chmod +x $LIMACTL_PATH
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: false
timeout-minutes: 30 # 设置超时时间,默认是 30 分钟
# Step 5: Build image
# - name: Build image
# run: |
# chmod -R o=rx *;
# echo "Building docker using amd64/arm64 buildx";
# docker buildx version
# docker buildx build --platform linux/arm64 -f docker/wesqlscale/Dockerfile.release -t apecloud/apecloud-mysql-scale:local-latest --load .;
#
#
## Step 5: Start Colima with Kubernetes
# - name: Start Colima with Kubernetes
# run: |
# colima start --kubernetes --network-address --arch arm64 --vm-type=qemu
# # Wait for Docker and Kubernetes to fully start
# for i in {1..10}; do
# if docker info > /dev/null 2>&1 && kubectl cluster-info > /dev/null 2>&1; then
# echo "Docker and Kubernetes are running"
# break
# else
# echo "Waiting for Docker and Kubernetes to start..."
# sleep 5
# fi
# done
#
# # Step 6: Verify Kubernetes is running
# - name: Verify Kubernetes is running
# run: |
# kubectl get nodes
# kubectl get pods -A
################################################################################################################
################################################################################################################
################################################################################################################
# - name: Configure AWS CLI
# run: |
# aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws configure set default.region us-east-2
#
# - name: Create S3 Bucket
# id: create_bucket
# run: |
# BUCKET_NAME="wescale-$(date +'%Y%m%d%H%M%S')"
# echo "Bucket name: $BUCKET_NAME"
# aws s3 mb s3://$BUCKET_NAME
# echo "bucket_name=$BUCKET_NAME" >> $GITHUB_OUTPUT
#
# # Step 5: Create Kubernetes ConfigMap and Secret
# - name: Create ConfigMap and Secret in Kubernetes
# run: |
# export WESQL_OBJECTSTORE_BUCKET=${{ steps.create_bucket.outputs.bucket_name }}
# export WESQL_OBJECTSTORE_REGION=us-east-2
# export WESQL_OBJECTSTORE_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY_ID }}
# export WESQL_OBJECTSTORE_SECRET_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}
#
# kubectl apply -f - <<EOF
# apiVersion: v1
# kind: ConfigMap
# metadata:
# name: wesql-server-config
# data:
# MYSQL_CUSTOM_CONFIG: |
# [mysqld]
# objectstore_provider=aws
# objectstore_region=${WESQL_OBJECTSTORE_REGION}
# objectstore_bucket=${WESQL_OBJECTSTORE_BUCKET}
# repo_objectstore_id=sysbench
# branch_objectstore_id=main
# datadir=/data/mysql/data
# log-error=/data/mysql/log/mysqld-error.log
# log-bin=binlog
# gtid_mode=ON
# enforce_gtid_consistency=ON
# log_slave_updates=ON
# binlog_format=ROW
# skip_name_resolve=ON
# EOF
#
# kubectl create secret generic wesql-server-secret \
# --namespace default \
# --type Opaque \
# --from-literal=WESQL_OBJECTSTORE_ACCESS_KEY=${WESQL_OBJECTSTORE_ACCESS_KEY} \
# --from-literal=WESQL_OBJECTSTORE_SECRET_KEY=${WESQL_OBJECTSTORE_SECRET_KEY} \
# --from-literal=MYSQL_ROOT_PASSWORD=passwd
#
# - name: Generate Cluster YAML File And Create Cluster
# run: |
# kubectl apply -f https://raw.githubusercontent.com/wesql/deploy/refs/heads/main/artifact/wescale-ci.yaml
#
# - name: Wait for WeSQL Server to be ready
# run: |
# kubectl wait --for=condition=available deployment/wesql-vtgate --timeout=3000s
# kubectl exec -it $(kubectl get pods -l app.kubernetes.io/name=wesql-vtgate -o jsonpath='{.items[0].metadata.name}') -- mysql -uroot -P15306 -ppasswd -e "SHOW DATABASES;"
#
# - name: Print WeSQL Server ConfigMap and Secret
# if: always()
# run: |
# kubectl get configmap wesql-server-config -o yaml
# kubectl get secret wesql-server-secret -o yaml
#
# - name: Print WeSQL Server Logs
# if: always()
# run: |
# kubectl get pods
#
# kubectl describe po mycluster-wesql-0-0
#
# kubectl get pvc
#
# kubectl get storageclass
#
# kubectl logs mycluster-wesql-0-0
#
# - name: Clean up
# if: always()
# run: |
# echo "Deleting bucket: ${{ steps.create_bucket.outputs.bucket_name }}"
# aws s3 rm s3://${{ steps.create_bucket.outputs.bucket_name }} --recursive
# aws s3 rb s3://${{ steps.create_bucket.outputs.bucket_name }}