lando / mssql

The Official MSSQL Lando Plugin
https://docs.lando.dev/mssql
GNU General Public License v3.0
0 stars 3 forks source link

Symfony Recipe Error: Could not find a service builder called symfony-mssql #31

Closed EsliManta closed 7 months ago

EsliManta commented 7 months ago

Hello,

I just updated lando to v3.21.0-beta.1 and now whenever I try to run my symfony + mssql project, the following error arises ERROR ==> Could not find a service builder called symfony-mssql in the builder registry!. This error occurs both when running lando start and lando rebuild

I have ran lando setup and lando update however they both report no additional setup is required.

Here is a .lando.yml file for reproducing:

name: symfony_mssql
recipe: symfony
config:
  php: 8.1
  via: nginx
  webroot: public
  database: mssql:2019-latest
  xdebug: 'develop,debug,profile'

Any help greatly appreciated :pray:

reynoldsalec commented 7 months ago

Interesting, support for mssql as a database config option was never documented, but our architecture around specifying a database type never "filtered" acceptable DB options, so essentially anything you put in there would get passed in as the service type...hence why mssql worked before.

With the new plugin architecture we plugin instances from a recipe-specific plugin version to ensure compatibility. That's only set-up for the supported DB options from the docs.

I thought that adding support for mssql in the symfony recipe would be the best idea, but I found a funny issue: when I do that, it sets the password to symfony, which is less than the 8 characters mssql requires for the admin password. Have you had this issue @EsliManta/did you have something in your Landofile to get around it?

EsliManta commented 7 months ago

@reynoldsalec That makes sense, thanks for explaining. and yeah that does ring a bell, I just checked my .lando file and I've got this section in it:

services:
  database:
    creds:
      password: L4ndoSymfony! #needs to be 8 characters minimum with special characters
    portforward: 21273
    build_as_root:
      - sqlcmd -Slocalhost -Usa -PL4ndoSymfony! -Q "IF NOT EXISTS (select * from sys.databases where name='symfony') BEGIN CREATE DATABASE [symfony] END"

I was having issues with the database not being created properly, so it's not the prettiest lando file :grimacing: but it gets the job done. sidenote: can't change the username from sa afaik

reynoldsalec commented 7 months ago

Sweet that makes sense @EsliManta, thanks!

I'm going to move forward with my plan to add "back" out-of-box mssql compatibility for symfony (and other lamp-y recipes). I'll document this password issue in the mssql docs, since it would also impact folks who manually override the database service to change its type and I feel like that usecase should be supported.

If you run lando update and accept the update to @lando/symfony@v1.2.0 you should be back in business!