提交 f6eece08 作者: zhenjie

Merge remote-tracking branch 'origin/develop' into develop

# This workflow will build and push a new container image to Alibaba Cloud Container Registry (ACR),
# and then will deploy it to Alibaba Cloud Container Service for Kubernetes (ACK), when there is a push to the "develop" branch.
#
# To use this workflow, you will need to complete the following set-up steps:
#
# 1. Create an ACR repository to store your container images.
# You can use ACR EE instance for more security and better performance.
# For instructions see https://www.alibabacloud.com/help/doc-detail/142168.htm
#
# 2. Create an ACK cluster to run your containerized application.
# You can use ACK Pro cluster for more security and better performance.
# For instructions see https://www.alibabacloud.com/help/doc-detail/95108.htm
#
# 3. Store your AccessKey pair in GitHub Actions secrets named `ACCESS_KEY_ID` and `ACCESS_KEY_SECRET`.
# For instructions on setting up secrets see: https://developer.github.com/actions/managing-workflows/storing-secrets/
#
# 4. Change the values for the REGION_ID, REGISTRY, NAMESPACE, IMAGE, ACK_CLUSTER_ID, and ACK_DEPLOYMENT_NAME.
#
name: Build and Push to ACR
on:
push:
branches: [ "develop" ]
env:
REGION_ID: cn-shenzhen
REGISTRY: mmc-registry.cn-shenzhen.cr.aliyuncs.com
NAMESPACE: sharefly
IMAGE: cms
TAG: ${{ github.sha }}
#ACK_CLUSTER_ID: clusterID
#ACK_DEPLOYMENT_NAME: nginx-deployment
ACR_EE_REGISTRY: mmc-registry.cn-shenzhen.cr.aliyuncs.com
ACR_EE_INSTANCE_ID: cri-yhk5zgfc2v1sia6l
ACR_EE_NAMESPACE: sharefly
ACR_EE_IMAGE: cms
ACR_EE_TAG: ${{ github.sha }}
JAVA_VERSION: '8'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout
uses: actions/checkout@v3
#- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: ${{env.JAVA_VERSION}}
# 2.1 (Optional) Login to ACR EE
- name: Login to ACR EE with the AccessKey pair
uses: aliyun/acr-login@v1
with:
login-server: "https://${{ env.ACR_EE_REGISTRY }}"
region-id: "${{ env.REGION_ID }}"
username: "QD--KeBiTeHangKong@1354706964800968"
password: "MMC@2023&ACR"
#access-key-id: "${{ secrets.ACCESS_KEY_ID }}"
#access-key-secret: "${{ secrets.ACCESS_KEY_SECRET }}"
instance-id: "${{ env.ACR_EE_INSTANCE_ID }}"
# 2.2 (Optional) Build and push image ACR EE
- name: Build and push image to ACR EE
run: |
mvn clean package
docker build -t "$ACR_EE_REGISTRY/$ACR_EE_NAMESPACE/$ACR_EE_IMAGE:$TAG" .
docker push "$ACR_EE_REGISTRY/$ACR_EE_NAMESPACE/$ACR_EE_IMAGE:$TAG"
# 3.2 Deploy the image to the ACK cluster
- name: Kustomize Set Image
run: |-
cd kustomization/overlays/dev
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash /dev/stdin 3.8.6
./kustomize edit set image REGISTRY/NAMESPACE/IMAGE:TAG=$REGISTRY/$NAMESPACE/$IMAGE:$TAG
#- name: Commit files
# run: |
# git config --local user.email "986022405@qq.com"
# git config --local user.name "qiankaiyu"
# git commit -am "Image Update"
# git push
#- name: Push changes
# uses: ad-m/github-push-action@master
# with:
# #github_token: ${{ secret.GITHUB_TOKEN }}
# github_token: "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"
\ No newline at end of file
FROM openjdk:8-jdk-alpine
#VOLUME ["/tmp","/files","/var/logs/"]
ARG JAVA_OPTS
ENV JAVA_OPTS=$JAVA_OPTS
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
COPY ./csm-service/cms-service-user/target/cms-service-user-1.0-SNAPSHOT.jar cms.jar
EXPOSE 35150
# For Spring-Boot project, use the entrypoint below to reduce Tomcat startup time.
ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar cms.jar
server:
port: 35150
servlet:
context-path: /userapp
#spring
spring:
application:
name: userapp
#Database
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-wz9dd796t4j1giz6t.mysql.rds.aliyuncs.com:3306/iuav_cms?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
username: tmj
password: MMC@2022&MYSQL
# Druid数据源配置
type: com.alibaba.druid.pool.DruidDataSource
druid:
initial-size: 10 #初始化连接池大小
min-idle: 10 #最小大小
max-active: 50 #最大大小
max-wait: 60000 #获取连接时最大等待时间,单位毫秒
time-between-eviction-runs-millis: 60000 #配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
min-evictable-idle-time-millis: 300000 #配置一个连接在池中最小生存的时间,单位是毫秒
validation-query: SELECT 1 FROM DUAL #用来检测连接是否有效的sql
test-while-idle: true #申请连接的时候检测,建议配置为true,不影响性能,并且保证安全性
testOnBorrow: false #获取连接时执行检测,建议关闭,影响性能
testOnReturn: false #归还连接时执行检测,建议关闭,影响性能
pool-prepared-statements: false #是否开启PSCache,PSCache对支持游标的数据库性能提升巨大,oracle建议开启,mysql下建议关闭
filters: stat,wall #配置扩展插件,常用的插件有=>stat:监控统计 log4j:日志 wall:防御sql注入
filter:
wall:
config:
multi-statement-allow: true
db-type: mysql
enabled: true
connection-properties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 #打开慢sql记录和延迟时间
web-stat-filter:
url-pattern: /*
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
enabled: true
stat-view-servlet:
enabled: true
login-username: druid
login-password: druid
#mybatis
mybatis:
executor-type: simple
mapper-locations: classpath:mapper/**/*.xml
type-aliases-package: com.mmc.iuav.user
configuration:
map-underscore-to-camel-case: true
wx:
sub:
appid: wx5c6a105a0ddca4c5
secret: 96c75255dd26f82f8d55e15b59e101c7
app:
id: wx18b7883acd204278
secret: 28afe74ba373830237a8133a7431ee82
miniprogram-state: trial
env-version: trial
token-path: /userservlet/wechat/getAppletUserAccessToken
port: user
\ No newline at end of file
spring: spring:
profiles: profiles:
active: dev active: test
--- ---
......
# application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cms-application
namespace: argocd
spec:
project: default # 项目名
source:
repoURL: http://git.mmcuav.cn/iuav/cms.git
targetRevision: HEAD #develop master # 分支名
path: argocd # 资源文件路径
destination:
server: https://kubernetes.default.svc # API Server 地址
namespace: develop # 部署应用的命名空间
# 默认情况下每 3 分钟会检测 Git 仓库一次
syncPolicy:
syncOptions:
- CreateNamespace=true
automated:
selfHeal: true
prune: true
apiVersion: v1
kind: ConfigMap
metadata:
name: cms-map
namespace: default
data:
SPRING_PROFILES_ACTIVE: default
apiVersion: apps/v1
kind: Deployment
metadata:
name: cms-deployment
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: cms
template:
metadata:
labels:
app: cms
spec:
containers:
- name: cms
image: REGISTRY/NAMESPACE/IMAGE:TAG
resources:
limits:
memory: 256Mi
cpu: 100m
ports:
- containerPort: 35150
env:
- name: SPRING_PROFILES_ACTIVE
valueFrom:
configMapKeyRef:
name: cms-map
key: SPRING_PROFILES_ACTIVE
\ No newline at end of file
#apiVersion: extensions/v1beta1
#kind: Ingress
#metadata:
# name: pms-ingress
# namespace: default
#spec:
# rules:
# - host: infra.mmcuav.cn
# http:
# paths:
# - backend:
# serviceName: pms-svc
# servicePort: 8081
# path: /
\ No newline at end of file
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
app: cms
resources:
- ./deployment.yaml
- ./service.yaml
- ./configMap.yaml
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: cms-svc
namespace: default
spec:
selector:
app: cms
type: NodePort
ports:
- protocol: TCP
port: 35150
targetPort: 35150
NodePort: 30150
\ No newline at end of file
apiVersion: v1
kind: ConfigMap
metadata:
name: cms-map
data:
SPRING_PROFILES_ACTIVE: dev
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: cms-deployment
spec:
template:
spec:
containers:
- name: cms
image: REGISTRY/NAMESPACE/IMAGE:TAG
\ No newline at end of file
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
namePrefix: dev-
namespace: dev
commonLabels:
variant: dev
commonAnnotations:
note: This is dev!
patchesStrategicMerge:
- configMap.yaml
- deployment.yaml
# - ingress.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: cms-map
data:
SPRING_PROFILES_ACTIVE: prod
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: cms-deployment
spec:
replicas: 1
template:
spec:
containers:
- name: cms
image: REGISTRY/NAMESPACE/IMAGE:TAG
\ No newline at end of file
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
namespace: prod
namePrefix: prod-
commonLabels:
variant: prod
commonAnnotations:
note: This is prod!
patchesStrategicMerge:
- configMap.yaml
- deployment.yaml
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论