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

#584: docker + k8s: improved windows and added mac support #593

Merged
merged 9 commits into from
Jul 13, 2021
Merged

#584: docker + k8s: improved windows and added mac support #593

merged 9 commits into from
Jul 13, 2021

Conversation

hohwille
Copy link
Member

@hohwille hohwille commented Jul 8, 2021

For #584 (docker & kubernetes support) I improved Windows support and added MacOS support.

hohwille added 4 commits July 8, 2021 18:57
aligned with conventions, removed trailing spaces, fixed bugs, etc.
WSL output is localised, may contain NUL char and gets garbaged, exit code is the only reliable way to check
@hohwille hohwille added enhancement New feature or request software software-package with 3rd party products commandlet related to commandlets (scripts/command/*) setup related to the setup process of devonfw-ide (setup[.bat] and devon ... setup) labels Jul 8, 2021
@hohwille hohwille added this to the release:2021.04.002 milestone Jul 8, 2021
@hohwille hohwille added macOS specific for Apple MacOS windows specific for Microsoft Windows OS labels Jul 8, 2021
@hohwille
Copy link
Member Author

hohwille commented Jul 8, 2021

When I test this on windows it is still not working:

$ devon docker setup
Installing Docker on WSL...
DEVON_IDE_HOME variable set to /mnt/d/projects/test
Hint:You may be required to enter sudo user password of your Windows Subsystem for Linux(WSL) when prompted.
Installing Docker...

We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:

   #1) Repsect the privacy of others.
   #2) Think before you type.
   #3) With great power comes great responsibility.


Then nothing happens. The process is stalled forever.
So IMHO all is still not working and we are not where we want to be.

BTW: I have choosen Debian as Linux Distribution in case that matters.

@hohwille hohwille linked an issue Jul 8, 2021 that may be closed by this pull request
@hohwille
Copy link
Member Author

hohwille commented Jul 8, 2021

BTW: I have choosen Debian as Linux Distribution in case that matters.

LOL. Indeed this was the problem. Nowhere in the devonfw-ide documentation is stated which linux distribution is required.
In the provided URL from microsoft it says:

Open the Microsoft Store and select your favorite Linux distribution.

However, I now digged in the code again and found this:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

So actually the implementation only works for ubuntu.

I thought I had been very pickly already in my reviews. Now, I regret that we have already merged this incomplete feature onto master.
Remaining questions:

  • Should we detect the linux distribution and support all major linux distros?
  • Or if we only support ubuntu, we need to document this properly and also we need to verify this AND in case that a WSL2 user already has other linux installed alongside, we would need to find a way to ensure that we run wsl in ubuntu and not any of the other distros. So in the end this option does not seem any easier to me.

else
error="WSL 2 is disabled or no linux distributions found in WSL.\nPlease ensure WSL is enabled and a proper linux distribution is installed in WSL."
fi
doFail "${error}\nTo fix this follow these instructions:\nhttps://docs.microsoft.com/en-us/windows/wsl/install-win10"
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to use the short link here. The content will be displayed in the user's language and the link does not beak when MS restructures the docs. https://aka.ms/wsl2-install

Copy link
Member Author

Choose a reason for hiding this comment

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

@SchettlerKoehler thanks for this feedback.
However, this PR is about the MacOS support so I will not include further windows changes here and better get this merged now.
For windows I will create another PR immediately after merge but there I will entirely remove this and go to Docker Desktop instead what makes that link to MS obsolete. In case we should decide against this PR and Docker Desktop for Windows we should do what you suggested. You can also edit the URL in the browser on github and create a PR from that with 2 clicks if you fear that this change might be forgotten or lost.

arch="$(uname -m)"
if [ "${arch}" = "x86_64" ]
then
downloadUrl="https://desktop.docker.com/mac/stable/amd64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-mac-amd64"
Copy link
Member

Choose a reason for hiding this comment

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

I think you can just us https://desktop.docker.com/mac/stable/amd64/Docker.dmg
The parameters are just google analytics tracking parameters

Copy link
Member Author

Choose a reason for hiding this comment

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

Excellent feedback. 👍 GET parameters removed.

# Install Docker on WSL
wsl bash ../scripts/setup-docker
fi
downloadUrl="https://desktop.docker.com/mac/stable/arm64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-mac-arm64"
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@maybeec
Copy link
Member

maybeec commented Jul 9, 2021

I feel we should support Debian and Ubuntu, nothing more. These are the most often used ones by users, especially windows users, who most often just know these distributions. For sure we can wait for contributions to support more if there are people who want to support more.
Nevertheless, I fully agree that we have to make it transparent. I would propose that we implement kind of a wsl adapter which checks for the current distribution installed. If a distribution is not supported, it should give a proper error message if trying to execute any command on wsl

@isandesh1986
Copy link
Member

BTW: I have choosen Debian as Linux Distribution in case that matters.

LOL. Indeed this was the problem. Nowhere in the devonfw-ide documentation is stated which linux distribution is required.
In the provided URL from microsoft it says:

Open the Microsoft Store and select your favorite Linux distribution.

However, I now digged in the code again and found this:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

So actually the implementation only works for ubuntu.

I thought I had been very pickly already in my reviews. Now, I regret that we have already merged this incomplete feature onto master.
Remaining questions:

  • Should we detect the linux distribution and support all major linux distros?
  • Or if we only support ubuntu, we need to document this properly and also we need to verify this AND in case that a WSL2 user already has other linux installed alongside, we would need to find a way to ensure that we run wsl in ubuntu and not any of the other distros. So in the end this option does not seem any easier to me.

I think we should go with the 2nd one - mentioning in our documentation that we are supporting only these distros rather than not mentioning anything which gives the impression that it should work in any distro.

@isandesh1986
Copy link
Member

isandesh1986 commented Jul 9, 2021

BTW: I have choosen Debian as Linux Distribution in case that matters.

LOL. Indeed this was the problem. Nowhere in the devonfw-ide documentation is stated which linux distribution is required.
In the provided URL from microsoft it says:

Open the Microsoft Store and select your favorite Linux distribution.

However, I now digged in the code again and found this:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

So actually the implementation only works for ubuntu.
I thought I had been very pickly already in my reviews. Now, I regret that we have already merged this incomplete feature onto master.
Remaining questions:

  • Should we detect the linux distribution and support all major linux distros?
  • Or if we only support ubuntu, we need to document this properly and also we need to verify this AND in case that a WSL2 user already has other linux installed alongside, we would need to find a way to ensure that we run wsl in ubuntu and not any of the other distros. So in the end this option does not seem any easier to me.

I think we should go with the 2nd one - mentioning in our documentation that we are supporting only these distros rather than not mentioning anything which gives the impression that it should work in any distro.

Just FYI:- We used the instructions from one of the 1000kit guides
https://1000kit.gitlab.io/guides/docs/dev-environment/wsl2-pure/#docker

@hohwille
Copy link
Member Author

hohwille commented Jul 9, 2021

I will evaluate Docker Desktop for Windows as I feel we are pointlessly reinventing the wheel here. Feedback will follow.

@isandesh1986
Copy link
Member

I will evaluate Docker Desktop for Windows as I feel we are pointlessly reinventing the wheel here. Feedback will follow.

If DockerDesktop is installed on Windows - its anyways accessible from the WSL.

@hohwille
Copy link
Member Author

hohwille commented Jul 9, 2021

I tested the Docker Desktop installation on Windows:

  • It works like a charm
  • It comes with a GUI installer that leads you through the required steps
  • At the end you have WSL2 properly setup
  • Also you get native docker and kubectl Commands that are directly available in your windows path and can be used in CMD and git-bash without prefixing via WSL.
  • For Kubernetes support to work properly you once have to do an additional step: inside Docker Desktop go to the settings then choose Kubernetes and check "Enable Kubernetes". That is all.
  • Docker Desktop gives the end user the same UX on all major OS: Linux, MacOS, and Windows.

Is there any rationale why we should not simply use Docker Desktop and reinvent the wheel?
My doubts are that with our handmade scripts it will take us > 1/2 year to get this production ready and work on all OS without users getting lost in space what is all already solved with Docker Desktop.

@hohwille
Copy link
Member Author

hohwille commented Jul 9, 2021

FYI: When I run wsl -l I now get 2 additional distros:

  • docker-desktop-data
  • docker-desktop

This does not interfere with any other WSL distro already installed and always uses the correct WSL distro.
All this is currently not functional with our current approach...

@hohwille
Copy link
Member Author

hohwille commented Jul 9, 2021

Also for the record: My test laptop has only 8GB of memory. With kubernetes enabled and all running it shows that 6 GB are used. That is significant but IMHO not much overhead from Docker Desktop at all.

@hohwille hohwille merged commit 22cb583 into devonfw:master Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commandlet related to commandlets (scripts/command/*) enhancement New feature or request macOS specific for Apple MacOS setup related to the setup process of devonfw-ide (setup[.bat] and devon ... setup) software software-package with 3rd party products windows specific for Microsoft Windows OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add commandlets for docker and kubernetes
4 participants