I have a ddev running with TYPO3 and a hook, which copies an auth.json to ~/.composer/auth.json. If I use the following recipe ddev-contrib/…/cronjob from Github, only the hook from the config.cron.yml will be loaded.
How can I load both hooks.
Here is my code:
config.yaml
1 APIVersion: v1.12.1
2 name: projectname
3 type: typo3
4 docroot: deployer/current/web
5 php_version: "7.2"
6 webserver_type: nginx-fpm
7 router_http_port: "80"
8 router_https_port: "443"
9 xdebug_enabled: false
10 additional_hostnames: []
11 additional_fqdns: []
12 mariadb_version: "10.2"
13 nfs_mount_enabled: false
14 provider: default
15 use_dns_when_possible: true
16 timezone: ""
17 hooks:
18 post-start:
19 - exec: echo Copying Credentials…
20 - exec: mkdir -p /home/montea/.composer
21 - exec: cp /var/www/html/auth.json /home/montea/.composer/auth.json
config.cron.yml
1 webimage_extra_packages: [cron]
2 # INFO: replace montea with your local user
3
4 hooks:
5 post-start:
6 - exec: echo '*/1 * * * * montea TYPO3_CONTEXT=Development /usr/bin/php /var/www/html/public/typo3/sysext/core/bin/typo3 scheduler:run' | sudo tee -a /etc/cron.d/typo3
7 - exec: sudo chmod 0600 /etc/cron.d/typo3 && sudo service cron star
If I restart the project, i only see the hook from config.cron.yml
I can move the exec-parts from config.cron.yml to config.yaml but what is with the first line webimage_extra_packages: [cron]
?
Your post-start hooks from config.cron.yaml are overriding the post-start hooks provided in config.yaml, which is how it's intended to be.
You'll want to move the hooks (or maybe everything) from config.cron.yaml into config.yaml.
You can see what your final config.yaml looks like by using ddev debug configyaml
, which will show you what the final combined version looks like.