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

Implement WSL-specific commands and documentation updates for wsl installation #1956

Closed
wants to merge 22 commits into from

Conversation

karmendra
Copy link

@karmendra karmendra commented Feb 26, 2024

  • Added a new PHP script, WslApplyFolderMapping.php, to handle folder mapping in WSL from Homestead configuration.
  • Created a new command wsl:folders to configure folder mapping in WSL.
  • Renamed the command from wsl:create-databases to wsl:databases for consistency.
  • Renamed the command from wsl:create-sites to wsl:sites for consistency.
  • Updated the commands to print shell output using print_r instead of var_dump.
  • Updated the PHP script WslCreateSiteCommand.php to configure sites in Nginx for WSL.
  • Updated the PHP script, WslCreateDatabaseCommand.php, to create databases in WSL from Homestead configuration.
  • Added documentation for setting up Homestead on WSL in wsl.md, including installation, optional features, database creation, configuring Nginx sites, and configuring shared folders.
  • Updated the PHP script WslCreateSiteCommand.php to configure laravel sites' cron schedule for WSL.

Karmendra Suthar added 13 commits February 22, 2024 20:49
- .gitignore - Added .idea folder to be ignored.
- bin/homestead - Added new wsl command wsl:folders.
- scripts/features/mysql.sh - Added this mysql installation script.
- bin/wsl-init.sh This is the script to provision the WSL, it is created from refering amd64.sh from laravel/settler. This is added currently, as not to disrupt wsl-init, but can later replace it.
- src/WslApplyFeatures.php - Changed the command from wsl:apply-features to wsl:features to make it consistent with property names from Homestead.yaml file, Also changed code to show the installation more verbose on screen.
- src/WslApplyFolderMapping.php - This is created to have the folder mapping done using symbolic link by running the command wsl:folders.
- src/WslCreateDatabaseCommand.php - Changed the command from wsl:create-databases to wsl:databases, just to be consistent with Homestead.yaml file databases: configuration section.
- src/WslCreateSiteCommand.php - Changed the command from wsl:create-sites to wsl:sites, again to be consistent with Homestead.yaml sites section. Also changed code to use the sites: configuration from yaml file instead of wsl_sites:. And also update the code to remove sites-enabled along with sites-available.
- wsl.md - Initial Draft documentation to get started with Homestead on WSL.
Added code to switch to Homestead directory to satisfy relative paths in the script
Logging the script output in wsl-init.log and errors in wsl-init-error.log file.

Also removed the Copy of ssl root certificate to Homestead folder, as it isn't generate until wsl:sites is run
created the directory /home/$WSL_UER_NAME/.homestead-features
Redirect all outout (stdout and stderror) to log_file and stdout.
Redirect stderr to error_log_file and stdout.
Added feature script for postgresql
@svpernova09
Copy link
Contributor

Looks like a couple of changesin bin/wsl-init other than the rename to bin/wsl-init.sh (which I don't think we need. Line 1 of the script contains the info).

Can you back out your changes to bin/wsl-init and keep the rest of the changes? I want to get this and #1949 together in the same branch.

@svpernova09
Copy link
Contributor

Let's target branch wsl-rework with this PR as the feature branch for this work.

@svpernova09 svpernova09 changed the base branch from main to wsl-rework February 28, 2024 22:30
@svpernova09 svpernova09 mentioned this pull request Feb 28, 2024
2 tasks
Also updated the wsl.md to use wsl-init instead of wsl-init.sh
@karmendra karmendra marked this pull request as ready for review February 29, 2024 16:27
@karmendra
Copy link
Author

karmendra commented Feb 29, 2024

Looks like a couple of changesin bin/wsl-init other than the rename to bin/wsl-init.sh (which I don't think we need. Line 1 of the script contains the info).

I delete wsl-init.sh, for now. If you need any change from wsl-init.sh moved in wsl-init let me know. I had following in wsl-init.sh

  1. Changing current working directory to Homestead directory
  2. Configured logging
  3. Lot of validations (sudo, Ubuntu version, WSL_USER_NAME and WSL_USER_GROUP validations)
  4. I had defaulted the script to install mysql instead of mariadb.

Can you back out your changes to bin/wsl-init and keep the rest of the changes? I want to get this and #1949 together in the same branch.

I didn't modify wsl-init in this PR.

@karmendra
Copy link
Author

karmendra commented Feb 29, 2024

I fixed the merge conflicts, Also added code in WSLCreateSiteCommand to configure cron for laravel scheduler.

Please mind that I come from bitbucket background, so pardon my ignorance with github, guide me when required. Thanks.

Karmendra Suthar added 5 commits March 1, 2024 00:17
If site configuration in Homestead.yaml is having scheduler: true, then configure the cron job for the laravel site, else remove it.

updated wsl.md Todo section
@MichaelBelgium
Copy link

There's still something wrong with the merge i think, it like completely failed or something

For instance

  • svpernova09 already created a postgresql feature script in the branch wsl-rework, but how come git wants to add one from this branch or replace.

https://github.com/laravel/homestead/blob/wsl-rework/scripts/features/postgresql.sh

  • The wsl-init in your branch isn't updated to the one from wsl-rework

@MichaelBelgium
Copy link

If I checkout your branch @karmendra (document-wsl-install) and (hard) reset to commit cebcad8, then after - when I merge wsl-rework I get these conflicts and edited files:

Conflict:

  • bin/wsl-init
  • scripts/features/postgresql.sh
  • src/WslCreateSitecommand.php

Edited:

  • scripts/features/blackfire.sh
  • scripts/features/couchdb.sh
  • scripts/features/crystal.sh
  • scripts/features/golang.sh
  • scripts/features/ohmyzsh.sh
  • scripts/features/php5.6.sh untill scripts/features/php8.3.sh
  • scripts/features/python.sh
  • src/WslCreateDatabaseCommand.php

@karmendra
Copy link
Author

There is something not straight forward, allow me today, I will fix it.

@karmendra
Copy link
Author

I tried various git commands to fix this, but didn't work.

So I created a fresh PR to wsl-work branch itself.

We can discard this PR and use the new one.

@karmendra karmendra closed this Mar 1, 2024
@karmendra karmendra deleted the document-wsl-install branch March 1, 2024 11:59
@karmendra karmendra restored the document-wsl-install branch March 1, 2024 12:00
@karmendra karmendra deleted the document-wsl-install branch March 1, 2024 12:15
@svpernova09
Copy link
Contributor

Thanks for the work here.

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.

None yet

3 participants