eZ Platform Discussions

[eZ Launchpad] eZPlatform good practices and optimisations


#1

Bien le bonjour !

I use eZ Launchpad for my dev and it’s cool.

But as I add more features to my site. My dev environment is getting slower.

Result, I no longer have the web debug toolbar and I have more and more often the error “504 Gateway Time-out”

504 Gateway Time-out
nginx/1.14.0

web debug toolbar error :

An error occurred while loading the web debug toolbar. Open the web profiler.

http://localhost:35080/_profiler/c1da57

Token not found
Token “c1da57” was not found in the database.

It is probably possible to increase the memory and time to give to the program but it only postpones the problem…
But I probably have to do it anyway.
But I don’t know how to do it…

Because the real problem is probably bad practices in my code. But access to the web debug toolbar would be a plus to find the weak points.


#2

My /provisioning/docker-compose.yml :

version: '2.1'
services:
    nginx:
        image: 'nginx:stable-alpine'
        volumes:
            - '${PROJECTCOMPOSEPATH}/${PROVISIONINGFOLDERNAME}/dev/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro'
            - '${PROJECTCOMPOSEPATH}/${PROVISIONINGFOLDERNAME}/dev/nginx/entrypoint.bash:/entrypoint.bash:ro'
            - '${PROJECTCOMPOSEPATH}/ezplatform/doc/nginx/ez_params.d:/etc/nginx/ez_params.d:ro'
        depends_on:
            - engine
        volumes_from:
            - 'engine:ro'
        entrypoint: /entrypoint.bash
        ports:
            - '${PROJECTPORTPREFIX}080:80'
            - '${PROJECTPORTPREFIX}081:81'
        environment:
            - PROJECTMAPPINGFOLDER
    engine:
        build: ./engine/
        volumes:
            - '${PROJECTCOMPOSEPATH}/${PROVISIONINGFOLDERNAME}/dev/engine/php.ini:/usr/local/etc/php/php.ini:ro'
            - '${PROJECTCOMPOSEPATH}:${PROJECTMAPPINGFOLDER}:rw'
            - '${HOST_COMPOSER_CACHE_DIR}:${COMPOSER_CACHE_DIR}:rw'
            - '${PROJECTCOMPOSEPATH}/${PROVISIONINGFOLDERNAME}/dev/solr:/ezsolr:rw'
        shm_size: 754M
        environment:
            - COMPOSER_CACHE_DIR
            - PROJECTMAPPINGFOLDER
            - DEV_UID
            - DEV_GID
            - DATABASE_USER=root
            - DATABASE_NAME=ezplatform
            - DATABASE_PASSWORD=ezplatform
            - SYMFONY_SECRET=eZlaunchpad20Secret09Dev83ModeZ
            - DATABASE_HOST=db
            - CUSTOM_CACHE_POOL=singleredis
            - CACHE_HOST=redis
            - CACHE_REDIS_PORT=6379
            - CACHE_POOL=cache.redis
            - 'CACHE_DSN=redis:6379'
            - SEARCH_ENGINE=solr
            - 'SOLR_DSN=http://solr:8983/solr'
            - SYMFONY_TMP_DIR=/tmp/ezplatormcache/
        extra_hosts:
            - "foo.lxc:10.0.3.23"
           # - ...
    db:
        image: 'mariadb:10.1'
        environment:
            - MYSQL_ROOT_PASSWORD=ezplatform
        ports:
            - '${PROJECTPORTPREFIX}306:3306'
        volumes:
            - '${PROJECTCOMPOSEPATH}/${PROVISIONINGFOLDERNAME}/dev/db/:/var/lib/mysql:rw'
    varnish:
        image: plopix/docker-varnish5
        volumes:
            - '${PROJECTCOMPOSEPATH}/${PROVISIONINGFOLDERNAME}/dev/varnish/varnish.vcl:/etc/varnish/default.vcl:ro'
        ports:
            - '${PROJECTPORTPREFIX}082:80'
        depends_on:
            - nginx
    solr:
        image: 'solr:6.6'
        volumes:
            - '${PROJECTCOMPOSEPATH}/${PROVISIONINGFOLDERNAME}/dev/solr/entrypoint.bash:/entrypoint.bash:ro'
        volumes_from:
            - 'engine:rw'
        ports:
            - '${PROJECTPORTPREFIX}983:8983'
        entrypoint: /entrypoint.bash
        depends_on:
            - engine
        environment:
            - DEV_UID
            - DEV_GID
            - PROJECTMAPPINGFOLDER
    mailcatcher:
        image: schickling/mailcatcher
        ports:
            - '${PROJECTPORTPREFIX}180:1080'
    adminer:
        image: 'adminer:latest'
        ports:
            - '${PROJECTPORTPREFIX}084:8080'
    redis:
        image: 'redis:latest'
        depends_on:
            - engine
    redisadmin:
        image: 'rediscommander/redis-commander:latest'
        environment:
            - 'REDIS_HOSTS=local:redis:6379'
        ports:
            - '${PROJECTPORTPREFIX}083:8081'
    blackfire:
        image: blackfire/blackfire
        environment:
            - BLACKFIRE_CLIENT_ID
            - BLACKFIRE_CLIENT_TOKEN
            - BLACKFIRE_SERVER_ID
            - BLACKFIRE_SERVER_TOKEN

My /provisioning/dev/engine/php.ini file:

disable_functions =
disable_classes =

max_execution_time = 120
max_input_time = 90

display_errors = "On"
log_errors = "On"

memory_limit = 2048M
post_max_size = 40M
upload_max_filesize = 40M

; redis configuration in dev 
session.save_handler = redis
session.save_path = "tcp://redis:6379"
; mailcatcher configuration in dev 
sendmail_path = /usr/bin/env catchmail --smtp-ip mailcatcher --smtp-port 1025 -f docker@localhost

extension=blackfire.so
blackfire.agent_socket=tcp://blackfire:8707

[Date]
date.timezone = "Europe/Paris"


#3

I set up my eZ Launchpad at the time of eZPlatform 1.7…
I updated eZ (I’m in 2.2) But I never updated eZ Launchpad.
Maybe there are things to do on this side?


#4

Ha …

In fact it’s when I have a mistake in my code that it takes a lot of time…

So it’s an over-error.

Example of a stupid mistake:

$fv = $content->getFieldValue('at_internet');
$data = json_decode($fv->text); // $data is a stdObject
$data['foo']; // Error because $data is used as an array.

With the usual error message this inattention error is very quickly corrected.

But now I have a 504 Gateway Time-out.
Which doesn’t help me much.
Especially since she takes her time to get here…