Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: Script Fails to Initialize keploy-network without Active Docker Session #1701

Open
1 task done
hanzili opened this issue Mar 17, 2024 · 4 comments · May be fixed by #1710
Open
1 task done

[bug]: Script Fails to Initialize keploy-network without Active Docker Session #1701

hanzili opened this issue Mar 17, 2024 · 4 comments · May be fixed by #1710
Labels
bug Something isn't working keploy

Comments

@hanzili
Copy link

hanzili commented Mar 17, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

The installation script includes creating keploy-network, which requires Docker to be started. However, the script currently does not verify if Docker is active before attempting this operation. This oversight can lead to the script's failure to initialize keploy-network, leaving the user without clear guidance on the cause of the failure or the fact that Docker must be running for successful execution.

Steps to reproduce

  1. Before executing the script, make sure that Docker is not running by executing docker ps.
  2. Run the installation script. Since Docker is not running, the script attempts to proceed without a running Docker daemon, which is necessary for the creation and configuration of the keploy-network.
  3. Attempt to run a Docker container that depends on the keploy-network network using keploy.
  4. Observing the log, you will see
🐰 Keploy: 2024-03-17T02:36:46Z         INFO    trying to inject network:keploy-networ to the keploy container
🐰 Keploy: 2024-03-17T02:36:46Z         ERROR   could not inject application network to the keploy container
🐰 Keploy: 2024-03-17T02:36:46Z         ERROR   failed to inject network:keploy-network to the keploy container
🐰 Keploy: 2024-03-17T02:36:46Z         ERROR   unknown error recieved from application {"error": "Error response from daemon: network keploy-networ not found"}

Environment

None

Version

Cloud

Repository

keploy

@hanzili hanzili added the bug Something isn't working label Mar 17, 2024
@hanzili
Copy link
Author

hanzili commented Mar 17, 2024

According to my knowledge, I can think of two solution

  1. Modify the script to include a pre-check that verifies docker is running before creation. At the same time, we should update the doc to inform users to start docker
  2. For a more automated approach, the script could attempt to start docker if it's found to be not running, while this method could vary by the user's operating system.

@shivamsouravjha
Copy link
Contributor

shivamsouravjha commented Mar 18, 2024

2nd approach doesn't seem valid as we don't want to be running core operations.
In the first approach we can log in the script itself that docker isn't up.

Would you like to work on this issue?

@hanzili
Copy link
Author

hanzili commented Mar 18, 2024

Oh never mind! Just take a closer look into the script, I realize there is pre-check for docker already. I just missed the log for missing docker while executing the script

 curl -O https://raw.githubusercontent.com/keploy/keploy/main/keploy.sh && source keploy.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7421  100  7421    0     0  82648      0 --:--:-- --:--:-- --:--:-- 83382
Please start Docker and reinstall keploy if you have applications running on docker

       ▓██▓▄
    ▓▓▓▓██▓█▓▄
     ████████▓▒
          ▀▓▓███▄      ▄▄   ▄               ▌
         ▄▌▌▓▓████▄    ██ ▓█▀  ▄▌▀▄  ▓▓▌▄   ▓█  ▄▌▓▓▌▄ ▌▌   ▓
       ▓█████████▌▓▓   ██▓█▄  ▓█▄▓▓ ▐█▌  ██ ▓█  █▌  ██  █▌ █▓
      ▓▓▓▓▀▀▀▀▓▓▓▓▓▓▌  ██  █▓  ▓▌▄▄ ▐█▓▄▓█▀ █▓█ ▀█▄▄█▀   █▓█
       ▓▌                           ▐█▌                   █▌
        ▓

version: 2.0.0-alpha78


Golang Application
        Record:
        keploy record -c "/path/to/user/app/binary"

        Test:
        keploy test -c "/path/to/user/app/binary" --delay 2

Node Application
        Record:
        keploy record -c “npm start --prefix /path/to/node/app"

        Test:
        keploy test -c “npm start --prefix /path/to/node/app" --delay 2

Java
        Record:
        keploy record -c "java -jar /path/to/java-project/target/jar"

        Test:
        keploy test -c "java -jar /path/to/java-project/target/jar" --delay 2

Docker
        Record:
        keploy record -c "docker run -p 8080:8080 --name <containerName> --network <networkName> <applicationImage>" --buildDelay 1m

        Test:
        keploy test -c "docker run -p 8080:8080 --name <containerName> --network <networkName> <applicationImage>" --delay 1 --buildDelay 1m


Note: If installed keploy without One Click Install, use "keploy example --customSetup true"

Please start Docker and reinstall keploy if you have applications running on docker is actually there! Do you think it is necessary to add a warning here about docker? @shivamsouravjha
image

@shivamsouravjha
Copy link
Contributor

Agreed this can be missed, you can try putting focus on the log, thus if we make this log noticeable change in docs won't be required

@hanzili hanzili linked a pull request Mar 18, 2024 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working keploy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants