Skip to content

Conversation

@Srinu346
Copy link

Summary

Adds Dockerfile and docker-compose support to the fasthttp-postgres quickstart for easier setup.

Changes

  • Added Dockerfile to build and run the FastHTTP Go application.
  • Updated docker-compose to start the app with PostgreSQL.
  • Updated the README to reflect the Docker-based setup and Keploy usage.

Fixes

url

Screenshots

image

@Srinu346 Srinu346 force-pushed the fix/fasthttp-postgress-docker-setup branch from 7ba293b to f6ab8f5 Compare December 22, 2025 15:07
Copy link
Contributor

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346 , the changes look good overall 👍

A couple of suggestions:

  • Please avoid using the latest Alpine image in the Dockerfile and switch to a specific version instead.

  • The README should cover two ways to run the app:

    1. Using Docker Compose
    2. Running the app without Docker
      Currently, it only documents the Docker Compose method.
  • Please remove the gocoverage command from the Keploy test command. We don’t have a gocoverage flag when running Keploy via the Docker Compose method.

@Srinu346 Srinu346 force-pushed the fix/fasthttp-postgress-docker-setup branch from 9e3cfee to f6ab8f5 Compare December 24, 2025 10:45
Signed-off-by: Akella Srinivas <[email protected]>
@Srinu346
Copy link
Author

@Achanandhi-M sir made the described changes, please take a look.

Signed-off-by: Akella Srinivas <[email protected]>
Signed-off-by: Akella Srinivas <[email protected]>
Copy link
Contributor

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346,

Could you please update the README when you get a chance? It would be great if it could include both the record and replay commands, along with the appropriate curl commands for testing.

@Srinu346
Copy link
Author

@Achanandhi-M sir
I think I’ve already updated the README to include both Keploy record and replay (keploy test) commands, along with curl examples for generating test cases (POST and GET requests).
fasthttp-postgres-combined-regenerated


Capture testcases:
```shell
keploy record -c "docker-compose up" --container-name=fasthttp_app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346 I noticed that there’s no keploy test command mentioned in option 1, and there are also no curl commands provided. Could you please clarify how users are expected to test this without the curl commands?


Run With Docker:
```shell
keploy test -c "docker-compose up" --container-name=fasthttp_app --delay 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the keploy test Docker Compose up command has been added in option 2, but the Docker setup isn’t mentioned. Could you please clarify how this is expected to work?

Copy link
Contributor

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346,

Users should be able to navigate clearly in both the Docker and non-Docker setups. Could you please add the curl commands for both setups and clearly mention the steps? Also, please go through the comments carefully. Also please sign the DCO

Signed-off-by: Akella Srinivas <[email protected]>
@Srinu346 Srinu346 force-pushed the fix/fasthttp-postgress-docker-setup branch from 1f31070 to 5d01bd0 Compare December 30, 2025 09:23
@Srinu346
Copy link
Author

Hello @Achanandhi-M sir,

My initial assumption was to keep the steps till keploy record and the curl commands common for both Docker and non-Docker setups, and then split only at the testing stage. I see now that this makes the flow unclear.

image

Now I’ve updated the flow and clearly split the Docker and non-Docker paths separately now. Each Path independently includes:
Run server → Record → curl commands -> Replay(Test)

image

Thanks for the review.

Copy link
Contributor

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Srinu346, could you please fix the issues I mentioned and refer to the Keploy docs while doing so? It would be great if you could test everything from your side before raising the PR, as it helps save reviewers’ time. Thank you for understanding. also please fix the linter issue


```shell
keploy test -c "./app" --goCoverage --delay 10
keploy test -c "go run main.go" --goCoverage --delay 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346, could you please update the test command and remove --goCoverage? We’ve removed it recently.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed it now sir.

#### Start the Postgres container:
```bash
go build -cover
docker-compose up -d postgres
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docker-compose command is deprecated. Please use the docker compose command instead. Kindly try it from your side, and if it works, proceed with the changes.

Copy link
Author

@Srinu346 Srinu346 Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed all the docker-compose to docker compose . I have also checked them by running on my machine.


### Option 2: Run Without Docker

> Note: When running the app locally, ensure `DB_HOST=localhost` is set in the environment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement isn’t very clear about where the environment variables should be added. The environment variables should be added inside the Postgres service.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I have removed that line completely, sir.
When the application is run fully using Docker, these values are injected automatically via Docker Compose (as shown below).

image

Otherwise, the application falls back to the default values, so there is no need for users to manually set the environment variables.
image

Please let me know if this approach looks fine or if you’d prefer the environment variables to be explicitly documented instead.


#### Run the application:
```bash
go run main.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t need a separate command to run the application. Keploy starts the app automatically when it runs, so please remove this line. For more context, kindly refer to the Quickstart documentation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK sir i have removed them.

#### Start the server:
```bash
sudo docker-compose up -d postgres
docker-compose up --build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t need a separate command to run the application. Keploy starts the app automatically when it runs, so please remove this line. For more context, kindly refer to the Quickstart documentation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK sir i have removed them.

@Srinu346 Srinu346 force-pushed the fix/fasthttp-postgress-docker-setup branch from 515dde3 to 5d01bd0 Compare January 6, 2026 06:39
Signed-off-by: Akella Srinivas <[email protected]>
@Srinu346
Copy link
Author

Srinu346 commented Jan 6, 2026

@Achanandhi-M sir, I’ve gone through the Keploy quickstart guide and updated the commands accordingly. I’ve also fixed the lint issues and addressed the above review comments.

Please let me know if any further changes are needed.

Copy link
Contributor

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346, the changes look really great—nice work! I just have one piece of feedback.

In the Option 2 setup, the user needs to create a .env file to pass the environment variables, but this isn’t mentioned clearly in the README. As a first-time user following the guide, I wasn’t able to run it successfully.

Have you tried this from your side? Is it working fine for you?

@Srinu346
Copy link
Author

Srinu346 commented Jan 6, 2026

Thanks for the feedback, sir.

In Option 2, when PostgreSQL is started via Docker using the provided docker-compose setup, there is actually no strict requirement to create a .env file. The application already has sensible defaults for all database-related environment variables:

DB_HOST defaults to localhost

DB_PORT defaults to 5432

DB_USER defaults to postgres

DB_PASSWORD defaults to password

DB_NAME defaults to db

image

These defaults match the credentials with which the PostgreSQL service is started in Docker, so the application works even if no .env file or environment variables are provided.

A .env file or explicit environment variables are only required if the user wants to connect to a PostgreSQL instance that differs from the Docker-provided setup (for example, an external or custom database).

I’ve tested this flow from my side and it works as expected.

Screen.Recording.2026-01-06.142355.mp4

@Achanandhi-M
Copy link
Contributor

Hey @Srinu346, could you please confirm by running it with Keploy? Also, please try running the first method followed by the second method. I just want to confirm everything is working properly before merging the PR.

@Srinu346
Copy link
Author

Srinu346 commented Jan 6, 2026

After your review sir, I revisited the setup and realized that Keploy does not automatically pick up environment variables from docker-compose.yml, which is why the .env file was added and the README updated accordingly.

First method

Screen.Recording.2026-01-06.144900.mp4

Second method

Screen.Recording.2026-01-06.154836.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants