From e55dbd4f899037cf2f85ce5769edf590c33ee098 Mon Sep 17 00:00:00 2001 From: Alexandre BRACH Date: Thu, 30 Jan 2020 11:49:11 +0100 Subject: [PATCH 1/3] PHRDPL-86 #comment XDebug ok --- Dockerfile | 12 +++++++++++- docker/phraseanet/boot.sh | 2 +- docker/phraseanet/phraseanet-entrypoint.sh | 11 +++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5b317cd003..418e8e812d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,11 @@ RUN apt-get update \ xpdf \ && update-locale "LANG=fr_FR.UTF-8 UTF-8" \ && dpkg-reconfigure --frontend noninteractive locales \ - && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ + && docker-php-source extract \ && docker-php-ext-install -j$(nproc) gd \ && docker-php-ext-install zip exif iconv mbstring pcntl sockets xsl intl pdo_mysql gettext bcmath mcrypt \ && pecl install redis amqp-1.9.3 zmq-beta imagick-beta \ @@ -126,6 +130,12 @@ RUN mkdir -p /var/alchemy/Phraseanet/logs \ FROM phraseanet-system as phraseanet-fpm +RUN docker-php-source extract \ + && pecl install xdebug-2.9.0 \ + && docker-php-ext-enable xdebug \ + #&& pecl clear-cache \ + && docker-php-source delete + COPY --from=builder --chown=app /var/alchemy /var/alchemy/Phraseanet ADD ./docker/phraseanet/ / WORKDIR /var/alchemy/Phraseanet diff --git a/docker/phraseanet/boot.sh b/docker/phraseanet/boot.sh index 444b63a64c..578da3a8da 100755 --- a/docker/phraseanet/boot.sh +++ b/docker/phraseanet/boot.sh @@ -14,4 +14,4 @@ else runuser app -c '/auto-install.sh' fi -php-fpm +php-fpm -F diff --git a/docker/phraseanet/phraseanet-entrypoint.sh b/docker/phraseanet/phraseanet-entrypoint.sh index 225b56a672..3040718c11 100755 --- a/docker/phraseanet/phraseanet-entrypoint.sh +++ b/docker/phraseanet/phraseanet-entrypoint.sh @@ -4,5 +4,16 @@ set -e envsubst < /php.ini.sample > /usr/local/etc/php/php.ini envsubst < /php-fpm.conf.sample > /usr/local/etc/php-fpm.conf +echo "XDEBUG=$XDEBUG" +if [ $XDEBUG = "ON" ]; then + echo "XDEBUG IS ENABLED. YOU MAY KEEP THIS FEATURE DISABLED IN PRODUCTION." + echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + echo "xdebug.remote_host=$XDEBUG_SERVER" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + echo "xdebug.remote_port=$XDEBUG_REMOTE_PORT" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + echo "xdebug.remote_handler=dbgp" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + #echo "xdebug.idekey=11896" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi bash -e docker-php-entrypoint $@ From 63fce45974993ee49f430eafea63778dc8f5e173 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Wed, 19 Feb 2020 16:20:36 +0100 Subject: [PATCH 2/3] PHRAS-2854_generate-js-fixtures add message to tell to remove plugins --- .../Phrasea/Command/Developer/JsFixtures.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php b/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php index 890fed9e6d..4427cd4ce6 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php +++ b/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php @@ -15,6 +15,7 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Command\Command; use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Model\Entities\User; +use Alchemy\Phrasea\Plugin\Plugin; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\HttpKernel\Client; @@ -30,6 +31,15 @@ class JsFixtures extends Command protected function doExecute(InputInterface $input, OutputInterface $output) { + /** @var Plugin $plugin */ + $msg = []; + foreach($this->container['plugins.manager']->listPlugins() as $plugin) { + $msg[] = sprintf(" bin/setup plugins:remove \"%s\"", $plugin->getName()); + } + if(count($msg) !== 0) { + throw new RuntimeException("You must remove plugins first:\n" . join("\n", $msg)); + } + if (!file_exists($this->container['db.fixture.info']['path'])) { throw new RuntimeException('You must generate sqlite db first, run "bin/developer phraseanet:regenerate-sqlite" command.'); } @@ -104,6 +114,7 @@ class JsFixtures extends Command private function writeResponse(OutputInterface $output, $method, $path, $to, $authenticateUser = false) { $environment = Application::ENV_TEST; + /** @var Application $app */ $app = require __DIR__ . '/../../Application/Root.php'; $app['orm.em'] = $app->extend('orm.em', function($em, $app) { return $app['orm.ems'][$app['db.fixture.hash.key']]; @@ -119,12 +130,14 @@ class JsFixtures extends Command $output->writeln(sprintf("Generating %s", $target)); if ($authenticateUser) { - $this->loginUser($app, $user); + // $this->loginUser($app, $user); + $app->getAuthenticator()->openAccount($user); } $client->request($method, $path); $response = $client->getResponse(); if ($authenticateUser) { - $this->logoutUser($app); + // $this->logoutUser($app); + $app->getAuthenticator()->closeAccount(); } if (false === $response->isOk()) { $this->deleteUser($user); From 4f99fb57c7368f15ee8754ad549250def4f83429 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Wed, 19 Feb 2020 17:10:32 +0100 Subject: [PATCH 3/3] cleanup debug --- lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php b/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php index 4427cd4ce6..112914d088 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php +++ b/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php @@ -130,14 +130,12 @@ class JsFixtures extends Command $output->writeln(sprintf("Generating %s", $target)); if ($authenticateUser) { - // $this->loginUser($app, $user); - $app->getAuthenticator()->openAccount($user); + $this->loginUser($app, $user); } $client->request($method, $path); $response = $client->getResponse(); if ($authenticateUser) { - // $this->logoutUser($app); - $app->getAuthenticator()->closeAccount(); + $this->logoutUser($app); } if (false === $response->isOk()) { $this->deleteUser($user);