Search code examples
dockertypo3ddev

Overriding DDEV's default db settings in TYPO3 to point to an external Database


We want to use the same (staging) database for our project within our team. So we can develop on our local machines with DDEV and can share the database, so we dont have to export the database and import it on anothers team members machine. The DDEV Project is also being stored in a GIT Repo, so each teammember can pull the newest settings of the DDEV Container onto their local machine.

I can access the external Database if I modify the AdditionalConfiguration.php, but if the DDEV Container gets restarted then it overwrites the AdditionalConfiguration.php file. I haven't found a way to set the database connection within the ddev contaienr config, so when the container gets started it sets the correct Database connection (external Database) in the AdditionalConfiguration.php.

Does anyone know how to set a custom database conenction in a DDEV Container?

Thanks for the Help.

My Environment and TYPO3 Version:

  • TYPO3 v10.4.20

  • Windows 10 (WSL)

  • Docker Desktop 3.5.2

  • DDEV-Local version v1.17.7

  • architecture amd64

  • db drud/ddev-dbserver-mariadb-10.3:v1.17.7

  • dba phpmyadmin:5

  • ddev-ssh-agent drud/ddev-ssh-agent:v1.17.0

  • docker 20.10.7

  • docker-compose 1.29.2

  • os linux

  • router drud/ddev-router:v1.17.6

  • web drud/ddev-webserver:v1.17.7


Solution

  • There are many ways to manage your settings files in ddev, and you can tell ddev not to manage your settings files.

    1. Use disable_settings_management: true in your project config.yaml. Then you and you alone are responsible for the settings files.
    2. Take over the settings file. In this case that would be AdditionalConfiguration.php. You just remove the #ddev-generated from it and check it in or whatever. Then ddev won't touch it.

    For more detail and nuance, see the docs on this subject, https://ddev.readthedocs.io/en/stable/users/usage/cms-settings/

    I think you could also overwrite the settings in the TYPO3 setup after the inclusion/execution of AdditionalSettings.php