File tree 4 files changed +11
-10
lines changed
4 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,8 @@ services:
12
12
ports :
13
13
- " 3000:3000"
14
14
environment :
15
- - name=postgres
16
- - password=secret
17
15
- host=db
16
+ - name=postgres
18
17
- dbname=postgres
19
18
20
19
db :
@@ -23,7 +22,7 @@ services:
23
22
environment :
24
23
- POSTGRES_DB=postgres
25
24
- POSTGRES_USER=postgres
26
- - POSTGRES_PASSWORD=secret
25
+ - POSTGRES_HOST_AUTH_METHOD=trust
27
26
volumes :
28
27
- ./db/:/opt/
29
28
- ./scripts/upload.sh:/opt/upload.sh
Original file line number Diff line number Diff line change
1
+ import os
1
2
DB = {
2
- "name" : "postgres" ,
3
- "user" : "postgres" ,
4
- "password" : "secret" ,
5
- "host" : "db"
3
+ "name" : str (os .getenv ("name" , "postgres" )),
4
+ "user" : str (os .getenv ("user" , "postgres" )),
5
+ "host" : str (os .getenv ("host" , "localhost" ))
6
6
}
Original file line number Diff line number Diff line change 11
11
def get_db_conn (db_config ):
12
12
""" Create a database connection. """
13
13
return psycopg2 .connect (
14
- "dbname='{}' user='{}' password='{}' host='{}'" .format (
14
+ "dbname='{}' user='{}' host='{}'" .format (
15
15
db_config ["name" ],
16
16
db_config ["user" ],
17
- db_config ["password" ],
18
17
db_config ["host" ]
19
18
)
20
19
)
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
echo " ** Starting the app and db"
3
3
docker compose up -d
4
+
4
5
echo " ** Sleeping for 10 sec to ensure db services are running before uploading dump data"
5
6
sleep 10
7
+
6
8
echo " ** Uploading dump data & then sleeping for 5 sec **"
7
9
docker compose exec db /bin/bash ./opt/upload.sh
8
10
sleep 5
9
- echo " Performing Health Check on the App"
11
+
12
+ echo " ** Performing Health Check on the App **"
10
13
curl " http://127.0.0.1:3000/"
You can’t perform that action at this time.
0 commit comments