middlewarehq / middleware

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

Developer Setup using Docker fails on Windows Systems. #430

Closed KartikChawla09 closed 1 week ago

KartikChawla09 commented 3 weeks ago

Description:

Developer Setup using Docker fails on Windows Systems giving the error CNTNR #37 0.591 "/etc/cron.d/cronjob":1: bad minute

RUN apt-get update && apt-get install -y dos2unix RUN mkdir -p /etc/cron.d && mv /app/setup_utils/cronjob.txt /etc/cron.d/cronjob RUN dos2unix /etc/cron.d/cronjob When the above code is added to the Dockerfile.dev the "cronjob" error gets resolved but then it leads to the error below. CNTNR #42 0.529 /app/setup_utils/generate_config_ini.sh: line 6: syntax error near unexpected token $'in\r'"

The above error can be solved using RUN dos2unix /app/setup_utils/generate_config_ini.sh RUN /app/setup_utils/generate_config_ini.sh -t /app/backend/analytics_server/mhq/config RUN chmod +x /app/setup_utils/start.sh

The above additions to the Dockerfile.dev leads to the ./dev.sh file to run completely but the local server fails to start as the Docker Container does not start giving the following log error. /bin/bash: line 1: /app/setup_utils/start.sh: cannot execute: required file not found

Steps to reproduce:

On a windows system :

  1. Go into the root directory.
  2. Run ./dev.sh in the terminal.

Expected behavior:

The deployment server should start running on http://localhost:3333/

Actual behavior:

Error CNTNR #37 0.591 "/etc/cron.d/cronjob":1: bad minute as described above.

Server Setup Information:

Additional context

Docker Version 4.30.0

jayantbh commented 2 weeks ago

Apologies for the delay in addressing this. Someone from the team will get back to you within a couple of hours, likely sooner. :)

KartikChawla09 commented 1 week ago

Apologies for the delay in addressing this. Someone from the team will get back to you within a couple of hours, likely sooner. :)

Hey! Can you please provide an update on the issue.

jayantbh commented 1 week ago

Hey @KartikChawla09, apologies this didn't get followed up on. Let me check in with the team.

adnanhashmi09 commented 1 week ago

Hey, @jayantbh @KartikChawla09, seems like the problem was with how line endings were being handled automatically by git for different platforms. For windows, the line endings were crlf and for unix it is lf. Since docker runs a unix system, the \r symbol was not being recognised and hence we get the file not found error. I have added a fix with the above PR.

@KartikChawla09 Once it is merged please delete the local repository in your system, reclone it and test it. It also might be a good idea to change your code editor's default settings for line endings to use only lf line endings since most editors on windows know how to deal with unix line endings. :)

KartikChawla09 commented 1 week ago

Hey @adnanhashmi09 , the docker file is running perfectly now. Thank you very much for your help. I am closing the issue.