Skip to content

Instantly share code, notes, and snippets.

@froemken
Last active August 8, 2022 15:00
Show Gist options
  • Save froemken/bfaf227ca24af09c4d378e4f4285ccc1 to your computer and use it in GitHub Desktop.
Save froemken/bfaf227ca24af09c4d378e4f4285ccc1 to your computer and use it in GitHub Desktop.
How to exclude typo3temp directory from ddev to get more performance
# Move typo3temp into RAM-Disk. Do not sync vendor and TYPO3-Directory.
# For MAC: 'nocopy' will only work correct, if nfs_mount_enabled is true
version: '3.6'
services:
web:
volumes:
- type: tmpfs
tmpfs:
size: 268435456
# TYPO3 8
target: /var/www/html/public/typo3temp/var/Cache
# TYPO3 9 and 10
target: /var/www/html/var
- type: volume
source: typo3_source_[shortProjectName]
target: /var/www/html/public/typo3
volume:
nocopy: true
- type: volume
source: vendor_[shortProjectName]
target: /var/www/html/vendor
volume:
nocopy: true
environment:
DDEV_UID:
DDEV_GID:
volumes:
typo3_source_[shortProjectName]:
driver: local
vendor_[shortProjectName]:
driver: local
# Add these lines (un-commented) to config.yaml to change restriction from root to current user
hooks:
post-start:
- exec: bash -c "sudo mkdir -p /var/www/html/public/typo3"
- exec: bash -c "sudo chown -R ${DDEV_UID}:${DDEV_GID} /var/www/html/public/typo3"
- exec: bash -c "sudo mkdir -p /var/www/html/vendor"
- exec: bash -c "sudo chown -R ${DDEV_UID}:${DDEV_GID} /var/www/html/vendor"
# TYPO3 8
- exec: bash -c "sudo mkdir -p /var/www/html/public/typo3temp"
- exec: bash -c "sudo chown -R ${DDEV_UID}:${DDEV_GID} /var/www/html/public/typo3temp"
# TYPO3 9 and 10. Do not add cache directory, as TYPO3 renames the folder before deletion
- exec: bash -c "sudo mkdir -p /var/www/html/var"
- exec: bash -c "sudo chown -R ${DDEV_UID}:${DDEV_GID} /var/www/html/var"
# Move TYPO3 10 Caches into RAM-Disk. Modify AdditionalConfiguration.php.
# For TYPO3 < 10 you have to add "cache_" for each Cache. F.e. cache_rootline
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase']['backend'] = \TYPO3\CMS\Core\Cache\Backend\ApcuBackend::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase']['options'] = [];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['rootline']['backend'] = \TYPO3\CMS\Core\Cache\Backend\ApcuBackend::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['rootline']['options'] = [];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['hash']['backend'] = \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['hash']['options'] = [];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['pages']['backend'] = \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['pages']['options'] = [];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['pagesection']['backend'] = \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['pagesection']['options'] = [];
# Add this line only for TYPO3 < 10
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['imagesizes']['backend'] = \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::class;
@froemken
Copy link
Author

@t3easy: Thank you I have update my gist.
var/cache? As this is part of typo3temp why should I add an extra volume for that?

@froemken
Copy link
Author

froemken commented Apr 1, 2019

Ok...found it. I have updated my gist.

@rasgor
Copy link

rasgor commented Oct 9, 2019

@froemken To be consistent ... I guess www should be public at line 10.

# TYPO3 8
target: /var/www/html/public/typo3temp/var/Cache

@froemken
Copy link
Author

@rasgor Thank you. I have updated the line: "web"->"public" ... not "www" ;-)

@jwohlfeil
Copy link

Works for Shopware and Magento, too, if target is set to /var/www/html/var/cache of the tmpfs volume. Great!

@julianhofmann
Copy link

Since TYPO3 v10.3 (?) cache for imagesizes seems to have compression enabled in options by default. So this has to be disabled, too.

@josefglatz
Copy link

Are you using tmpfs + mutagen in actual TYPO3 projects?

@froemken
Copy link
Author

froemken commented Aug 8, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment