Categories
Laravel

Database Laravel Tests failing from Sail App

Ok, this was a silly error on my part, because I got out of practice using the sail commands.

I have a Laravel app running on Sail/Docker under WSL. The app worked through the browser, but there was no DB access from the CLI or running tests.

I was running php artisan test which was using the PHP local to the WSL system, and not the virtual PHP server which should run the app. The WSL PHP happened not to have the PDO driver installed, so DB access failed.

Just needed to run the command properly as sail art test to use the correct PHP (I have aliased art to artisan).

Problem solved.

Categories
Workflow

SSH Authentication in WSL

Seems like the ssh-agent can go to sleep.

Within WSL I ran:

eval `ssh-agent`
ssh-add -l  //to see keys in use
ssh-add ~/.ssh/my_private_key  // to add it
Categories
DevOps

WSL2

I setup a sample Laravel app with Sail. Works, but I have to disable local Apache and MySQL to free up their ports. Should be able to configure the virtual host to use different host ports, but I couldn’t figure out the syntax.

Twitter pointed out that the slowness is due to file system syncing.

I have to investigate this for Laravel, and URL mapping. Would I have to setup PHP, Nginx etc directly in the VM? Then I’m losing the benefit of Sail configuring that for me.

I’m probably missing something obvious.