From 20a8c65450dbac3f71289479ec214f0d298b4e57 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 28 Feb 2021 21:35:14 +0300 Subject: [PATCH 1/3] map mysql storage to a volume properly --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index db4d86d..a5bc3ec 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: - MYSQL_ROOT_PASSWORD=${TTRSS_DB_PASS} - MYSQL_DATABASE=${TTRSS_DB_NAME} volumes: - - db:/var/lib/postgresql/data + - db:/var/lib/mysql app: build: From ed07fa1fbbe99274a01301ce58348d6ccad1bca3 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 4 Mar 2021 09:28:32 +0300 Subject: [PATCH 2/3] remove manual loading of base database schema --- app/startup.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/startup.sh b/app/startup.sh index 24f6213..5eafc33 100755 --- a/app/startup.sh +++ b/app/startup.sh @@ -63,14 +63,6 @@ for d in cache lock feed-icons; do find $DST_DIR/$d -type f -exec chmod 666 {} \; done -RESTORE_SCHEMA=${SCRIPT_ROOT}/restore-schema.sql.gz - -if [ -r $RESTORE_SCHEMA ]; then - zcat $RESTORE_SCHEMA | $PSQL -elif ! $PSQL -e 'select * from ttrss_version'; then - $PSQL < /var/www/html/tt-rss/schema/ttrss_schema_mysql.sql -fi - # this was previously generated rm -f $DST_DIR/config.php.bak From e2edaf7d03455609d37e67e19a081602e5561e5e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 8 Mar 2021 09:45:14 +0300 Subject: [PATCH 3/3] add a hack to send fpm children logs to docker-captured stderr --- app/Dockerfile | 26 ++++++++++++++------------ app/startup.sh | 9 +++++---- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/Dockerfile b/app/Dockerfile index 01ff0ee..3658d6e 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -1,16 +1,22 @@ FROM alpine:3.13 EXPOSE 9000/tcp -RUN apk add --no-cache dcron php8 php8-fpm \ - php8-pdo php8-gd php8-mysqlnd php8-pdo_mysql php8-mbstring \ - php8-intl php8-xml php8-curl php8-session \ - php8-dom php8-fileinfo php8-json php8-iconv \ - php8-pcntl php8-posix php8-zip php8-openssl \ - git mysql-client sudo php8-pecl-xdebug - ENV SCRIPT_ROOT=/opt/tt-rss -RUN mkdir -p /var/www ${SCRIPT_ROOT}/config.d +RUN apk add --no-cache dcron php8 php8-fpm \ + php8-pdo php8-gd php8-mysqlnd php8-pdo_mysql \ + php8-mbstring php8-intl php8-xml php8-curl \ + php8-session php8-tokenizer php8-dom php8-fileinfo \ + php8-json php8-iconv php8-pcntl php8-posix php8-zip \ + php8-openssl git mysql-client sudo php8-pecl-xdebug rsync && \ + sed -i 's/\(memory_limit =\) 128M/\1 256M/' /etc/php8/php.ini && \ + sed -i -e 's/^listen = 127.0.0.1:9000/listen = 9000/' \ + -e 's/;\(clear_env\) = .*/\1 = no/i' \ + -e 's/^\(user\|group\) = .*/\1 = app/i' \ + -e 's/;\(php_admin_value\[error_log\]\) = .*/\1 = \/tmp\/error.log/' \ + -e 's/;\(php_admin_flag\[log_errors\]\) = .*/\1 = on/' \ + /etc/php8/php-fpm.d/www.conf && \ + mkdir -p /var/www ${SCRIPT_ROOT}/config.d ADD startup.sh ${SCRIPT_ROOT} ADD updater.sh ${SCRIPT_ROOT} @@ -19,10 +25,6 @@ ADD dcron.sh ${SCRIPT_ROOT} ADD backup.sh /etc/periodic/weekly/backup ADD config.docker.php ${SCRIPT_ROOT} -RUN sed -i.bak 's/^listen = 127.0.0.1:9000/listen = 9000/' /etc/php8/php-fpm.d/www.conf -RUN sed -i.bak 's/\(memory_limit =\) 128M/\1 256M/' /etc/php8/php.ini -RUN sed -i.bak 's/;clear_env = .*/clear_env = no/i' /etc/php8/php-fpm.d/www.conf - ENV OWNER_UID=1000 ENV OWNER_GID=1000 diff --git a/app/startup.sh b/app/startup.sh index 24f6213..95d0e58 100755 --- a/app/startup.sh +++ b/app/startup.sh @@ -67,8 +67,6 @@ RESTORE_SCHEMA=${SCRIPT_ROOT}/restore-schema.sql.gz if [ -r $RESTORE_SCHEMA ]; then zcat $RESTORE_SCHEMA | $PSQL -elif ! $PSQL -e 'select * from ttrss_version'; then - $PSQL < /var/www/html/tt-rss/schema/ttrss_schema_mysql.sql fi # this was previously generated @@ -91,7 +89,10 @@ fi cd $DST_DIR && sudo -E -u app php8 ./update.php --update-schema=force-yes -touch $DST_DIR/.app_is_ready +rm -f /tmp/error.log && mkfifo /tmp/error.log && chown app:app /tmp/error.log + +(tail -q -f /tmp/error.log >> /proc/1/fd/2) & -sudo -E -u app /usr/sbin/php-fpm8 -F +touch $DST_DIR/.app_is_ready +exec /usr/sbin/php-fpm8 --nodaemonize --force-stderr