diff --git a/.env.prod.sample b/.env.prod.sample index 4b66ef91478c47f4711a3dd4aecb259b4c68b5cf..c4ec35c120a31121a6d5a1aed4900734c8d543c0 100644 --- a/.env.prod.sample +++ b/.env.prod.sample @@ -1,4 +1,4 @@ -COMPOSE_FILE=docker-compose.yml:traefik.yml:expose_mariadb.yml +COMPOSE_FILE=docker-compose.yml:traefik.yml:expose_mariadb.yml:memcached.yml # TRAEFIK CONFIG HOST=dolibarr.FQDN diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 4a3709be3f3ed1290d2c8806746527f2a439bad3..bdc067f987f8cbb0dd192a488a84711ca92d9266 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -10,10 +10,26 @@ git fetch git checkout $DOLI_VERSION if [ "$ENV" == "prod" ]; then sed -i '/\(xdebug.*\)/d' /etc/php/$PHP_VER/fpm/conf.d/00-dolibarr.ini - sed -i '/\(xdebug.*\)/d' /etc/php/$PHP_VER/cli/conf.d/00-dolibarr.ini sed -i '/error/d' /etc/php/$PHP_VER/fpm/conf.d/00-dolibarr.ini - sed -i '/error/d' /etc/php/$PHP_VER/cli/conf.d/00-dolibarr.ini - apt-get purge -y php-xdebug + apt-get purge -y php-xdebug php$PHP_VER-xdebug + apt-get install -y php-opcache php-memcached + cat <<EOF>>/etc/php/$PHP_VER/fpm/conf.d/00-dolibarr.ini +; Enable Opcache +opcache.enable=1 +; Set the memory size for the Opcache (e.g., 128MB) +opcache.memory_consumption=512 +; Set the maximum number of scripts to cache +opcache.max_accelerated_files=10000 +; Set the cache validity time in seconds +opcache.revalidate_freq=2 +; Enable file validation for updated scripts +opcache.validate_timestamps=1 +; Set the timeout for a request before it is terminated +opcache.max_file_size=2M +; Enable opcache for the CLI +opcache.enable_cli=1 +EOF + cp /etc/php/$PHP_VER/fpm/conf.d/00-dolibarr.ini /etc/php/$PHP_VER/cli/conf.d/00-dolibarr.ini fi echo "*/5 * * * * www-data /usr/bin/php /var/www/dolibarr/scripts/cron/cron_run_jobs.php $CRON_KEY $CRON_USER > /var/www/dolibarr/documents/cron_run_jobs.php.log" >> /etc/crontab php-fpm$PHP_VER -D diff --git a/memcached.yml b/memcached.yml new file mode 100644 index 0000000000000000000000000000000000000000..5d1cfc61c0891dd53ca7d5f5113606b9249199da --- /dev/null +++ b/memcached.yml @@ -0,0 +1,13 @@ +services: + dolibarr: + depends_on: + memcached: + condition: service_started + + memcached: + image: memcached + command: + - --conn-limit=1024 + - --memory-limit=64 + - --threads=4 +