laravel / homestead

MIT License
3.87k stars 1.44k forks source link

WSL Rework Discussion #1957

Open svpernova09 opened 9 months ago

svpernova09 commented 9 months ago

Goal

Continuing work in https://github.com/laravel/homestead/pull/1949 by @MichaelBelgium and integrating https://github.com/laravel/homestead/pull/1956 from @karmendra

Complete

Complete is a fully functional Homestead-like Ubuntu 22.04 system with associated documentation.

Branch and Status

Work is being done on the wsl-rework branch. I've tested a fresh bento/ubuntu-22.04 Vagrant box and run sudo ./bin/wsl-init installed the base system as expected.

karmendra commented 9 months ago

Hi @svpernova09,

Regarding PostgreSQL, I am of the opinion that it shouldn't be part of wsl install as in amd64.sh of laravel/settler it installs and then disable the service # Disable to lower initial overhead. We would rather install it as a feature. Also my opinion is biased by the fact that I am a heavy user of MySql.

MichaelBelgium commented 9 months ago

Agree about PostgreSQL being a feature

Ensure our shell variables make it down into the subshell when we run bash scripts/features/php8.3.sh

What is this for if i may ask?

MichaelBelgium commented 9 months ago

@svpernova09 Correct me if I'm wrong but I think we also need an apache feature script, Nginx gets installed in wsl-init but if there's gonna be an site with type "apache" or "apache-proxy", the apache type or apache-proxy will be used but there's no webserver

https://github.com/laravel/homestead/blob/219e126539a9d55b38b1952fa86ef84319a90c11/scripts/site-types/apache.sh#L26

This line will fail in both site type scripts for WSL

svpernova09 commented 9 months ago

Hi @svpernova09,

Regarding PostgreSQL, I am of the opinion that it shouldn't be part of wsl install as in amd64.sh of laravel/settler it installs and then disable the service # Disable to lower initial overhead. We would rather install it as a feature. Also my opinion is biased by the fact that I am a heavy user of MySql.

Right, PostgreSQL has been moved to a feature and remove from wsl-init.

Agree about PostgreSQL being a feature

Ensure our shell variables make it down into the subshell when we run bash scripts/features/php8.3.sh

What is this for if i may ask?

I've been burned in the past with running bash scripts within bash scripts and want to do a quick test to ensure variables persist as expected.

@svpernova09 Correct me if I'm wrong but I think we also need an apache feature script, Nginx gets installed in wsl-init but if there's gonna be an site with type "apache" or "apache-proxy", the apache type or apache-proxy will be used but there's no webserver

https://github.com/laravel/homestead/blob/219e126539a9d55b38b1952fa86ef84319a90c11/scripts/site-types/apache.sh#L26

This line will fail in both site type scripts for WSL

I don't think we need a feature. We could install and disable it which is what settler does today.

karmendra commented 9 months ago

@svpernova09 , I created a new PR with my changes #1958. Please merge this instead of #1956 I closed this PR. Thanks.

karmendra commented 7 months ago

Hi, Just catching up, hope you guys are doing well, what are our next steps with this, let me know if I can help with something to take this further, got some free time next week. Thanks

MichaelBelgium commented 7 months ago

Would it be an idea to revert #1933 so that we can have mailpit on WSL?

svpernova09 commented 6 months ago

https://github.com/svpernova09/homestead/issues/3

MichaelBelgium commented 5 months ago

Hey guys,

Got a solid test out of the wsl-rework branch on Ubuntu 20.04, 22.04 and deploying works perfectly. I did do a few finishing touches in #1979

Few extra notes:

https://github.com/laravel/homestead/blob/36bd28da9c751d8894e5e24fcfda5fc38ea996ec/src/WslCreateDatabaseCommand.php#L68-L77

Would be a good idea i think.

sdespont commented 4 months ago

Hi,

The webserver is responding and all databases are installed.

But I am not able to open a connection with the databases installed in the WSL instance with external Windows application like MySQL Workbench. I am using MariaDB.

image

Can you help me ?

sdespont commented 4 months ago

Also, ./bin/wsl-init is calling bash 'scripts/features/mariadb.sh' without loading the version option specified in the Homestead.yaml file.

Would it be possible to read the Homestead.yaml file in ./bin/wsl-init in order to use it ?

image

image

sdespont commented 4 months ago

Hello,

I understood why I couldn't establish a connection to the database: the port to use is 3306 and not 33060.

Something that wasn't clear to me when I first tried WSL2 with Homestead is that certain parameters of Homestead.yaml are not taken into account. For example : ip, cpus, memory, ports, ...

Here is the list of parameters not taken into account in my case: image

Also, the IP to use for mapping homestead.test domain in C:\Windows\System32\drivers\etc\hosts must be 127.0.0.1.

I can suggest a PR to improve the documentation if you think it is a good idea ?

In fact, it would make sense to have specific parameters for WSL only : wsl_folders and wsl_sites. Therefore, both configs vagrant and WSL can live in the same config file as suggested by @svpernova09 !

skeeith commented 3 months ago

@svpernova09 guys, I would like to help. can someone guide on where to start from here?

@sdespont I've read your comment, and I do agree that's a better option for flexibility and support for both WSL and VM.

sdespont commented 3 months ago

To maintain fast and efficient synchronization with WSL of source files managed under Windows with an IDE , it could be very interesting to try Mutagen https://mutagen.io

Perfs should be better than NFS and should be easy to setup