Skip to content

Commit

Permalink
kubernetes部署镜像版本指定优化 & 修复sql脚本问题 (#696)
Browse files Browse the repository at this point in the history
* docs:优化错误信息描述

* Update zh.toml

* fix:修复eureka心跳协议错误码不兼容问题

* fix:修复eureka心跳协议错误码不兼容问题

* unit:添加单元测试

* test:调整测试配置文件位置

* fix:issue #692

* fix:issue #692

* fix:部署优化

* fix:部署优化
  • Loading branch information
chuntaojun committed Sep 24, 2022
1 parent 26e93db commit 763550d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 50 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/integration-testing-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ jobs:
export STORE_MODE=sqldb
echo "cur STORE MODE=${STORE_MODE}"
# 设置严格模式
mysql -h127.0.0.1 -P3306 -uroot -p"polaris" -e "set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'";
# 清空数据
mysql -h127.0.0.1 -P3306 -uroot -p"polaris" -e "DROP DATABASE IF EXISTS polaris_server";
# 初始化 polaris 数据库
Expand All @@ -108,6 +110,8 @@ jobs:
sleep 10s
# 设置严格模式
mysql -h127.0.0.1 -P3306 -uroot -p"polaris" -e "set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'";
# 清空数据
mysql -h127.0.0.1 -P3306 -uroot -p"polaris" -e "DROP DATABASE IF EXISTS polaris_server";
# 初始化 polaris 数据库
Expand Down
75 changes: 53 additions & 22 deletions .github/workflows/standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,37 @@ jobs:
run: |
if [ ${GOOS} == "kubernetes" ];then
set -e
workdir=$(pwd)
# ---------------------- 出简单 kubernetes 安装包 ----------------------
cd ${workdir}
cd deploy/standalone
sed -i "s/##POLARIS_SERVER_VERSION##/${SERVER_VERSION}/g" k8s/03-polaris-server.yaml
sed -i "s/##POLARIS_CONSOLE_VERSION##/${CONSOLE_VERSION}/g" k8s/03-polaris-server.yaml
sed -i "s/##POLARIS_PROMETHEUS_VERSION##/${SERVER_VERSION}/g" k8s/04-prometheus.yaml
DIR_NAME=polaris-standalone-release_${SERVER_VERSION}.${GOOS}
mkdir ${DIR_NAME}
pushd ${DIR_NAME}
cp ../k8s/* ./
cp -rf ../k8s/* ./
popd
PACKAGE_NAME=${DIR_NAME}.zip
zip -r ${PACKAGE_NAME} ${DIR_NAME}
rm -rf ${DIR_NAME}
mv ${PACKAGE_NAME} ../../
# ---------------------- 出 helm 安装包 ----------------------
cd ${workdir}
cd deploy
sed -i "s/##POLARIS_SERVER_VERSION##/${SERVER_VERSION}/g" helm/values.yaml
sed -i "s/##POLARIS_CONSOLE_VERSION##/${CONSOLE_VERSION}/g" helm/values.yaml
sed -i "s/##POLARIS_PROMETHEUS_VERSION##/${SERVER_VERSION}/g" helm/values.yaml
HELM_DIR_NAME=polaris-helm-release_${SERVER_VERSION}.${GOOS}
mkdir ${HELM_DIR_NAME}
pushd ${HELM_DIR_NAME}
cp -rf ../helm/* ./
popd
HELM_PACKAGE_NAME=${HELM_DIR_NAME}.zip
zip -r ${HELM_PACKAGE_NAME} ${HELM_DIR_NAME}
rm -rf ${HELM_DIR_NAME}
mv ${HELM_PACKAGE_NAME} ../
else
set -e
cd deploy/standalone
Expand All @@ -58,24 +83,24 @@ jobs:
CONSOLE_PKG_NAME=polaris-console-release_${CONSOLE_VERSION}.${GOOS}.${GOARCH}.zip
wget -T10 -t3 ${POLARIS_GIT_PATH}/polaris-console/releases/download/${CONSOLE_VERSION}/${CONSOLE_PKG_NAME} --no-check-certificate
if [ ${GOOS} == "windows" ];then
wget -T10 -t3 https://github.com/prometheus/prometheus/releases/download/v2.28.0/prometheus-2.28.0.${GOOS}-${GOARCH}.zip
mv ../vm/install-windows.bat ./install.bat
mv ../vm/install-windows.ps1 ./install-windows.ps1
mv ../vm/uninstall-windows.bat ./uninstall.bat
mv ../vm/uninstall-windows.ps1 ./uninstall-windows.ps1
mv ../vm/port.properties ./port.properties
wget -T10 -t3 https://github.com/prometheus/prometheus/releases/download/v2.28.0/prometheus-2.28.0.${GOOS}-${GOARCH}.zip
mv ../vm/install-windows.bat ./install.bat
mv ../vm/install-windows.ps1 ./install-windows.ps1
mv ../vm/uninstall-windows.bat ./uninstall.bat
mv ../vm/uninstall-windows.ps1 ./uninstall-windows.ps1
mv ../vm/port.properties ./port.properties
else
wget -T10 -t3 https://github.com/prometheus/prometheus/releases/download/v2.28.0/prometheus-2.28.0.${GOOS}-${GOARCH}.tar.gz
mv ../vm/install-${GOOS}.sh ./install.sh
mv ../vm/uninstall-${GOOS}.sh ./uninstall.sh
mv ../vm/port.properties ./port.properties
wget -T10 -t3 https://github.com/prometheus/prometheus/releases/download/v2.28.0/prometheus-2.28.0.${GOOS}-${GOARCH}.tar.gz
mv ../vm/install-${GOOS}.sh ./install.sh
mv ../vm/uninstall-${GOOS}.sh ./uninstall.sh
mv ../vm/port.properties ./port.properties
fi
popd
PACKAGE_NAME=${DIR_NAME}.zip
zip -r ${PACKAGE_NAME} ${DIR_NAME}
mv ${PACKAGE_NAME} ../../
echo ::set-output name=name::${PACKAGE_NAME}
fi
PACKAGE_NAME=${DIR_NAME}.zip
zip -r ${PACKAGE_NAME} ${DIR_NAME}
mv ${PACKAGE_NAME} ../../
echo ::set-output name=name::${PACKAGE_NAME}
- name: Get Release by Tag
Expand All @@ -86,12 +111,18 @@ jobs:
with:
tag_name: ${{ github.event.inputs.server_version }}

- name: Upload asset
uses: actions/upload-release-asset@v1
# - name: Upload asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }}
# asset_path: ./${{ steps.build.outputs.name }}
# asset_name: ${{ steps.build.outputs.name }}
# asset_content_type: application/gzip
- name: Upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }}
asset_path: ./${{ steps.build.outputs.name }}
asset_name: ${{ steps.build.outputs.name }}
asset_content_type: application/gzip
SERVER_VERSION: ${{ github.event.inputs.server_version }}
run: |
hub release edit $(find . -type f -name "polaris-*.zip" -printf "-a %p ") -m "" "${SERVER_VERSION}"
4 changes: 2 additions & 2 deletions deploy/helm/templates/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ spec:
- -c
- /root/prometheus/prometheus --config.file=/root/prometheus/prometheus.yml
--web.enable-lifecycle --web.enable-admin-api
image: ccr.ccs.tencentyun.com/polaris_mesh/polaris-prometheus:1.2
image: polarismesh/polaris-prometheus:latest
imagePullPolicy: Always
name: polaris-prometheus
resources:
Expand All @@ -59,7 +59,7 @@ spec:
- /bin/bash
- -c
- /root/pushgateway/pushgateway --web.enable-lifecycle --web.enable-admin-api
image: ccr.ccs.tencentyun.com/polaris_mesh/polaris-pushgateway:1.1.0
image: prom/pushgateway:latest
imagePullPolicy: Always
name: polaris-pushgateway
resources:
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ global:
polaris:
image:
repository: polarismesh/polaris-server
tag: latest
tag: ##POLARIS_SERVER_VERSION##
pullPolicy: Always
limit:
cpu: "500m"
memory: "1000Mi"
console:
image:
repository: polarismesh/polaris-console
tag: latest
tag: ##POLARIS_CONSOLE_VERSION##
pullPolicy: Always
limit:
cpu: "500m"
Expand Down
4 changes: 2 additions & 2 deletions deploy/standalone/k8s/03-polaris-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
app: polaris
spec:
containers:
- image: polarismesh/polaris-server:latest
- image: polarismesh/polaris-server:##POLARIS_SERVER_VERSION##
imagePullPolicy: Always
name: polaris-server
resources:
Expand All @@ -66,7 +66,7 @@ spec:
- mountPath: /root/polaris-server.yaml
name: polaris-server-config
subPath: polaris-server.yaml
- image: polarismesh/polaris-console:latest
- image: polarismesh/polaris-console:##POLARIS_CONSOLE_VERSION##
imagePullPolicy: Always
name: polaris-console
resources:
Expand Down
22 changes: 0 additions & 22 deletions store/sqldb/scripts/polaris_server.sql
Original file line number Diff line number Diff line change
Expand Up @@ -276,28 +276,6 @@ VALUES ('fbca9bfa04ae4ead86e1ecf5811e32a9',
'polaris',
0,
'2021-09-06 07:55:07',
'2021-09-06 07:55:11'),
('1866010b40be6542db1a2cc846c7f51f',
'polaris.discover',
'Polaris',
'polaris discover service',
'polaris',
'2a54df30a6fd4910bdb601dd40b6d58e',
'5060b13df17240d8-84001e5ae0216c48',
'polaris',
0,
'2021-09-06 07:55:07',
'2021-09-06 07:55:11'),
('846c1866010b40b7f51fe6542db1a2cc',
'polaris.healthcheck',
'Polaris',
'polaris health check service',
'polaris',
'254b202a965541a5966b725ae18a6613',
'aaa44f501ebb4884b0f5c005666ecca1',
'polaris',
0,
'2021-09-06 07:55:07',
'2021-09-06 07:55:11');

-- --------------------------------------------------------
Expand Down

0 comments on commit 763550d

Please sign in to comment.