简体   繁体   English

覆盖 TYPO3 中 DDEV 的默认数据库设置以指向外部数据库

[英]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.所以我们可以使用 DDEV 在我们的本地机器上开发并且可以共享数据库,所以我们不必导出数据库并将其导入到其他团队成员的机器上。 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. DDEV 项目也存储在 GIT Repo 中,因此每个团队成员都可以将 DDEV 容器的最新设置拉到他们的本地机器上。

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.如果我修改 AdditionalConfiguration.php,我可以访问外部数据库,但是如果 DDEV 容器重新启动,它将覆盖 AdditionalConfiguration.php 文件。 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.我还没有找到在 ddev contaienr 配置中设置数据库连接的方法,因此当容器启动时,它会在 AdditionalConfiguration.php 中设置正确的数据库连接(外部数据库)。

Does anyone know how to set a custom database conenction in a DDEV Container?有谁知道如何在 DDEV 容器中设置自定义数据库连接?

Thanks for the Help.谢谢您的帮助。

My Environment and TYPO3 Version:我的环境和TYPO3版本:

  • TYPO3 v10.4.20 TYPO3 v10.4.20

  • Windows 10 (WSL) Windows 10 (华语)

  • Docker Desktop 3.5.2 Docker桌面3.5.2

  • DDEV-Local version v1.17.7 DDEV-本地版v1.17.7

  • architecture amd64架构 amd64

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

  • dba phpmyadmin:5 dba phpmyadmin:5

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

  • docker 20.10.7 docker 20.10.7

  • docker-compose 1.29.2 docker-compose 1.29.2

  • os linux操作系统 linux

  • router drud/ddev-router:v1.17.6路由器 drud/ddev-router:v1.17.6

  • web drud/ddev-webserver:v1.17.7 web drud/ddev-webserver:v1.17.7

There are many ways to manage your settings files in ddev, and you can tell ddev not to manage your settings files.有很多方法可以在 ddev 中管理您的设置文件,您可以告诉 ddev 不要管理您的设置文件。

  1. Use disable_settings_management: true in your project config.yaml.在您的项目配置中使用disable_settings_management: true true.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.在这种情况下,它将是 AdditionalConfiguration.php。 You just remove the #ddev-generated from it and check it in or whatever.您只需从中删除#ddev-generated并签入或其他任何内容。 Then ddev won't touch it.然后 ddev 不会碰它。

For more detail and nuance, see the docs on this subject, https://ddev.readthedocs.io/en/latest/users/topics/cms-specific-help/有关更多详细信息和细微差别,请参阅有关此主题的文档, https://ddev.readthedocs.io/en/latest/users/topics/cms-specific-help/

I think you could also overwrite the settings in the TYPO3 setup after the inclusion/execution of AdditionalSettings.php我认为您也可以在包含/执行 AdditionalSettings.php覆盖 TYPO3 设置中的设置

Its possible as randy fay said.正如 randy fay 所说,这是可能的。 i would avoid a shared database vor Development instances.我会避免共享数据库 vor 开发实例。

Say team member A creates a new extension with some db tables and spends some time entering testing data.假设团队成员 A 创建了一个带有一些数据库表的新扩展,并花了一些时间输入测试数据。

Then team member B runs a database schema upgrade f On his instance he might destroy a lot of work.然后团队成员 B 运行数据库模式升级 f 在他的实例上,他可能会破坏很多工作。

And there are a lot of similar cases where lokal configuration and Database goes hand in hand.并且有很多类似的情况,本地配置和数据库齐头并进。

Our team has the following process established: Code runs from dev to prod.我们的团队建立了以下流程:代码从开发运行到生产。 And data runs from prod to dev.数据从生产到开发。

So a script creates a nightly db & fileadmin backup.因此,脚本会创建每晚的数据库和文件管理备份。 Then creates a developer snapshot (by scrubbing sensitive and cache data)然后创建开发人员快照(通过清理敏感数据和缓存数据)

This development dump is put on an SFTP server.这个开发转储放在 SFTP 服务器上。

The latest dump is then imported nightly to pre-production Once a week to to QA (so we have a week for the QA team to accept a change if need to create records like new pages)然后每晚将最新的转储导入预生产,每周一次导入 QA(因此,如果需要创建新页面等记录,我们有一周的时间让 QA 团队接受更改)

And on demand for our ddev.并按需提供我们的 ddev。 And i think in practice we developers update the db every 1 or two months.我认为实际上我们开发人员每 1 或 2 个月更新一次数据库。 Because most content changes are irrelevant for us developers.因为大多数内容更改与我们开发人员无关。

We provideed a customer ddev script which downloads the latrst dump and imports it.我们提供了一个客户 ddev 脚本,用于下载最后一个转储并将其导入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM