Skip to content

Commit cc522c8

Browse files
committed
Mass update, restructure all folders
1 parent 7981388 commit cc522c8

38 files changed

+111
-108
lines changed

.vscode/launch.json

Lines changed: 0 additions & 46 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 0 additions & 2 deletions
This file was deleted.

.vscode/tasks.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

ReadMe.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# Demo hệ thống Microservice
22

33
Hệ thống sẽ gồm có các container như sau:
4-
1. Nginx đóng vai trò reverse proxy: thầy Cường
5-
2. Node app cổng 8000 kết nối vào CSDL Mongo DB: cô Linh
6-
3. Golang app cổng 8001 kết nối vào CSDL Postgresql: chú Long
7-
4. ASP.net MVC Core cổng 8002 kết nối vào CSDL Microsoft SQL Server 2017: thầy Huy
4+
1. Nginx đóng vai trò reverse proxy, host: api_gateway
5+
2. Node.js REST, host api_customer, phục vụ ở cổng 8000, kết nối vào CSDL Mongo DB
6+
3. Golang REST, host api_book, phục vụ ở cổng 8001, kết nối vào CSDL Postgresql host go_db
7+
4. ASP.net MVC Core REST, host course,cổng 8002 kết nối vào CSDL Microsoft SQL Server 2017, host
88

99
```
1010
+-----------------+ +-------------+
1111
/customer/| | | |
12-
+---------> nodeapp:8000 +-----------> mongoDB |
12+
+---------> Node.js:8000 +-----------> mongoDB |
1313
| | | | |
1414
| +-----------------+ +-------------+
1515
|
1616
+-------------+ | +-----------------+ +-------------+
1717
| | |/book/ | | | |
18-
| Nginx Proxy +------------> goapp:8001 +-----------> PostgreSQL |
18+
| Nginx Proxy +------------> Golang:8001 +-----------> PostgreSQL |
1919
| | | | | | |
2020
+-------------+ | +-----------------+ +-------------+
2121
|
2222
| +-----------------+ +-------------+
2323
|/blog/ | | | |
24-
+---------> asp.net:8002 +-----------> MS-SQL2017 |
24+
+---------> Asp.net:8002 +-----------> MS-SQL2017 |
2525
| | | |
2626
+-----------------+ +-------------+
2727
X
@@ -36,13 +36,13 @@ Hệ thống sẽ gồm có các container như sau:
3636
Git Repo
3737
+
3838
|
39-
+---+nginx
39+
+---+gateway
4040
|
41-
+---+node
41+
+---+customer
4242
|
43-
+---+go
43+
+---+book
4444
|
45-
+---+net
45+
+---+course
4646
|
4747
+---+documents
4848
|
@@ -55,7 +55,10 @@ Git Repo
5555

5656
```
5757
git clone https://github.com/TechMaster/DemoMicroservice.git
58+
docker-compose up -d
5859
```
60+
Lệnh trên sẽ khởi động gateway và các REST service.
61+
5962
Kiểm tra NodeApp container chạy ok không thì vào thư mục node, chạy file build.sh nếu có dữ
6063
liệu trả về là ok
6164
```

go/ReadMe.md renamed to book/ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Trong file docker_compose.yml tạo ra một Postgresql server có host name là
55
# Chạy thử
66
Kéo source code về, build và run bằng docker-compose:
77
```
8-
cd go/api_db
8+
cd book/api_book
99
docker-compose up -d
1010
curl http://localhost:8001/books
1111
```
@@ -16,7 +16,7 @@ curl http://localhost:8001/books
1616
- Bước 2: copy file binary biên dịch bước 1 vào container sử dụng image gọn hơn là alpine:latest
1717
Tham khảo [Docker multi stage build](https://docs.docker.com/engine/userguide/eng-image/multistage-build/)
1818
- Truyền tham số động vào container chứ không viết cứng nhắc trong file mã nguồn go.
19-
Đoạn code trong file go/api_db/api/vendor/database/init.go rất khó bảo trì
19+
Đoạn code trong file go/api_book/api/vendor/database/init.go rất khó bảo trì
2020
```go
2121
connectionParams := "dbname=" + dbname + " user=docker password=docker sslmode=disable host=go_db"
2222
```
File renamed without changes.

go/api_db/api/api.go renamed to book/api_book/api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func indexPostHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Param
3838

3939
func indexHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
4040
setCors(w)
41-
fmt.Fprintf(w, "This is the api")
41+
fmt.Fprintf(w, "<h1>Book REST API by Golang</h1>")
4242
}
4343

4444
func setCors(w http.ResponseWriter) {
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)