Reputation: 169
I want to configure proper dev environment for Prestashop 1.7 using Docker. Issue is that it's quite slow. Profiler(from Symfony) shows around 2.7-6 seconds to load some admin pages. (freshly installed website). In production we have website working not in docker container and page load speed is around 150-250ms. I understand that it might be slow because of some large folders like "vendor", so I tried some ways to optimize it by adding :delegated. Performance probably was improved for several seconds, but still 3 seconds is not comfortable to work. I would like to improve it at least to load within 1000ms.
Prestashop image from: https://hub.docker.com/r/prestashop/prestashop/
You can try this docker-compose to play around what can be modified to improve:
version: '3'
services:
prestashop:
build: ./docker/prestashop
container_name: app
ports:
- 80:80
links:
- mariadb:mariadb
depends_on:
- mariadb
volumes:
- ./docker/common:/scripts
- ./src:/var/www/html:delegated
- vendor:/var/www/html/vendor
- var:/var/www/html/var
environment:
- PS_DOMAIN=localhost
- PS_DEV_MODE=1
- DB_SERVER=mariadb
- DB_USER=root
- DB_PASSWD=root
- DB_NAME=ps_test
- PS_INSTALL_AUTO=1
- PS_COUNTRY=EE
- [email protected]
- ADMIN_PASSWD=test123
- PS_INSTALL_DB=1
mariadb:
build: ./docker/mariadb
container_name: mariadb
restart: always
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=ps_test
volumes:
- db_data:/var/lib/mysql
- ./docker/mariadb/logs/:/var/log/mysql:delegated
volumes:
db_data:
vendor:
var:
prestashop Dockerfile:
FROM prestashop/prestashop:1.7-7.2-apache
RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_connect_back=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_port=9000" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "file_uploads=On" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "memory_limit=1G" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "upload_max_filesize=64M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "post_max_size=64M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "max_execution_time=600" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "max_input_vars=100000" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "error_reporting-1" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "display_errors = On" >> /usr/local/etc/php/conf.d/custom.ini
RUN usermod -u 1000 www-data
RUN chown 1000 /var/www -R
Upvotes: 1
Views: 1297
Reputation: 582
I don't know which OS do you use, but I had performance issues working with a Docker PrestaShop install on Windows. I changed to Linux and it's way better now.
Upvotes: 0