Skip to content

Commit cf217bd

Browse files
committed
恢复web的前端production配置文件的v1代理,server的config.yaml以及core文件夹下的server.go文件恢复原样,新增两个命令行脚本自定义配置及文件变动,修改mysql的3306端口为13306
1 parent f643abd commit cf217bd

File tree

7 files changed

+143
-6
lines changed

7 files changed

+143
-6
lines changed

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ services:
1919
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集
2020
restart: always
2121
ports:
22-
- "3306:3306" # host物理直接映射端口为6606
22+
- "13306:3306" # host物理直接映射端口为6606
2323
environment:
2424
MYSQL_ROOT_PASSWORD: "Aa@6447985" # root管理员用户密码
2525

docker/server-handle.sh

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#! /bin/bash
2+
3+
rm -f ./core/server.go
4+
# 生成server.go文件, 添加Router.Static("/admin", "./resource/dist")这个代码
5+
touch ./core/server.go
6+
filename="./core/server.go"
7+
cat>"${filename}"<<EOF
8+
package core
9+
10+
import (
11+
"fmt"
12+
"gin-vue-admin/global"
13+
"gin-vue-admin/initialize"
14+
"time"
15+
)
16+
17+
type server interface {
18+
ListenAndServe() error
19+
}
20+
21+
func RunWindowsServer() {
22+
if global.GVA_CONFIG.System.UseMultipoint {
23+
// 初始化redis服务
24+
initialize.Redis()
25+
}
26+
Router := initialize.Routers()
27+
Router.Static("/form-generator", "./resource/page")
28+
Router.Static("/admin", "./resource/dist")
29+
30+
//InstallPlugs(Router)
31+
// end 插件描述
32+
33+
address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
34+
s := initServer(address, Router)
35+
// 保证文本顺序输出
36+
// In order to ensure that the text order output can be deleted
37+
time.Sleep(10 * time.Microsecond)
38+
global.GVA_LOG.Debug("server run success on ", address)
39+
40+
fmt.Printf("欢迎使用 Gin-Vue-Admin默认自动化文档地址:http://127.0.0.1%s/swagger/index.html\n 默认前端文件运行地址:http://127.0.0.1:8888/admin\n", address)
41+
global.GVA_LOG.Error(s.ListenAndServe())
42+
}
43+
EOF
44+
45+
rm -f ./config.yaml
46+
# 生成config.yaml文件, 用于docker-compose的使用
47+
touch ./config.yaml
48+
filename="./config.yaml"
49+
cat>"${filename}"<<EOF
50+
# Gin-Vue-Admin Global Configuration
51+
52+
# casbin configuration
53+
casbin:
54+
model-path: './resource/rbac_model.conf'
55+
56+
# jwt configuration
57+
jwt:
58+
signing-key: 'qmPlus'
59+
60+
# mysql connect configuration
61+
mysql:
62+
username: root
63+
password: 'Aa@6447985'
64+
path: mysql
65+
db-name: 'qmPlus'
66+
config: 'charset=utf8&parseTime=True&loc=Local'
67+
max-idle-conns: 10
68+
max-open-conns: 10
69+
log-mode: true
70+
71+
#sqlite 配置
72+
sqlite:
73+
path: db.db
74+
log-mode: true
75+
config: 'loc=Asia/Shanghai'
76+
77+
# oss configuration
78+
79+
# 请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址
80+
qiniu:
81+
access-key: '25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ'
82+
secret-key: 'pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY'
83+
bucket: 'qm-plus-img'
84+
img-path: 'http://qmplusimg.henrongyi.top'
85+
86+
# redis configuration
87+
redis:
88+
addr: redis:6379
89+
password: ''
90+
db: 0
91+
92+
# system configuration
93+
system:
94+
use-multipoint: true
95+
env: 'public' # Change to "develop" to skip authentication for development mode
96+
addr: 8888
97+
db-type: "mysql" # support mysql/sqlite
98+
99+
# captcha configuration
100+
captcha:
101+
key-long: 6
102+
img-width: 240
103+
img-height: 80
104+
105+
# logger configuration
106+
log:
107+
prefix: '[GIN-VUE-ADMIN]'
108+
log-file: true
109+
stdout: 'DEBUG'
110+
file: 'DEBUG'
111+
EOF
112+

docker/web-handle.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#! /bin/bash
2+
3+
rm -f .env.production
4+
touch .env.production
5+
filename="./.env.production"
6+
cat>"${filename}"<<EOF
7+
ENV = 'production'
8+
VUE_APP_BASE_API = ''
9+
EOF
10+

dockerfile_server

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ FROM node:12.16.1 as gva-web
22

33
WORKDIR /gva_web/
44
COPY web/ .
5+
6+
RUN cat .env.production
7+
COPY docker/web-handle.sh .
8+
RUN sh ./web-handle.sh
9+
RUN cat .env.production
10+
RUN rm -f web-handle.sh
11+
512
RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
613
RUN cnpm install || npm install
714
RUN npm run build
@@ -12,6 +19,15 @@ ENV GO111MODULE=on
1219
ENV GOPROXY=https://goproxy.io,direct
1320
WORKDIR /go/src/gin-vue-admin
1421
COPY server/ ./
22+
23+
RUN cat ./core/server.go
24+
RUN cat ./config.yaml
25+
COPY docker/server-handle.sh .
26+
RUN sh ./server-handle.sh
27+
RUN rm -f server-handle.sh
28+
RUN cat ./core/server.go
29+
RUN cat ./config.yaml
30+
1531
RUN go env && go list && go build -o gva-server .
1632

1733

server/config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jwt:
1212
mysql:
1313
username: root
1414
password: 'Aa@6447985'
15-
path: mysql
15+
path: '127.0.0.1:3306'
1616
db-name: 'qmPlus'
1717
config: 'charset=utf8&parseTime=True&loc=Local'
1818
max-idle-conns: 10
@@ -36,13 +36,13 @@ qiniu:
3636

3737
# redis configuration
3838
redis:
39-
addr: redis:6379
39+
addr: '127.0.0.1:6379'
4040
password: ''
4141
db: 0
4242

4343
# system configuration
4444
system:
45-
use-multipoint: true
45+
use-multipoint: false
4646
env: 'public' # Change to "develop" to skip authentication for development mode
4747
addr: 8888
4848
db-type: "mysql" # support mysql/sqlite

server/core/server.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ func RunWindowsServer() {
1818
}
1919
Router := initialize.Routers()
2020
Router.Static("/form-generator", "./resource/page")
21-
Router.Static("/admin", "./resource/dist")
2221

2322
//InstallPlugs(Router)
2423
// end 插件描述

web/.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
ENV = 'production'
2-
VUE_APP_BASE_API = ''
2+
VUE_APP_BASE_API = '/v1'

0 commit comments

Comments
 (0)