PHRDPL-36 #comment remove supervisord & configure vars at startup

This commit is contained in:
Alexandre BRACH
2019-06-07 17:05:32 +02:00
parent 501a60e604
commit 040172b509
5 changed files with 31 additions and 41 deletions

View File

@@ -24,7 +24,6 @@ RUN apt-get update \
libzmq3-dev \ libzmq3-dev \
locales \ locales \
mcrypt \ mcrypt \
supervisor \
swftools \ swftools \
unoconv \ unoconv \
unzip \ unzip \
@@ -38,9 +37,7 @@ RUN apt-get update \
&& docker-php-ext-enable redis amqp zmq imagick \ && docker-php-ext-enable redis amqp zmq imagick \
&& pecl clear-cache \ && pecl clear-cache \
&& docker-php-source delete \ && docker-php-source delete \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/*
&& mkdir -p /var/log/supervisor
#&& chown -R app: /var/log/supervisor
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \ && php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
@@ -52,7 +49,7 @@ RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
# https://linuxize.com/post/how-to-install-node-js-on-ubuntu-18.04/ # https://linuxize.com/post/how-to-install-node-js-on-ubuntu-18.04/
# https://yarnpkg.com/lang/en/docs/install/#debian-stable # https://yarnpkg.com/lang/en/docs/install/#debian-stable
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt install nodejs \ && apt install -y nodejs \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update && apt-get install -y --no-install-recommends yarn \ && apt-get update && apt-get install -y --no-install-recommends yarn \
@@ -117,7 +114,6 @@ RUN apt-get update \
libzmq3-dev \ libzmq3-dev \
locales \ locales \
mcrypt \ mcrypt \
supervisor \
swftools \ swftools \
unoconv \ unoconv \
unzip \ unzip \
@@ -131,8 +127,7 @@ RUN apt-get update \
&& docker-php-ext-enable redis amqp zmq imagick \ && docker-php-ext-enable redis amqp zmq imagick \
&& pecl clear-cache \ && pecl clear-cache \
&& docker-php-source delete \ && docker-php-source delete \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/*
&& mkdir -p /var/log/supervisor
RUN mkdir /entrypoint /var/alchemy \ RUN mkdir /entrypoint /var/alchemy \
&& useradd -u 1000 app \ && useradd -u 1000 app \
@@ -154,6 +149,7 @@ RUN mkdir -p /var/alchemy/Phraseanet/logs \
&& mkdir -p /var/alchemy/Phraseanet/config \ && mkdir -p /var/alchemy/Phraseanet/config \
&& chmod -R 777 /var/alchemy/Phraseanet/config && chmod -R 777 /var/alchemy/Phraseanet/config
WORKDIR /var/alchemy/Phraseanet WORKDIR /var/alchemy/Phraseanet
ENTRYPOINT ["/phraseanet-entrypoint.sh"]
CMD ["/boot.sh"] CMD ["/boot.sh"]
# phraseanet-nginx # phraseanet-nginx

View File

@@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -xe
/var/alchemy/Phraseanet/bin/setup system:install \ /var/alchemy/Phraseanet/bin/setup system:install \
--email=$INSTALL_ACCOUNT_EMAIL \ --email=$INSTALL_ACCOUNT_EMAIL \
--password=$INSTALL_ACCOUNT_PASSWORD \ --password=$INSTALL_ACCOUNT_PASSWORD \
@@ -18,10 +20,25 @@
/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.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.collection_aggregate_limit 10
/var/alchemy/Phraseanet/bin/setup system:config set main.search-engine.options.doctype_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
## Redis
/var/alchemy/Phraseanet/bin/setup system:config set main.cache.options.host redis
/var/alchemy/Phraseanet/bin/setup system:config set main.cache.options.port 6379
/var/alchemy/Phraseanet/bin/setup system:config set main.cache.options.domain $INSTALL_SERVER_NAME
/var/alchemy/Phraseanet/bin/setup system:config set main.cache.type redis
# RabbitMQ
bin/setup system:config set rabbitmq.server.host rabbitmq
bin/setup system:config set rabbitmq.server.port 5672
bin/setup system:config set rabbitmq.server.user $INSTALL_RABBITMQ_USER
bin/setup system:config set rabbitmq.server.password $INSTALL_RABBITMQ_PASSWORD
bin/setup system:config set rabbitmq.server.vhost /
/var/alchemy/Phraseanet/bin/console searchengine:index -c /var/alchemy/Phraseanet/bin/console searchengine:index -c
## enable API and disable ssl on it ## 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 registry.api-clients.api-enabled true
/var/alchemy/Phraseanet/bin/setup system:config set main.api_require_ssl false /var/alchemy/Phraseanet/bin/setup system:config set main.api_require_ssl false
/var/alchemy/Phraseanet/bin/console comp:conf /var/alchemy/Phraseanet/bin/console compile:configuration

View File

@@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
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 FILE=/var/alchemy/Phraseanet/config/configuration.yml
if [ -f "$FILE" ]; then if [ -f "$FILE" ]; then
echo "$FILE exist, skip setup." echo "$FILE exist, skip setup."

View File

@@ -1,28 +0,0 @@
[program:scheduler-phraseanet]
command=php /var/alchemy/Phraseanet/bin/console task-manager:scheduler:run ; the program (relative uses PATH, can take args)
stdout_logfile=/var/log/supervisor/scheduler-phraseanet.log ; stdout log path, NONE for none; default AUTO
stderr_logfile=/var/log/supervisor/scheduler-phraseanet_error.log ; stderr log path, NONE for none; default AUTO
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
numprocs=1 ; number of processes copies to start (def 1)
directory=/tmp ; directory to cwd to before exec (def no cwd)
priority=999 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected)
startsecs=0 ; number of secs prog must stay running (def. 1)
startretries=3 ; max # of serial start failures (default 3)
exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
stopsignal=INT ; signal used to kill process (default TERM)
stopwaitsecs=20 ; max num secs to wait b4 SIGKILL (default 10)
stopasgroup=true ; send stop signal to the UNIX process group (default false)
killasgroup=true ; SIGKILL the UNIX process group (def false)
redirect_stderr=true ; redirect proc stderr to stdout (default false)
user=1000 ; setuid to this UNIX account to run the program
stdout_logfile_maxbytes=50MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
stdout_events_enabled=false ; emit events on stdout writes (default false)
stderr_logfile_maxbytes=10MB ; max # logfile bytes b4 rotation (default 50MB)
stderr_logfile_backups=10 ; # of stderr logfile backups (default 10)
stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
stderr_events_enabled=false ; emit events on stderr writes (default false)
environment=HOME=/var/alchemy/Phraseanet,USER=app,PATH="/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin" ; process environment additions (def no add)

View File

@@ -0,0 +1,8 @@
#!/bin/bash
set -e
envsubst < /php.ini.sample > /usr/local/etc/php/php.ini
envsubst < /php-fpm.conf.sample > /usr/local/etc/php-fpm.conf
docker-php-entrypoint $@