Skip to content

Commit 3386644

Browse files
author
奇淼(piexlmax
authored
样式细节调整 (#726)
增加健康检查 样式细节调整 规范化插件js模式 增加k8s yaml文件 (#734)
1 parent 98a257b commit 3386644

File tree

30 files changed

+747
-368
lines changed

30 files changed

+747
-368
lines changed
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: config.yaml
5+
annotations:
6+
flipped-aurora/gin-vue-admin: backend
7+
github: "https://github.com/flipped-aurora/gin-vue-admin.git"
8+
app.kubernetes.io/version: 0.0.1
9+
labels:
10+
app: gva-server
11+
version: gva-vue3
12+
data:
13+
config.yaml: |
14+
# github.com/flipped-aurora/gin-vue-admin/server Global Configuration
15+
16+
# jwt configuration
17+
jwt:
18+
signing-key: 'qmPlus'
19+
expires-time: 604800
20+
buffer-time: 86400
21+
22+
# zap logger configuration
23+
zap:
24+
level: 'info'
25+
format: 'console'
26+
prefix: '[github.com/flipped-aurora/gin-vue-admin/server]'
27+
director: 'log'
28+
link-name: 'latest_log'
29+
show-line: true
30+
encode-level: 'LowercaseColorLevelEncoder'
31+
stacktrace-key: 'stacktrace'
32+
log-in-console: true
33+
34+
# redis configuration
35+
redis:
36+
db: 0
37+
addr: '127.0.0.1:6379'
38+
password: ''
39+
40+
# email configuration
41+
email:
42+
43+
port: 465
44+
45+
host: 'smtp.163.com'
46+
is-ssl: true
47+
secret: 'xxx'
48+
nickname: 'test'
49+
50+
# casbin configuration
51+
casbin:
52+
model-path: './resource/rbac_model.conf'
53+
54+
# system configuration
55+
system:
56+
env: 'develop' # Change to "develop" to skip authentication for development mode
57+
addr: 8888
58+
db-type: 'mysql'
59+
oss-type: 'local' # 控制oss选择走本期还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置
60+
use-multipoint: false
61+
62+
# captcha configuration
63+
captcha:
64+
key-long: 6
65+
img-width: 240
66+
img-height: 80
67+
68+
# mysql connect configuration
69+
# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://www.github.com/flipped-aurora/gin-vue-admin/server.com/docs/first)
70+
mysql:
71+
path: ''
72+
config: ''
73+
db-name: ''
74+
username: ''
75+
password: ''
76+
max-idle-conns: 10
77+
max-open-conns: 100
78+
log-mode: false
79+
log-zap: ""
80+
81+
# local configuration
82+
local:
83+
path: 'uploads/file'
84+
85+
# autocode configuration
86+
autocode:
87+
transfer-restart: true
88+
root: ""
89+
server: /server
90+
server-api: /api/v1/autocode
91+
server-initialize: /initialize
92+
server-model: /model/autocode
93+
server-request: /model/autocode/request/
94+
server-router: /router/autocode
95+
server-service: /service/autocode
96+
web: /web/src
97+
web-api: /api
98+
web-flow: /view
99+
web-form: /view
100+
web-table: /view
101+
102+
# qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址)
103+
qiniu:
104+
zone: 'ZoneHuaDong'
105+
bucket: ''
106+
img-path: ''
107+
use-https: false
108+
access-key: ''
109+
secret-key: ''
110+
use-cdn-domains: false
111+
112+
113+
# aliyun oss configuration
114+
aliyun-oss:
115+
endpoint: 'yourEndpoint'
116+
access-key-id: 'yourAccessKeyId'
117+
access-key-secret: 'yourAccessKeySecret'
118+
bucket-name: 'yourBucketName'
119+
bucket-url: 'yourBucketUrl'
120+
base-path: 'yourBasePath'
121+
122+
# tencent cos configuration
123+
tencent-cos:
124+
bucket: 'xxxxx-10005608'
125+
region: 'ap-shanghai'
126+
secret-id: 'xxxxxxxx'
127+
secret-key: 'xxxxxxxx'
128+
base-url: 'https://gin.vue.admin'
129+
path-prefix: 'github.com/flipped-aurora/gin-vue-admin/server'
130+
131+
# excel configuration
132+
excel:
133+
dir: './resource/excel/'
134+
135+
136+
# timer task db clear table
137+
Timer:
138+
start: true
139+
spec: "@daily" # 定时任务详细配置参考 https://pkg.go.dev/github.com/robfig/cron/v3
140+
detail: [
141+
# tableName: 需要清理的表名
142+
# compareField: 需要比较时间的字段
143+
# interval: 时间间隔, 具体配置详看 time.ParseDuration() 中字符串表示 且不能为负数
144+
# 2160h = 24 * 30 * 3 -> 三个月
145+
{ tableName: "sys_operation_records" , compareField: "created_at", interval: "2160h" },
146+
{ tableName: "jwt_blacklists" , compareField: "created_at", interval: "168h" }
147+
#{ tableName: "log2" , compareField: "created_at", interval: "2160h" }
148+
]
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: gva-server
5+
annotations:
6+
flipped-aurora/gin-vue-admin: backend
7+
github: "https://github.com/flipped-aurora/gin-vue-admin.git"
8+
app.kubernetes.io/version: 0.0.1
9+
labels:
10+
app: gva-server
11+
version: gva-vue3
12+
spec:
13+
replicas: 1
14+
selector:
15+
matchLabels:
16+
app: gva-server
17+
version: gva-vue3
18+
template:
19+
metadata:
20+
labels:
21+
app: gva-server
22+
version: gva-vue3
23+
spec:
24+
containers:
25+
- name: gin-vue-admin-container
26+
image: registry.cn-hangzhou.aliyuncs.com/gin-vue-admin/server:40fc3aa6
27+
imagePullPolicy: IfNotPresent
28+
ports:
29+
- containerPort: 8888
30+
name: http
31+
volumeMounts:
32+
- mountPath: /go/src/github.com/flipped-aurora/gin-vue-admin/server/config.yaml
33+
name: config
34+
subPath: config.yaml
35+
- mountPath: /etc/localtime
36+
name: localtime
37+
resources:
38+
limits:
39+
cpu: 1000m
40+
memory: 2000Mi
41+
requests:
42+
cpu: 100m
43+
memory: 200Mi
44+
# readinessProbe:
45+
# httpGet:
46+
# path: /ready
47+
# port: http
48+
# initialDelaySeconds: 20
49+
# periodSeconds: 10
50+
# successThreshold: 1
51+
# failureThreshold: 3
52+
# livenessProbe:
53+
# httpGet:
54+
# path: /health
55+
# port: http
56+
# initialDelaySeconds: 20
57+
# periodSeconds: 10
58+
# successThreshold: 1
59+
# failureThreshold: 3
60+
#imagePullSecrets:
61+
# - name: docker-registry
62+
volumes:
63+
- name: localtime
64+
hostPath:
65+
path: /etc/localtime
66+
- name: config
67+
configMap:
68+
name: config.yaml
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: gva-server
5+
annotations:
6+
flipped-aurora/gin-vue-admin: backend
7+
github: "https://github.com/flipped-aurora/gin-vue-admin.git"
8+
app.kubernetes.io/version: 0.0.1
9+
labels:
10+
app: gva-server
11+
version: gva-vue3
12+
spec:
13+
selector:
14+
app: gva-server
15+
version: gva-vue3
16+
ports:
17+
- port: 8888
18+
name: http
19+
targetPort: 8888
20+
type: ClusterIP
21+
# type: NodePort
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: my.conf
5+
data:
6+
my.conf: |
7+
server {
8+
listen 8080;
9+
server_name localhost;
10+
11+
#charset koi8-r;
12+
#access_log logs/host.access.log main;
13+
14+
location / {
15+
root /usr/share/nginx/html;
16+
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
17+
try_files $uri $uri/ /index.html;
18+
}
19+
20+
location /api {
21+
proxy_set_header Host $http_host;
22+
proxy_set_header X-Real-IP $remote_addr;
23+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
24+
proxy_set_header X-Forwarded-Proto $scheme;
25+
rewrite ^/api/(.*)$ /$1 break; #重写
26+
proxy_pass http://gva-server:8888; # 设置代理服务器的协议和地址
27+
}
28+
29+
location /api/swagger/index.html {
30+
proxy_pass http://gva-server:8888/swagger/index.html;
31+
}
32+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: gva-web
5+
annotations:
6+
flipped-aurora/gin-vue-admin: ui
7+
github: "https://github.com/flipped-aurora/gin-vue-admin.git"
8+
app.kubernetes.io/version: 0.0.1
9+
labels:
10+
app: gva-web
11+
version: gva-vue3
12+
spec:
13+
replicas: 1
14+
selector:
15+
matchLabels:
16+
app: gva-web
17+
version: gva-vue3
18+
template:
19+
metadata:
20+
labels:
21+
app: gva-web
22+
version: gva-vue3
23+
spec:
24+
containers:
25+
- name: gin-vue-admin-nginx-container
26+
image: registry.cn-hangzhou.aliyuncs.com/gin-vue-admin/web:40fc3aa6
27+
imagePullPolicy: IfNotPresent
28+
ports:
29+
- containerPort: 8080
30+
name: http
31+
readinessProbe:
32+
tcpSocket:
33+
port: 8080
34+
initialDelaySeconds: 10
35+
periodSeconds: 10
36+
successThreshold: 1
37+
failureThreshold: 3
38+
resources:
39+
limits:
40+
cpu: 500m
41+
memory: 1000Mi
42+
requests:
43+
cpu: 100m
44+
memory: 100Mi
45+
volumeMounts:
46+
- mountPath: /etc/nginx/conf.d/
47+
name: nginx-config
48+
volumes:
49+
- name: nginx-config
50+
configMap:
51+
name: my.conf
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: gva-web
5+
annotations:
6+
flipped-aurora/gin-vue-admin: ui
7+
github: "https://github.com/flipped-aurora/gin-vue-admin.git"
8+
app.kubernetes.io/version: 0.0.1
9+
labels:
10+
app: gva-web
11+
version: gva-vue3
12+
spec:
13+
type: NodePort
14+
# type: ClusterIP
15+
ports:
16+
- name: http
17+
port: 8080
18+
targetPort: 8080
19+
selector:
20+
app: gva-web
21+
version: gva-vue3

server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:alpine
1+
FROM golang:alpine as builder
22

33
WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server
44
COPY . .

server/initialize/router.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ func Routers() *gin.Engine {
4141
exampleRouter := router.RouterGroupApp.Example
4242
autocodeRouter := router.RouterGroupApp.Autocode
4343
PublicGroup := Router.Group("")
44+
{
45+
// 健康监测
46+
PublicGroup.GET("/health", func(c *gin.Context) {
47+
c.JSON(200, "ok")
48+
})
49+
}
4450
{
4551
systemRouter.InitBaseRouter(PublicGroup) // 注册基础功能路由 不做鉴权
4652
systemRouter.InitInitRouter(PublicGroup) // 自动初始化相关

0 commit comments

Comments
 (0)