[英]How to set up a TYPO3 site with docker and ddev?
I'm new to docker and I've been told ddev is a simple way to set up a local container to run a TYPO3 project.我是docker 新手,有人告诉我ddev是一种设置本地容器来运行 TYPO3 项目的简单方法。
But I'm confused.但我很困惑。 I'm not familiar with all these containers yet.我还不熟悉所有这些容器。 How should I proceed to get a grip?我应该如何进行抓握?
The tutorial is based on https://docs.typo3.org/m/typo3/guide-contributionworkflow/master/en-us/Appendix/SettingUpTypo3Ddev.html but mind – that is a step-by-step-manual if you want to contribute to the TYPO3 core.本教程基于https://docs.typo3.org/m/typo3/guide-contributionworkflow/master/en-us/Appendix/SettingUpTypo3Ddev.html但请注意 - 如果您愿意,这是一个分步手册为TYPO3核心做出贡献。 If you want to run your own site, the «Clone TYPO3» section doesn't apply.如果您想运行自己的站点,则《克隆 TYPO3》部分不适用。
So start like this:所以开始这样:
brew tap drud/ddev && brew install ddev
)安装 ddev: https://ddev.readthedocs.io/en/latest/#installation (Mac: brew tap drud/ddev && brew install ddev
)mkdir mysite; cd mysite
创建一个要运行站点的目录: mkdir mysite; cd mysite
mkdir mysite; cd mysite
ddev config
There's not much to choose from in the wizard.配置 ddev:运行ddev config
向导中没有太多可供选择的内容。 You can set the web-root (eg. public_html, so you have a level more above) and choose from a few CMS presets.您可以设置 web 根目录(例如 public_html,因此您有更高的级别)并从几个 CMS 预设中进行选择。 They don't change too much, in the case of TYPO3 it will manage the db connection and some nginx settings.他们不会改变太多,在 TYPO3 的情况下,它将管理数据库连接和一些 nginx 设置。 The file .ddev/config.yaml will be created.将创建文件 .ddev/config.yaml。 In it you can find a lot of options.您可以在其中找到很多选项。ddev start
使用ddev start
运行 ddevbrew install mkcert nss; mkcert -install
)查看是否安装了 mkcert,如果没有,请按照提供的说明进行操作(这将确保您可以使用自签名证书,至少在 firefox 中)(mac: brew install mkcert nss; mkcert -install
)ddev help
gives you more commands ddev help
为您提供更多命令ddev ssh
.如果要登录容器,请使用ddev ssh
。 This is NOT used to change files etc. The files are mirrored automatically into the container!这不用于更改文件等。文件会自动镜像到容器中! But you can log in to install binaries etc. Let's try that.但是您可以登录以安装二进制文件等。让我们尝试一下。 Some commands you may need: What system are we running?您可能需要的一些命令: 我们正在运行什么系统? uname -a
-> linuxkit // Update available packages: sudo apt-get update
// Search for a package apt-cache search packagename
// Install Pdftools (pdftotext, pdfinfo..): sudo apt-get install poppler-utils
// Get the path to imagemagick (if it's already installed): whereis convert
(remember, imagemagick is a collection, convert is one of the tools) // log out from the container, back to your system: exit
uname -a
-> linuxkit // 更新可用包: sudo apt-get update
// 搜索包apt-cache search packagename
// 安装 Pdftools (pdftotext, pdfinfo..): sudo apt-get install poppler-utils
//获取imagemagick的路径(如果已经安装了): whereis convert
(记住,imagemagick是一个集合,convert是工具之一)//退出容器,回到你的系统: exit
ddev describe
and you will get the login data.运行ddev describe
,您将获得登录数据。 It's basically db
for everything.它基本上是db
的一切。ddev setup
command provides an AdditionalConfiguration.php
file that can be used.对于TYPO3, ddev setup
命令提供了一个可以使用的AdditionalConfiguration.php
文件。 It's missing two important parameters though, SystemMaintainers and Installtool Password.但是它缺少两个重要参数,SystemMaintainers 和 Installtool Password。 Here's an example.这是一个例子。$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'] = array_merge($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'], [
'dbname' => 'db',
'host' => 'db',
'password' => 'db',
'port' => '3306',
'user' => 'db',
]);
// This mail configuration sends all emails to mailhog
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] = 'smtp';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_server'] = 'localhost:1025';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'] = '*';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = 1;
// add these
$GLOBALS['TYPO3_CONF_VARS']['SYS']['systemMaintainers'] = [123,456];
$GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'] = 1; // optional
$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'] = '123';
ddev sequelpro
and your database will be launched automagically in sequel pro.如果您使用 sequel pro,只需运行ddev sequelpro
,您的数据库将在 sequel pro 中自动启动。 You can also do this manually;您也可以手动执行此操作; then you need to define the db port to access it externally.那么您需要定义数据库端口以从外部访问它。 Do this in .ddev/config.yaml, by adding (for example) host_db_port: "32778"
Now we can set up a db management tool as such (and store the bookmark):在 .ddev/config.yaml 中执行此操作,通过添加(例如) host_db_port: "32778"
现在我们可以这样设置数据库管理工具(并存储书签):Remember: PHP will still use the default Port 3306!请记住:PHP 仍将使用默认端口 3306!
ddev stop
.完成后,以ddev stop
结束。 I'm not really sure where databases are persisted though yet, when ddev is stopped.当 ddev 停止时,我还不确定数据库在哪里持久化。 Maybe you get a dump first with ddev snapshot
.也许您首先使用ddev snapshot
进行转储。ddev help
.使用ddev help
探索 ddev 的更多可能性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.