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

Windows support for Git Bash and WSL #26

Merged
merged 5 commits into from
Nov 16, 2017
Merged

Windows support for Git Bash and WSL #26

merged 5 commits into from
Nov 16, 2017

Conversation

cringerjs
Copy link
Contributor

@cringerjs cringerjs commented Oct 26, 2017

Windows Support

There are (potentially) 3 ways Windows developers would access Vessel and/or Docker

  1. MINGW64 - This includes Git Bash, Babun, Cygwin and direct MINGW64 installations
  2. Windows Subsystem for Linux (WSL)
  3. Native Windows - Command Prompt or Powershell

Since the Vessel script is written in bash the 3rd option is really it's own thing. The first 2 options give us a bash shell (with other common GNU utils like sed) in which we can utilize the bash script.

Notes on things added

  • I didn't use Windows as a result of a detection because I figured this would be reserved for native windows support and I don't want to confuse people. Instead the MINGW64 is being used.

  • Using $(uname -s) on WSL will just return "Linux". Because of this we need to add a detection method for WSL. Fortunately the output of /proc/version differs as WSL adds Microsoft to their version name. We can grep this output for Microsoft to determine it is WSL instead of a Linux OS.

Differences between #20 and this PR

  1. CHANGED The detection was listed as Windows10 but that can be confusing for people looking for native windows support.
  2. REMOVED COMPOSE_CONVERT_WINDOWS_PATHS=1 doesn't appear to be necessary. The documentation only states Docker Toolbox (legacy) or docker-machine.
  3. REMOVED COMPOSE="winpty $COMPOSE" While winpty is necessary in some cases but ONLY if you are using Mintty as the default terminal for Git Bash. This choice is made during the installation of Git for Windows. If you are using the standard command prompt this is not needed at all. I haven't ran into any issues from the Vessel executing script using Mintty. The only time I have had to use this is when I'm trying to log onto one of the containers interactively. In this case it prompts me to try prefixing winpty in which I just do that and everything works.
  4. ADDED SEDCMD="sed -i" under the MING64 detection. It was missing from that PR and so the substitutions under Setting .env variables were not working correctly.

This script was tested on 2 different Windows machines; 1 domain joined laptop, and 1 custom desktop PC. Both are running Windows 10 Pro, Version 1709 Build 162999.19 (Creators Update)

Docker for Windows (Docker Community Edition) Version 17.09.0-ce-win33 (13620)

This PR would close #20

@cringerjs cringerjs mentioned this pull request Oct 26, 2017
@fideloper
Copy link
Contributor

@cmosguy would love your opinion as well. I still don't have time (nor a PC) to test on Windows!

(I'll get my windows 10 bootcamp partition in gear one of these days).

@cmosguy
Copy link

cmosguy commented Nov 3, 2017

@cringer and @fideloper I just pulled in this latest update. Everything seems to work just fine. I'd say at this point is to ship it!

@fideloper
Copy link
Contributor

Nice, will try this out soon!

@petarblazevski
Copy link

Hey @fideloper, any news on this. I would like to start using it on a Windows OS :)

@cringerjs
Copy link
Contributor Author

@petarblazevski

You can use the branch in my fork until @fiedloper pulls this in. You just have to add some stuff to your composer.json. The dot's just represent where your other content may be.

...
"repositories": [  
    {  
        "type": "vcs",  
        "url": "https://github.com/cringer/vessel"
    }  
],  
...
"require": {
    ...
    ...
    ...
    "shipping-docker/vessel": "dev-windows-support"
},

If you do end up using it from the fork please let us know if you ran into any issues. I know Windows is not @fideloper forte so the more testers the better. 😁

@fideloper
Copy link
Contributor

Apologies for not pulling it in yet. I don't have a way to test it which is a big blocker, I'm honestly not sure if this covers most use cases for the average windows user or if a very specific set of tools needs to be used (I haven't paid close enough attention, a new baby at home is making it hard to spend the hours!).

Any feedback in terms of pros/cons/possible issues in this from the windows users will be appreciated!

@cringerjs
Copy link
Contributor Author

@fideloper I understand completely. What I can say is I have used different development environments on windows for a long time - WAMP, XAMPP, MAMP, Cygwin, GOW (GNU on Windows) Babun, Docker, WSL (Windows Subsystem for Linux) as well as various terminals Command Prompt, Power Shell, Git Bash (mintty), ConsoleZ, ConEmu, Cmder, Hyper.

I personally have found that I am not trying to reproduce a whole Linux environment. 99% of what I do I just use Git Bash with a local PHP installation (needed for composer). Also I am mostly doing Laravel development so I'm either using php artisan serve, or the local PHP webserver for other types of projects.

With that being said I'm not sure how to determine the average Windows use but I believe that it falls into 3 uses.

  1. Git Bash (using mintty or command prompt) - This gives a lot of tools ls, grep, sed etc.
  2. WSL - This gives a complete Linux environment.
  3. Native Windows - Power Shell or Command Prompt. This gives no native linux tools without additional software such as GOW.

Use case 1 and 2 above are supported in this PR as we have the capability to run bash scripts. Only a few tweaks in the script were necessary for default values and environment detection. For option 3 there would need to be a windows specific script to perform what your bash script does. I haven't had a chance to look too deep into this as I haven't had time but I'm sure it would need to be provided by the community.

Just my two cents. 😁

@fideloper
Copy link
Contributor

Thanks, really appreciate you taking the time to explain it! It looks like the changes won't over-write or change anything based on the most recent version (2.0.0) either, so let's merge it in and see what happens!

@fideloper fideloper merged commit 533cc7d into shipping-docker:master Nov 16, 2017
@cringerjs
Copy link
Contributor Author

I'll keep an eye on the issues tracker for anything windows related.

@petarblazevski
Copy link

petarblazevski commented Nov 16, 2017

Hi guys. So I did try this, but I am having an issue the MySQL container. When I do ./vessel start
I am getting the following errors:

Creating lvbroadcast_app_1 ...                                                                                                                                   
Creating lvbroadcast_node_1 ...                                                                                                                                  
Creating lvbroadcast_redis_1 ...                                                                                                                                 
Creating lvbroadcast_mysql_1 ...                                                                                                                                 
Creating lvbroadcast_app_1                                                                                                                                       
Creating lvbroadcast_mysql_1                                                                                                                                     
Creating lvbroadcast_node_1                                                                                                                                      
Creating lvbroadcast_mysql_1 ... error                                                                                                                           
                                                                                                                                                                 
ERROR: for lvbroadcast_mysql_1  Cannot start service mysql: driver failed programming external connectivity on endpoint lvbroadcast_mysql_1 (f371933f6bbe9d4fc2df
Creating lvbroadcast_app_1 ... done                                                                                                                              
                                                                                                                                                                 
ERROR: for mysql  Cannot start service mysql: driver failed programming external connectivity on endpoint lvbroadcast_mysql_1 (f371933f6bbe9d4fc2df060fe080d86d67
11bc3bbfd8a09632de402ab67c2bc6): Error starting userland proxy: Bind for 0.0.0.0:3306: unexpected error Permission denied                                        
ERROR: Encountered errors while bringing up the project.

I did try and remove the MySQL container, but it did not help.

Any ideas @cringer

Update
I have found the problem, I had a local MySQL server running. Stopping it fixed the issue. So far, I can confirm that everything is working. If i run into any issue i will let you know

@fideloper
Copy link
Contributor

fideloper commented Nov 16, 2017

My guess is you have something on your Windows machine listening on port 3306 already (maybe mysql running within WAMP or similar?)

That being said, you'll also need to pull this package from dev-master, as the merged PR has not been tagged into an official release yet:

composer require shipping-docker/vessel:dev-master

@petarblazevski
Copy link

I just followed the docs for a fresh install, and everything seems to be working for me. I can see in the composer.json file that the package is installed with ^2.0.

Not sure why is it working :)

MatthewBooth pushed a commit to dockfony/dockfony that referenced this pull request Sep 15, 2019
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.

4 participants