You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-29Lines changed: 29 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,73 +4,74 @@
4
4
5
5
## Introduction
6
6
7
-
### This project is used by the Google Cloud Platform team to demonstrate different services within Google Cloud. This project contains two versions of the same application, one architected as a monolith and the other as a set of microservices.
7
+
### This project is used by the Google Cloud Platform team to demonstrate different services within Google Cloud. This project contains two versions of the same application, one architected as a monolith and the other as a set of microservices
8
8
9
9
## Setup
10
10
11
-
```
11
+
### NOTE: Make sure you have a newer version of NodeJS (16.13.0) or newer
####To run the monolith project use the following commands from the top level directory:
21
+
### To run the monolith project use the following commands from the top level directory
20
22
21
-
```
23
+
```bash
22
24
cd monolith
23
25
npm start
24
26
```
25
27
26
-
#### You should see output similar to the following:
28
+
You should see output similar to the following
27
29
28
-
```
30
+
```text
29
31
Monolith listening on port 8080!
30
32
```
31
33
32
-
#### That's it! You now have a perfectly functioning monolith running on your machine!
34
+
#### That's it! You now have a perfectly functioning monolith running on your machine
33
35
34
-
### Docker
36
+
### Docker - Monolith
35
37
36
-
#### To create a Docker image for the monolith, execute the following commands:
38
+
#### To create a Docker image for the monolith, execute the following commands
37
39
38
-
```
40
+
```bash
39
41
cd monolith
40
42
docker build -t monolith:1.0.0 .
41
43
```
42
44
43
-
#### To run the Docker image, execute the following commands:
45
+
To run the Docker image, execute the following commands
44
46
45
-
```
47
+
```bash
46
48
docker run --rm -p 8080:8080 monolith:1.0.0
47
49
```
48
50
49
-
50
51
## Microservices
51
52
52
-
### To run the microservices project use the following commands from the top level directory:
53
+
### To run the microservices project use the following commands from the top level directory
53
54
54
-
```
55
+
```bash
55
56
cd microservices
56
57
npm start
57
58
```
58
59
59
-
### You should see output similar to the following:
60
+
You should see output similar to the following
60
61
61
-
```
62
+
```text
62
63
[0] Frontend microservice listening on port 8080!
63
64
[2] Orders microservice listening on port 8081!
64
65
[1] Products microservice listening on port 8082!
65
66
```
66
67
67
-
### That's it! You now have a perfectly functioning set of microservices running on your machine!
68
+
### That's it! You now have a perfectly functioning set of microservices running on your machine
68
69
69
-
### Docker
70
+
### Docker - Microservices
70
71
71
-
####To create a Docker image for the mmicroservices, you will have to create a Docker image for each service. Execute the following commands for each folder under the microservices folder.
72
+
### To create a Docker image for the microservices, you will have to create a Docker image for each service. Execute the following commands for each folder under the microservices folder
72
73
73
-
```
74
+
```bash
74
75
cd microservices/src/frontend
75
76
docker build -t frontend:1.0.0 .
76
77
@@ -81,17 +82,17 @@ cd ../orders
81
82
docker build -t orders:1.0.0 .
82
83
```
83
84
84
-
#### To run the Docker image, execute the following commands:
85
+
To run the Docker image, execute the following commands
85
86
86
-
```
87
+
```bash
87
88
docker run -d --rm -p 8080:8080 monolith:1.0.0
88
89
docker run -d --rm -p 8081:8081 orders:1.0.0
89
90
docker run -d --rm -p 8082:8082 products:1.0.0
90
91
```
91
92
92
-
#### To stop the containers, you will need to find the CONTAINER ID for each and stop them individually. See the steps below:
93
+
#### To stop the containers, you will need to find the CONTAINER ID for each and stop them individually. See the steps below
93
94
94
-
```
95
+
```bash
95
96
docker ps -a
96
97
97
98
CONTAINER ID IMAGE COMMAND CREATED
@@ -104,13 +105,12 @@ docker stop d7886598dbe2
104
105
docker stop d85756f57265
105
106
```
106
107
107
-
108
108
## React App
109
109
110
-
####The react-app folder contains a React application created from `create-react-app`. You can modify this fronted, but afterwards, you will need to build and move the static files to the monolith and microservices project. You can do this by running the standard create-react-app build command below:
110
+
### The react-app folder contains a React application created from `create-react-app`. You can modify this fronted, but afterwards, you will need to build and move the static files to the monolith and microservices project. You can do this by running the standard create-react-app build command below
111
111
112
-
```
112
+
```bash
113
113
npm run build
114
114
```
115
115
116
-
#### This will run the build script to create the static files two times. The first will build with relative URLs and copy the static files to the monolith/public folder. The second run will build with the standard microservices URLs and copy the static files to the microservices/src/frontned/public folder.
116
+
#### This will run the build script to create the static files two times. The first will build with relative URLs and copy the static files to the monolith/public folder. The second run will build with the standard microservices URLs and copy the static files to the microservices/src/frontend/public folder
0 commit comments