Wave + Sail = how?

Solved
sitebuilderone ・

Jun 20th, 2022 07:52 PM

Hi All Trying to set up Laravel Wave with Sail. Prefer to manage with Docker. The existing installation instructions are based on Valet. Prefer not to use Valet. Have tried with Lando, worked, but experienced caching issues. Anyone have a quite steps/tutorial how to add Sail to Wave? It's the mySQL connection errors where I get fumbled up. Super thanks!

bobbyiliev ・

Jun 21st, 2022 03:47 AM

・

Best Answer

Hi there,

If you are on a Mac with an M1 chip, note that the MySQL image would not work. So in the docker-compose.yaml file change the MySQL image to:

        image: 'mariadb:10.5.8'

Then you can run Sail as normal:

composer install

Copy over the .env.example file to .env:

cp .env.example .env

The database details in your .env file should be set to:

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=wave
DB_USERNAME=sail
DB_PASSWORD=password

Then start sail:

bash ./vendor/bin/sail up -d

Run the migrations:

./vendor/bin/sail artisan migrate 
./vendor/bin/sail artisan db:seed

Let me know how it goes.

sitebuilderone ・

Jun 21st, 2022 09:57 AM

Thanks - that makes sense.

On MAC, no M1 chip.

Reverted back to 'Valet' and trying from there.

Stuck on:

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated

when trying to run

php artisan migrate

Keep getting:

wave git:(main) ✗ php artisan migrate

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /Users/****/Sites/wave/config/trustedproxy.php on line 18

   Doctrine\DBAL\Driver\PDO\Exception

  SQLSTATE[HY000] [1049] Unknown database 'wave'

  at vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18
     14▕ final class Exception extends PDOException
     15▕ {
     16▕     public static function new(\PDOException $exception): self
     17▕     {
  ➜  18▕         return new self($exception);
     19▕     }
     20▕ }
     21▕

      +37 vendor frames
  38  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

Using DBegin, tried both mySQL versions.

PHP 8.1.7 (cli) (built: Jun  9 2022 14:21:07) (NTS)

Greatly appreciated

bobbyiliev ・

Jun 21st, 2022 11:57 AM

Hi there,

The SQLSTATE[HY000] [1049] Unknown database 'wave' error indicates that you have not created the wave database. You need to access your MySQL instance and create the database before running the migrate command.

Let me know how it goes once you have the database created!

sitebuilderone ・

Jun 21st, 2022 12:18 PM

Thanks again

sitebuilderone ・

Jun 21st, 2022 12:18 PM

Thanks again Bobby ... appreciate your help.

Installed mySQL with brew and all is better. Was going the DBEngin route and serious scratching my head.

Yes .... waaaay faster with Valet.

Maybe this helps others, but get following warning:

Deprecated
: explode(): Passing null to parameter #2 ($string) of type string is deprecated in
/Users/- - -/Sites/wave2/config/trustedproxy.php
on line
18

to resolve, adjusted '/config/trustedproxy.php'

'proxies' => explode(',', env('TRUSTED_PROXIES', 'null')), // [<ip addresses>,], '*', '<ip addresses>,'

to

'proxies' => explode(',', env('TRUSTED_PROXIES', '')), // [<ip addresses>,], '*', '<ip addresses>,'
Report
1
bobbyiliev ・

Jun 21st, 2022 11:29 PM

No problem at all! Happy to hear that you’ve got it all sorted out! And thank you for sharing these additional details!