From 45f020da20caf8731f986f5d513a04eecbea64e5 Mon Sep 17 00:00:00 2001 From: Khushi Trivedi <76205733+trivedi-khushi@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:06:44 +0530 Subject: [PATCH 1/3] Added container name in docker-compose.yml Container name for database not given in this file. Thus, unable to start the application. --- fastapi-postgres/docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fastapi-postgres/docker-compose.yml b/fastapi-postgres/docker-compose.yml index 80ec447..fd49830 100644 --- a/fastapi-postgres/docker-compose.yml +++ b/fastapi-postgres/docker-compose.yml @@ -3,6 +3,7 @@ services: postgres: image: postgres:latest + container_name: postgres environment: POSTGRES_DB: studentdb POSTGRES_USER: postgres @@ -30,4 +31,4 @@ services: networks: keploy-network: - external: true \ No newline at end of file + external: true From dc6f90071bfc158599d151bc1da9758e151f427a Mon Sep 17 00:00:00 2001 From: Khushi Trivedi <76205733+trivedi-khushi@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:41:10 +0530 Subject: [PATCH 2/3] Updating changes in README.md When running natively on docker, changes need to be done in main.py & database.py from local host to container name. --- fastapi-postgres/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fastapi-postgres/README.md b/fastapi-postgres/README.md index ebe959d..64a5a06 100644 --- a/fastapi-postgres/README.md +++ b/fastapi-postgres/README.md @@ -32,6 +32,9 @@ curl -O -L https:///keploy.io/install.sh && source install.sh docker-compose up -d ``` +> **Since we have setup our sample-app natively, we need to update the container name to postgres on line 6, in `application/database.py`, from `postgresql://postgres:postgres@localhost:5432/studentdb` to `postgresql://postgres:postgres@postgres:5432/studentdb`.** +> **Also, we need to update the container name to postgres on line 11, of `application/main.py`, from `postgresql://postgres:postgres@localhost:5432/studentdb` to `postgresql://postgres:postgres@postgres:5432/studentdb`.** + ### Capture the Testcases This command will start the recording of API calls : From 500891cc95510c64e3232dd4a69086cc63f579b2 Mon Sep 17 00:00:00 2001 From: Khushi Trivedi <76205733+trivedi-khushi@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:42:03 +0530 Subject: [PATCH 3/3] Update README.md --- fastapi-postgres/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/fastapi-postgres/README.md b/fastapi-postgres/README.md index 64a5a06..b1ccbf3 100644 --- a/fastapi-postgres/README.md +++ b/fastapi-postgres/README.md @@ -33,6 +33,7 @@ docker-compose up -d ``` > **Since we have setup our sample-app natively, we need to update the container name to postgres on line 6, in `application/database.py`, from `postgresql://postgres:postgres@localhost:5432/studentdb` to `postgresql://postgres:postgres@postgres:5432/studentdb`.** + > **Also, we need to update the container name to postgres on line 11, of `application/main.py`, from `postgresql://postgres:postgres@localhost:5432/studentdb` to `postgresql://postgres:postgres@postgres:5432/studentdb`.** ### Capture the Testcases