feat: add wescale wesql cluster workflow #59
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# 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 | |
# Step 7: Build image | |
- name: Build image | |
run: | | |
chmod -R o=rx *; | |
echo "Building docker using amd64/arm64 buildx"; | |
docker build -f docker/wesqlscale/Dockerfile.release -t apecloud/apecloud-mysql-scale:local-latest .; | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
limit-access-to-actor: false | |
timeout-minutes: 90 # 设置超时时间,默认是 30 分钟 | |
################################################################################################################ | |
################################################################################################################ | |
################################################################################################################ | |
# - 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 }} |