File tree Expand file tree Collapse file tree 5 files changed +44
-9
lines changed Expand file tree Collapse file tree 5 files changed +44
-9
lines changed Original file line number Diff line number Diff line change
1
+ JWT_SECRET=vitabletech-secret-key
2
+ PORT=5000
3
+ DB_HOST=db
4
+ DB_USER=root
5
+ DB_PASSWORD=notSecureChangeMe
6
+ DB_NAME=testdb
7
+ DB_DIALECT=mysql
8
+ DB_POOL_MAX=5
9
+ DB_POOL_MIN=0
10
+ DB_POOL_ACQUIRE=30000
11
+ DB_POOL_IDLE=10000
12
+ NODE_ENV=development
13
+ APP_PORT=80
14
+ PHPMYADMIN_PORT=8081
15
+
16
+ GIT_USERNAME=msrajawat298
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ git clone https://github.com/vitabletech/node-express-api-bootstrap.git
22
22
cd node-express-api-bootstrap
23
23
```
24
24
25
- 3 . Edit the ` .env ` file to configure your environment variables. You may also need to adjust the ` docker-compose.yml ` file if you wish to use non-default settings.
25
+ 3 . Rename ` .env_sample ` to .env andEdit the ` .env ` file to configure your environment variables. You may also need to adjust the ` docker-compose.yml ` file if you wish to use non-default settings.
26
26
27
27
## Running the Application
28
28
@@ -45,14 +45,14 @@ docker exec -it vitabletech-node-app /bin/bash
45
45
5 . Inside the container, run the following command to synchronize the database:
46
46
47
47
``` bash
48
- npm run sync-db
48
+ npm run sync-db && npm run seed
49
49
```
50
50
51
51
This command will automatically create the required tables.
52
52
53
53
6 . Once the database synchronization is complete, you can start working on the application.
54
54
55
- 7 . Access the Node.js application at [ http://localhost:3000 / ] ( http://localhost:3000 / ) .
55
+ 7 . Access the Node.js application at [ http://localhost/ ] ( http://localhost/ ) .
56
56
57
57
## Enjoy!
58
58
Original file line number Diff line number Diff line change 3
3
"username" : " root" ,
4
4
"password" : " notSecureChangeMe" ,
5
5
"database" : " testdb" ,
6
- "host" : " localhost " ,
6
+ "host" : " db " ,
7
7
"dialect" : " mysql" ,
8
8
"logging" : " console.log"
9
9
},
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ services:
7
7
volumes :
8
8
- .:/app
9
9
working_dir : /app
10
- command : bash -c "npm install && npm run dev "
10
+ command : bash -c "chmod +x ./setup.sh && ./setup.sh "
11
11
ports :
12
- - 3000:3000
12
+ - " ${APP_PORT}:${PORT} " # Use the port number defined in .env for the host
13
13
env_file :
14
14
- .env
15
15
@@ -20,15 +20,15 @@ services:
20
20
ports :
21
21
- 3306:3306
22
22
environment :
23
- MYSQL_ROOT_PASSWORD : notSecureChangeMe
23
+ MYSQL_ROOT_PASSWORD : ${DB_PASSWORD}
24
24
25
25
phpmyadmin :
26
26
container_name : vitabletech-phpmyadmin
27
27
image : phpmyadmin
28
28
restart : always
29
29
ports :
30
- - 8080 :80
30
+ - ${PHPMYADMIN_PORT} :80
31
31
environment :
32
32
PMA_ARBITRARY : 1
33
33
PMA_USER : root
34
- PMA_PASSWORD : notSecureChangeMe
34
+ PMA_PASSWORD : ${DB_PASSWORD}
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+
4
+ # Set up Git
5
+ git config --global user.email $GIT_EMAIL
6
+ git config --global user.name $GIT_USERNAME
7
+
8
+ # Install dependencies
9
+ npm install
10
+
11
+ # Run the appropriate command based on the NODE_ENV variable
12
+ if [[ $NODE_ENV == ' development' ]]; then
13
+ npm run dev
14
+ else
15
+ npm start
16
+ fi
17
+
18
+ # Keep the container running
19
+ tail -f /dev/null
You can’t perform that action at this time.
0 commit comments