Skip to content

Commit 6423949

Browse files
author
pixel
committed
Merge remote-tracking branch 'origin/gva_gormv2_dev' into gva_gormv2_dev
2 parents f864b35 + f30182c commit 6423949

File tree

12 files changed

+892
-851
lines changed

12 files changed

+892
-851
lines changed

.docker-compose/docker-entrypoint-initdb.d/init.sql

+730
Large diffs are not rendered by default.

.docker-compose/docker-entrypoint-initdb.d/qmplus.sql

-728
This file was deleted.

.docker-compose/nginx/conf.d/my.conf

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
server {
2+
listen 8000;
3+
server_name localhost;
4+
5+
#charset koi8-r;
6+
#access_log logs/host.access.log main;
7+
8+
location / {
9+
root /usr/share/nginx/html;
10+
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
11+
try_files $uri $uri/ /index.html;
12+
}
13+
14+
location /api {
15+
proxy_set_header Host $http_host;
16+
proxy_set_header X-Real-IP $remote_addr;
17+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
18+
proxy_set_header X-Forwarded-Proto $scheme;
19+
rewrite ^/api/(.*)$ /$1 break; #重写
20+
proxy_pass http://177.7.0.12:8888; # 设置代理服务器的协议和地址
21+
}
22+
23+
location /api/swagger/index.html {
24+
proxy_pass http://127.0.0.1:8888/swagger/index.html;
25+
}
26+
}

.docker-compose/shell/server-handle.sh

+9-43
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,5 @@
11
#! /bin/bash
22

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-
"go.uber.org/zap"
15-
"time"
16-
)
17-
18-
type server interface {
19-
ListenAndServe() error
20-
}
21-
22-
func RunWindowsServer() {
23-
if global.GVA_CONFIG.System.UseMultipoint {
24-
// 初始化redis服务
25-
initialize.Redis()
26-
}
27-
Router := initialize.Routers()
28-
Router.Static("/form-generator", "./resource/page")
29-
Router.Static("/admin", "./resource/dist")
30-
31-
//InstallPlugs(Router)
32-
// end 插件描述
33-
34-
address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
35-
s := initServer(address, Router)
36-
// 保证文本顺序输出
37-
// In order to ensure that the text order output can be deleted
38-
time.Sleep(10 * time.Microsecond)
39-
global.GVA_LOG.Debug("server run success on ", zap.String("address", address))
40-
41-
fmt.Printf("欢迎使用 Gin-Vue-Admin默认自动化文档地址:http://127.0.0.1%s/swagger/index.html\n 默认前端文件运行地址:http://127.0.0.1:8888/admin\n", address)
42-
global.GVA_LOG.Error(s.ListenAndServe().Error())
43-
}
44-
EOF
45-
463
rm -f ./config.yaml
474
# 生成config.yaml文件, 用于docker-compose的使用
485
touch ./config.yaml
@@ -123,5 +80,14 @@ zap:
12380
encode_level: 'LowercaseColorLevelEncoder'
12481
stacktrace_key: 'stacktrace'
12582
log_in_console: true
83+
84+
email:
85+
email_from: '[email protected]'
86+
email_nick_name: 'test'
87+
email_secret: 'xxx'
88+
email_to: '[email protected]'
89+
email_host: 'smtp.163.com'
90+
email_port: 465
91+
email_isSSL: true
12692
EOF
12793

.docker-compose/shell/web-handle.sh

-10
This file was deleted.

README-en.md

+38-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
<div align=center>
33
<img src="http://qmplusimg.henrongyi.top/gvalogo.jpg" width=300" height="300" />
44
</div>
@@ -62,18 +62,20 @@ We are excited that you are interested in contributing to gin-vue-admin. Before
6262
### 1.3 Version list
6363

6464
- master: 2.0 code, for prod
65-
6665
- develop: 2.0 dev code, for test
67-
68-
- [gin-vue-admin_v2.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 is no longer compatible with v1.0)
69-
70-
- [gin-vue-admin_v1.0_stable](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_stable) (stop maintenance)
71-
72-
- [gin-vue-admin_v1.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_dev) (stop maintenance)
73-
66+
- [gin-vue-admin_v2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 [GormV1](https://v1.gorm.io) Stable branch)
67+
- [gva_gormv2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gva_gormv2_dev) (v2.0 [GormV2](https://v2.gorm.io) Development branch)
7468

7569
## 2. Getting started
7670

71+
```
72+
- node version > v8.6.0
73+
- golang version >= v1.11
74+
- IDE recommendation: Goland
75+
- After you clone the project, use the scripts in directory db to create your own database.
76+
- We recommend you to apply for your own cloud service in QINIU. Replace the public key, private key, warehouse name and default url address with your own, so as not to mess up the test database.
77+
```
78+
7779
> Use docker-compose to experience this project
7880
- Installation docker-compose [Official document](https://docs.docker.com/compose/install/)
7981
- ```shell script
@@ -95,6 +97,7 @@ We are excited that you are interested in contributing to gin-vue-admin. Before
9597
- ```git
9698
git clone https://github.com/flipped-aurora/gin-vue-admin.git
9799
```
100+
98101
- Use docker-compose up to start the startup project with one click
99102
- ```shell script
100103
# Use docker-compose to start four containers
@@ -105,17 +108,31 @@ We are excited that you are interested in contributing to gin-vue-admin. Before
105108
docker-compose up -d
106109
```
107110

108-
- Web project preview [http://127.0.0.1:8888/admin](http://127.0.0.1:8888/admin)
111+
- Web project preview [http://127.0.0.1:8000](http://127.0.0.1:8000)
109112

110113
- swagger APIs [http://127.0.0.1:8888/swagger/index.html](http://127.0.0.1:8888/swagger/index.html)
111114

112-
```
113-
- node version > v8.6.0
114-
- golang version >= v1.11
115-
- IDE recommendation: Goland
116-
- After you clone the project, use the scripts in directory db to create your own database.
117-
- We recommend you to apply for your own cloud service in QINIU. Replace the public key, private key, warehouse name and default url address with your own, so as not to mess up the test database.
118-
```
115+
- If the internal ip of the server's 177.7.0.12 container is occupied, the place to be modified is
116+
117+
- Replace 177.7.0.12 on line 39 of [docker-compose.yaml](./docker-compose.yaml) with the ip you want
118+
- Replace 177.7.0.12 in line 20 of [.docker-compose/nginx/conf.d/my.conf](./.docker-compose/nginx/conf.d/my.conf) with the ip you want
119+
120+
- docker-compose uses a custom docker network
121+
122+
- ```dockerfile
123+
networks:
124+
network:
125+
ipam:
126+
driver: default
127+
config:
128+
- subnet: '177.7.0.0/16'
129+
```
130+
131+
- Subnet address, the default gateway is 177.7.0.1 (docker-compose V2 needs to write, V3 does not need),For specific information, see the [official document](https://docs.docker.com/compose/compose-file/#ipv4_address-ipv6_address)
132+
133+
- The default network name is gin-vue-admin_network, and the default is bridge mode
134+
135+
- If the subnet is modified, the ipv4_address of each service needs to be modified, and the ip of the server on line 20 of [.docker-compose/nginx/conf.d/my.conf](.docker-compose/nginx/conf.d/my.conf) also needs to be modified
119136
120137
### 2.1 Web
121138
@@ -155,7 +172,7 @@ go get -u github.com/swaggo/swag/cmd/swag
155172
````
156173
157174
##### (2) In mainland China
158-
175+
159176
In mainland China, access to go.org/x is prohibited,we recommend [goproxy.io](https://goproxy.io/zh/)
160177
161178
````bash
@@ -278,7 +295,7 @@ backend code file: model\dnModel\api.go
278295
279296
(1) Development environment course
280297
> Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/
281-
298+
282299
(2) Template course
283300
> Bilibili:https://www.bilibili.com/video/BV16K4y1r7BD/
284301
@@ -293,8 +310,8 @@ backend code file: model\dnModel\api.go
293310
### 8.1 Groups
294311
#### QQ group: 622360840
295312
296-
| QQ group |
297-
| :---: |
313+
| QQ group |
314+
| :---: |
298315
| <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |
299316
300317

README.md

+26-11
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,9 @@ Gin-vue-admin 的成长离不开大家的支持,如果你愿意为 gin-vue-adm
5757
### 1.3 版本列表
5858

5959
- master: 2.0, 用于生产环境
60-
6160
- develop: 2.0, 用于测试环境
62-
63-
- [gin-vue-admin_v2.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 不再兼容 v1.0)
64-
65-
- [gin-vue-admin_v1.0_stable](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_stable) (v1.0停止维护)
66-
67-
- [gin-vue-admin_v1.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_dev) (v1.0停止维护)
68-
61+
- [gin-vue-admin_v2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 [GormV1版本](https://v1.gorm.io)稳定分支)
62+
- [gva_gormv2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gva_gormv2_dev) (v2.0 [GormV2版本](https://v2.gorm.io)开发分支)
6963

7064
## 2. 使用说明
7165

@@ -99,6 +93,7 @@ Gin-vue-admin 的成长离不开大家的支持,如果你愿意为 gin-vue-adm
9993
- ```git
10094
git clone https://github.com/flipped-aurora/gin-vue-admin.git
10195
```
96+
10297
- 使用docker-compose up一键启动启动项目
10398
- ```shell script
10499
# 使用docker-compose启动四个容器
@@ -109,11 +104,31 @@ Gin-vue-admin 的成长离不开大家的支持,如果你愿意为 gin-vue-adm
109104
docker-compose up -d
110105
```
111106

112-
- web项目预览 [http://127.0.0.1:8888/admin](http://127.0.0.1:8888/admin)
107+
- web项目预览 [http://127.0.0.1:8000](http://127.0.0.1:8000)
113108

114109
- swagger文档 [http://127.0.0.1:8888/swagger/index.html](http://127.0.0.1:8888/swagger/index.html)
115110

111+
- 如果server的177.7.0.12这个容器内部ip被占用了,需要修改地方为
112+
113+
- [docker-compose.yaml](./docker-compose.yaml)的第39行的177.7.0.12更换为你想要的ip
114+
- [.docker-compose/nginx/conf.d/my.conf](./.docker-compose/nginx/conf.d/my.conf)的第20行的177.7.0.12更换为你想要的ip
116115

116+
- docker-compose使用自定义的一个docker网络
117+
118+
- ```dockerfile
119+
networks:
120+
network:
121+
ipam:
122+
driver: default
123+
config:
124+
- subnet: '177.7.0.0/16'
125+
```
126+
127+
- 子网地址, 默认网关是177.7.0.1(docker-compose V2需要写,V3则不需要),具体信息看[官方文档](https://docs.docker.com/compose/compose-file/#ipv4_address-ipv6_address)
128+
129+
- 默认的network名为gin-vue-admin_network,默认是bridge模式
130+
131+
- 如果修改了子网,对应的每个service的ipv4_address都需要修改,还有[.docker-compose/nginx/conf.d/my.conf](./.docker-compose/nginx/conf.d/my.conf)的第20行的server的ip也需要修改
117132

118133
### 2.1 web端
119134

@@ -270,7 +285,7 @@ swag init
270285

271286
(1)环境搭建
272287
> Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/ (v1.0版本视频,v2.0操作相同目录不同)
273-
288+
274289
(2)模板使用
275290
> Bilibili:https://www.bilibili.com/video/BV16K4y1r7BD/ (v1.0版本视频,v2.0操作相同目录不同)
276291

@@ -286,7 +301,7 @@ swag init
286301

287302
### QQ交流群:622360840
288303
| QQ 群(满) |
289-
| :---: |
304+
| :---: |
290305
| <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |
291306

292307
### 微信交流群

docker-compose.yaml

+35-4
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,65 @@
11
version: "3.8"
22

3+
networks:
4+
network:
5+
ipam:
6+
driver: default
7+
config:
8+
- subnet: '177.7.0.0/16'
9+
310
services:
11+
web:
12+
build:
13+
context: ./
14+
dockerfile: ./dockerfile_web
15+
container_name: gva-web
16+
restart: always
17+
ports:
18+
- '8000:8000'
19+
depends_on:
20+
- server
21+
command: [ 'nginx-debug', '-g', 'daemon off;' ]
22+
networks:
23+
network:
24+
ipv4_address: 177.7.0.11
25+
426
server:
527
build:
628
context: ./
729
dockerfile: ./dockerfile_server
8-
container_name: gva-server # 容器名
30+
container_name: gva-server
931
restart: always
1032
ports:
1133
- '8888:8888'
1234
depends_on:
1335
- mysql
1436
- redis
37+
networks:
38+
network:
39+
ipv4_address: 177.7.0.12
1540

1641
mysql:
1742
image: mysql:8.0.21
1843
container_name: gva-mysql
1944
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集
2045
restart: always
2146
ports:
22-
- "13306:3306" # host物理直接映射端口为6606
47+
- "13306:3306" # host物理直接映射端口为13306
2348
environment:
2449
MYSQL_DATABASE: 'qmPlus' # 初始化启动时要创建的数据库的名称
2550
MYSQL_ROOT_PASSWORD: 'Aa@6447985' # root管理员用户密码
2651
volumes:
27-
- '.docker-compose/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d'
52+
- '.docker-compose/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d'
53+
networks:
54+
network:
55+
ipv4_address: 177.7.0.13
2856

2957
redis:
3058
image: redis:6.0.6
3159
container_name: gva-redis # 容器名
3260
restart: always
3361
ports:
34-
- '6379:6379'
62+
- '6379:6379'
63+
networks:
64+
network:
65+
ipv4_address: 177.7.0.14

docker/docker-start.sh

100755100644
File mode changed.

0 commit comments

Comments
 (0)