middlewarehq / middleware

✨ Open-source dev productivity platform for engineering teams ✨
https://middlewarehq.com
Apache License 2.0
390 stars 32 forks source link

dev.sh not working properly when using latest version of docker #383

Closed sidtohan closed 1 week ago

sidtohan commented 1 month ago

Description:

Unable to run the dev.sh script. It gives an error in the docker-compose.yml file as well as an issue with the "watch" command.

Steps to reproduce:

  1. Start docker using docker desktop (currently using version 4.30.0-amd64)
  2. Go to the root path of the repository and run dev.sh using ./dev.sh

Expected behavior:

dev.sh should start the application with the development environment.

Actual behavior:

image

Server Setup Information:

Additional context

I came across this discussion on stack overflow. Maybe the current code uses an older version of docker compose?

Also, found this in the cli/source/app.tsx file:

image

jayantbh commented 1 month ago

Hey @sidtohan! 👋🏽 We'd be happy to help you with this. Could you share the output of docker version with us?

Generally this issue was solved by simply asking people to update to the latest version of docker in the past. But you're mentioning you're already on the latest version.

However, you also mentioned that you're on Pop!_OS 22.04 LTS which might simply not have a build for the version of docker that contains the watch command yet, making the latest version be not the actually latest release of docker.

For reference: The latest docker version listed online appears to be 24.0.9

sidtohan commented 1 month ago

image

Here is the output for docker version command.

adnanhashmi09 commented 1 month ago

Thanks @sidtohan for submitting the issue. The problem seems to be related to the version of docker installed. It is actually better if we move to using docker compose instead of docker-compose as the docker-compose project has probably stopped receiving updates.

We could make the changes so that even older versions of docker and docker-compose is supported.

The differences between docker-compose and docker compose can be found here

adnanhashmi09 commented 1 month ago

I also think this is a good point to make some prerequisite checks before starting the container for development. This way we could provide better troubleshooting experience for the user. the prerequisite checks could include:

We should make a separate issue for that. @jayantbh what are your thoughts?

jayantbh commented 1 month ago

Yea, a checklist that is part of the dev.sh script might work well to prevent similar issues.

Also, previously I had mentioned that the latest version is 24.0.7. My bad, the latest is actually 26.1.3, and @sidtohan's version appears to be pretty close to that.

Perhaps as a fix to this at the moment, we should change the command from docker-compose to docker compose instead.

Think that'll work? @adnanhashmi09 @sidtohan

adnanhashmi09 commented 1 month ago

Yea, a checklist that is part of the dev.sh script might work well to prevent similar issues.

Also, previously I had mentioned that the latest version is 24.0.7. My bad, the latest is actually 26.1.3, and @sidtohan's version appears to be pretty close to that.

Perhaps as a fix to this at the moment, we should change the command from docker-compose to docker compose instead.

Think that'll work? @adnanhashmi09 @sidtohan

Yes that should work as a quick fix. But a better way would be to first run docker compose watch and if it fails then try docker-compose watch. If both fail, we throw an error. For the sake of backwards compatibility.

jayantbh commented 1 month ago

@sidtohan just following up. Were you able to move past this?

sidtohan commented 3 weeks ago

Hey @jayantbh , still facing the same issue. I tried replacing the docker-compose commands in app.tsx with docker compose. However, I'm facing this issue now.

image

adnanhashmi09 commented 3 weeks ago

@sidtohan What changes did you make? I don't think you are using the spawn command correctly. Please refer to the nodejs docs. For some reference you are supposed to use the runCommand function like this:

const commandResponse = runCommand(
  'docker',
  ['compose', 'watch'],
  runCommandOpts
);
sidtohan commented 3 weeks ago

@sidtohan What changes did you make? I don't think you are using the spawn command correctly. Please refer to the nodejs docs. For some reference you are supposed to use the runCommand function like this:

const commandResponse = runCommand(
  'docker',
  ['compose', 'watch'],
  runCommandOpts
);

Yes, you are right @adnanhashmi09, my bad. I have used it properly now, and the error doesn't occur anymore. image

Can this issue be assigned to me please? I would like to implement the proper fix as suggested above(running docker compose first and then reverting to docker-compose should it fail)

samad-yar-khan commented 3 weeks ago

@sidtohan done!

adnanhashmi09 commented 1 week ago

Closing this, as this was fixed in #431