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
     14final class Exception extends PDOException
     15▕ {
     16public static function new(\PDOException $exception): self
     17▕     {
  ➜  18return 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!

marklong

Jun 28th, 2022 09:47 AM

Left the same message on github. Just repeating here (not sure which platform is preferable).

Trying to get Wave up and running with Sail. Cloned repo and set up and reconfiged .env file. Made recommended changed to docker compose and added phpmyadmin to confirm migrations etc.

I am able to login to Voyager admin panel but wave is not loading (500 server error) and this is the feedback from my terminal.

mark@pop-os:~/Dev/php/wave$ sail artisan migrate Migrating: 2020_03_30_032031_change_voyager_themes_table_name

Illuminate\Database\QueryException

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'themes' already exists (SQL: rename table voyager_themes to themes)

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712 708▕ // If an exception occurs when attempting to run a query, we'll format the error 709▕ // message to include the bindings with SQL, which will make this exception a 710▕ // lot more helpful to the developer instead of just the database's errors. 711▕ catch (Exception $e) { ➜ 712▕ throw new QueryException( 713▕ $query, $this->prepareBindings($bindings), $e 714▕ ); 715▕ } 716▕ }

  +12 vendor frames 

13 wave/database/migrations/2020_03_30_032031_change_voyager_themes_table_name.php:16 Illuminate\Support\Facades\Facade::__callStatic()

  +22 vendor frames 

36 artisan:37 Illuminate\Foundation\Console\Kernel::handle()

bobbyiliev

Jun 29th, 2022 01:44 AM

Hi there,

It sounds like that you are trying to run your migrations with a non-empty database.

I could suggest creating a new blank database, and specifying it in the .env file and they try to run the migrations again.

Let me know how it goes!

Best,

Bobby