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
cd project-name/ && sudo docker-compose --file docker-compose-dev.yml up
@@ -75,20 +75,29 @@ cd project-name/ && sudo docker-compose --file docker-compose-dev.yml up
75
75
76
76
## Client
77
77
78
-
Client has been created with create-react-app and located in ./project-name/client
79
-
In develpoment mode it will be run in a container built with ./client/Dockerfile.dev and will be exposed on port 3000.
80
-
In production mode a client build will be created and will run in a container built with ./client/Dockerfile the client build/static-files and will be served with nginx server and will be exposed on port 80.
78
+
Client has been created with create-react-app and located in `./project-name/client`
81
79
82
-
Enviornment variables can be moved into running dockerfile itself under ENV or can be decalred in the docker compose file under enviornemt property
80
+
#### Development
81
+
82
+
In develpoment mode cleient will be run in a container built with `./client/Dockerfile.dev` and will be exposed on port 3000, with docker volumes every on save change will be reflected within the running container.
83
+
84
+
#### Production
85
+
86
+
In production mode a client build will be created and will run in a container built with `./client/Dockerfile`.
87
+
The client build/static-files will be served with nginx server and will be exposed on port 80.
88
+
89
+
#### Environment Variables
90
+
91
+
Enviornment variables are located in `./client/.env` but can be declared into the dockerfile itself under ENV or in the docker compose file under enviornemt property
83
92
84
93
**note that nginx server has a minimalistic configuration**
85
94
86
-
## Database
95
+
## Data-base
87
96
88
97
Postgres data-base is created with an official postgres image which can be found in docker hub https://hub.docker.com/_/postgres
89
98
the data-base will be initialized with ./database/initdb.sql script. feel free to change it to your own needs.
90
99
91
-
Enviornment variables will be located in ./database/.env
100
+
Enviornment variables will be located in `./database/.env`
92
101
and will contain our database credentials :
93
102
94
103
```
@@ -97,25 +106,32 @@ POSTGRES_PASSWORD=admin
97
106
POSTGRES_DB=pern_db
98
107
```
99
108
100
-
Volumes of our database will be located in ./database/data
109
+
Volumes of our database will be located in `./database/data`
101
110
102
-
> Production volume is located in ./data/prod
103
-
> </br>
104
-
> Development volume is located in ./data/dev
111
+
> Production volume is located in `./data/prod` > </br>
112
+
> Development volume is located in `./data/dev`
105
113
106
114
## Server
107
115
108
116
Server is located in ./projec-name/server using express.
109
117
110
-
- In development mode it will run in a container built with ./server/Dockerfile.dev.
111
-
dev mode server will be exposed on port 5500 to the "outside" world and will use volumes for data persistent.
112
-
- In Production mode it will run in a container built with ./server/Dockerfile.
113
-
prod mode server will be exposed on port 5500 only to the docker composer internal services. as well using volumes for data persistent.
118
+
#### Development
119
+
120
+
In development mode it will run in a container built with `./server/Dockerfile.dev`.
121
+
dev mode server will be exposed on port 5500 to the "outside" world and will use volumes for data persistent.
122
+
123
+
#### Production
124
+
125
+
In production mode the server will run in a container built with `./server/Dockerfile`.
126
+
and be exposed on port 5500 only to the docker composer internal services within the same network.
127
+
in our case server and client are on the same network "webapp" , hence only the client can communicate with the server.
128
+
129
+
#### Environment
114
130
115
131
Enviornment variables will be located in ./server/.env
116
-
and will contain postgres credentials to establish connection to our databse.
117
-
with our wait-for-it.sh script the server image will run only after getting confirmation that postgres container is available.
118
-
by that we wont get connection failures due to wrong order of docker composing.
132
+
and will contain postgres credentials to establish connection to our data-base.
133
+
Thanks to https://github.com/vishnubob/wait-for-it for the wait-for-it.sh script, we can set that the server image will run only after getting confirmation that postgres container is available.
134
+
by that we wont get connection failures due to bad order of docker composing.
119
135
120
136
## Docker compose
121
137
@@ -142,7 +158,7 @@ This will creates build for both server and client, will serve client build with
142
158
143
159
## Demo
144
160
145
-
Demo is a simple Todolist using react as our front express as backend and postgres as our database
161
+
Demo is a simple Todolist using React and Material-UI on client side, express on backend and postgres as our database
146
162
demo can be started in development mode and in production mode as well.
0 commit comments