From abf9b821d96633676aaf275d47671fd5d3151b27 Mon Sep 17 00:00:00 2001 From: Alexandre BRACH Date: Thu, 6 Jun 2019 18:32:43 +0200 Subject: [PATCH] PHRDPL-60 #comment Check the INSTALL_* env vars for auto installation --- Dockerfile | 3 +-- docker/phraseanet/auto-install.sh | 27 +++++++++++++++++++++++++++ docker/phraseanet/boot.sh | 9 +++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100755 docker/phraseanet/auto-install.sh diff --git a/Dockerfile b/Dockerfile index 0320f93cdb..7c3bccad7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,8 +64,6 @@ RUN mkdir /entrypoint /var/alchemy \ && mkdir -p /home/app/.composer \ && chown -R app: /home/app /var/alchemy -ADD ./docker/phraseanet/ / - WORKDIR /var/alchemy/ COPY gulpfile.js /var/alchemy/ @@ -83,6 +81,7 @@ RUN make clean_assets RUN make install_asset_dependencies RUN make install_assets +ADD ./docker/phraseanet/ / COPY lib /var/alchemy/lib COPY tmp /var/alchemy/tmp COPY config /var/alchemy/config diff --git a/docker/phraseanet/auto-install.sh b/docker/phraseanet/auto-install.sh new file mode 100755 index 0000000000..83d2d17354 --- /dev/null +++ b/docker/phraseanet/auto-install.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +/var/alchemy/Phraseanet/bin/setup system:install \ + --email=$INSTALL_ACCOUNT_EMAIL \ + --password=$INSTALL_ACCOUNT_PASSWORD \ + --db-host=$INSTALL_DB_HOST \ + --db-port=$INSTALL_DB_PORT \ + --db-user=$INSTALL_DB_USER \ + --db-password=$INSTALL_DB_PASSWORD \ + --db-template=$INSTALL_DB_TEMPLATE \ + --appbox=$INSTALL_APPBOX \ + --databox=$INSTALL_DATABOX \ + --server-name=$INSTALL_SERVER_NAME \ + --data-path=/var/alchemy/Phraseanet/datas -y + +/var/alchemy/Phraseanet/bin/setup system:config set main.search-engine.options.host elasticsearch +/var/alchemy/Phraseanet/bin/setup system:config set main.search-engine.options.minScore 2 +/var/alchemy/Phraseanet/bin/setup system:config set main.search-engine.options.base_aggregate_limit 10 +/var/alchemy/Phraseanet/bin/setup system:config set main.search-engine.options.collection_aggregate_limit 10 +/var/alchemy/Phraseanet/bin/setup system:config set main.search-engine.options.doctype_aggregate_limit 10 +/var/alchemy/Phraseanet/bin/console compile:configuration +/var/alchemy/Phraseanet/bin/console searchengine:index -c + +## enable API and disable ssl on it +/var/alchemy/Phraseanet/bin/setup system:config set registry.api-clients.api-enabled true +/var/alchemy/Phraseanet/bin/setup system:config set main.api_require_ssl false +/var/alchemy/Phraseanet/bin/console comp:conf diff --git a/docker/phraseanet/boot.sh b/docker/phraseanet/boot.sh index d38c260225..9d576f1758 100755 --- a/docker/phraseanet/boot.sh +++ b/docker/phraseanet/boot.sh @@ -2,4 +2,13 @@ envsubst < /php.ini.sample > /usr/local/etc/php/php.ini envsubst < /php-fpm.conf.sample > /usr/local/etc/php-fpm.conf + +FILE=/var/alchemy/Phraseanet/config/configuration.yml +if [ -f "$FILE" ]; then + echo "$FILE exist, skip setup." +else + echo "$FILE doesn't exist, entering setup..." + runuser app -c '/auto-install.sh' +fi + php-fpm