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

Update valet.sock to be a symlink to an existing valet{version}.sock file #1201

Merged
merged 29 commits into from
Mar 14, 2022

Conversation

mattstauffer
Copy link
Collaborator

@mattstauffer mattstauffer commented Mar 13, 2022

This PR modifies #1198, which is an update of #1192.

In #1192/#1198, valet.sock is always used by the global Valet PHP version, and then Valet sets up valet80.sock etc. for versions of PHP that aren't used globally but are used by isolated sites.

This PR makes it so that every PHP version used by Valet, global or not, sets up a valet{version}.sock file, and the global version is set by simply symlink-ing valet.sock to the version-specific .sock file.

This PR:

Bugs in testing:

  • Somehow I saw valet.sock disappear twice in the middle of my testing, which broke all sites. Re-running valet install fixed it but I'm not sure what deleted it in the first place. I'll try to keep testing.

@mattstauffer
Copy link
Collaborator Author

I haven't tested this yet. Will test before asking for review.

@mattstauffer mattstauffer changed the title Update valet.sock to be a symlink to an existing valet{version}.sock file Update valet.sock to be a symlink to an existing valet{version}.sock file Mar 13, 2022
@mattstauffer
Copy link
Collaborator Author

On both of my machines, the first time I ran valet install with this new version, it did correctly rename valet.sock to valet80.sock, but it didn't symlink correctly for some reason.

The symlink only worked after I ran valet install the second time. I wonder if this is a race condition?

@mattstauffer
Copy link
Collaborator Author

I'm also wondering... do we even need a symlink? It's a socket.. there may not actually be anything fancy going on here. It may just need a file to exist, in which case we could just delete the file and make a new one.. not even worry about symlinking?

@mattstauffer
Copy link
Collaborator Author

Current thinking about the symlink situation:

If PHP8.0 is our primary version of PHP that's running
and
we have an isolated site on PHP8.0

They'll be pointing to different socket files that are both intending to represent the same PHP connection
And I think they don't like it. And I think that's why my valet.sock keeps disappearing. I'll be digging into it to see.

mattstauffer and others added 3 commits March 14, 2022 13:41
- Fix the isolated directories test given new table shape
- Updated useVersion test to no longer hit the real filesystem

Co-Authored-By: Jacob Baker-Kretzmar <18192441+bakerkretzmar@users.noreply.github.com>
@mattstauffer
Copy link
Collaborator Author

Looks like valet.sock was disappearing based on a test that didn't mock the filesystem. @bakerkretzmar & I found it and it's fixed.

mattstauffer and others added 4 commits March 14, 2022 13:58
Co-Authored-By: Jacob Baker-Kretzmar <18192441+bakerkretzmar@users.noreply.github.com>
…ng PHP-FPM

Co-Authored-By: Jacob Baker-Kretzmar <18192441+bakerkretzmar@users.noreply.github.com>
@mattstauffer
Copy link
Collaborator Author

Solved this problem: #1201 (comment)

I think at this point this PR is ready for review.

Co-Authored-By: Jacob Baker-Kretzmar <18192441+bakerkretzmar@users.noreply.github.com>
@mattstauffer mattstauffer merged commit 80b7e61 into NasirNobin-master Mar 14, 2022
@mattstauffer mattstauffer deleted the mes/symlink-valet-socks branch March 14, 2022 18:52
@shengslogar
Copy link

This is 🔥! Won't pretend to know the ins-and-outs of how this works, but how hard would it be to add a CLI util to access that running PHP version? (Thinking along the lines of php artisan tinker...)

@NasirNobin
Copy link
Contributor

@shengslogar that's coming soon! checkout #1216

This is 🔥! Won't pretend to know the ins-and-outs of how this works, but how hard would it be to add a CLI util to access that running PHP version? (Thinking along the lines of php artisan tinker...)

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