ddev icon indicating copy to clipboard operation
ddev copied to clipboard

automate Laravel settings

Open tyler36 opened this issue 3 years ago • 7 comments

The Problem/Issue/Bug:

Laravel setup with DDEV can/should be automated.

How this PR Solves The Problem:

Add an additional command to set

  • APP_URL
  • DB_HOST
  • DB_DATABASE / DB_USERNAME / DB_PASSWORD
  • DB_CONNECTION
  • DB_PORT

Manual Testing Instructions:

Run ddev laravel on a laravel project

  • test without an .env
  • test with an existing .env

Automated Testing Overview:

TODO

  • [ ] Get and update DB_TYPE from DDEV (not sure how to get this)
  • [ ] Get and update DB_PORT from DDEV (not sure how to get this)
  • [ ] Add to post-config hook for Laravel projects?
  • [ ] Add meaningful tests

Related Issue Link(s):

Fixes #3636 https://github.com/drud/ddev/issues/3636

tyler36 avatar Jul 04 '22 08:07 tyler36

How about doing this in the actual code? https://github.com/drud/ddev/blob/master/pkg/ddevapp/laravel.go

rfay avatar Jul 04 '22 13:07 rfay

In current DDEV head there's a DDEV_DATABASE like DDEV_DATABASE=mariadb:10.3

The DB Port is always the default for the db type.

rfay avatar Jul 05 '22 20:07 rfay

I'm thinking this might be best to start life as a collection of laravel extras? Maybe tyler36/ddev-laravel-extras? I think it should have a better name than "laravel" though.

rfay avatar Jul 11 '22 20:07 rfay

But I do think we should figure out better laravel-specific settings file management in ddev itself.

rfay avatar Jul 11 '22 20:07 rfay

Originally, it was named 'quick', as in 'quick start'.

The idea was each supported project-type would have a corresponding 'quick' (determined by project-type). This would basically run the post-install style hooks. This PR demonstrates a 'laravel' project type, setting the env & running key:generate; Drupal , would be the settings.ddev.php etc.

Custom command for post-install has some benefits:

  • allows me to have a global, or project level laravel setup
  • allows me to "reset" a project by re-running the command

As you said, we don't have good Laravel post-install support out of the box. We prompt users to run several commands which is less than ideal. This is the beginning of that talk.

tyler36 avatar Jul 12 '22 00:07 tyler36

Oh, I guess you actually started the conversation in

  • https://github.com/drud/ddev/issues/3636

rfay avatar Jul 12 '22 20:07 rfay

IMO this should be done in laravel.go, automatically. Closing for now, happy to continue the conversation here or elsewhere.

rfay avatar Aug 13 '22 19:08 rfay

IMO this should be done in laravel.go, automatically. Closing for now, happy to continue the conversation here or elsewhere.

Agreed. In a new action on the project type I think. We're facing the same issue in our Craft CMS project type PR

khalwat avatar Sep 08 '22 17:09 khalwat