From f447fad75c4eb52733d7ef116ef8048fc228a79f Mon Sep 17 00:00:00 2001 From: wn_ Date: Tue, 14 Feb 2023 01:37:37 +0000 Subject: [PATCH 1/4] Bump to Alpine 3.17. --- app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Dockerfile b/app/Dockerfile index ce54c6b..19ec517 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.16 +FROM alpine:3.17 EXPOSE 9000/tcp ENV SCRIPT_ROOT=/opt/tt-rss From 5222af4e832b7eac4f91eef50cb607e095502353 Mon Sep 17 00:00:00 2001 From: mossroy Date: Sat, 25 Feb 2023 15:41:12 +0300 Subject: [PATCH 2/4] Add tzdata package in app docker image to allow use of TZ env var In nginx container, it's already possible to choose the timezone by setting a TZ env var (because it's based on nginx:alpine image, that includes this package, see https://github.com/nginxinc/docker-nginx/blob/master/Dockerfile-alpine-slim.template#L96) This commit simply adds this same package in app docker image. It seems much cleaner to me than injecting /etc/timezone and /etc/localtime --- app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Dockerfile b/app/Dockerfile index 19ec517..1dd1be4 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -8,7 +8,7 @@ RUN apk add --no-cache dcron php81 php81-fpm php81-phar \ php81-mbstring php81-intl php81-xml php81-curl php81-simplexml \ php81-session php81-tokenizer php81-dom php81-fileinfo php81-ctype \ php81-json php81-iconv php81-pcntl php81-posix php81-zip php81-exif \ - php81-openssl git postgresql-client sudo php81-pecl-xdebug rsync && \ + php81-openssl git postgresql-client sudo php81-pecl-xdebug rsync tzdata && \ sed -i 's/\(memory_limit =\) 128M/\1 256M/' /etc/php81/php.ini && \ sed -i -e 's/^listen = 127.0.0.1:9000/listen = 9000/' \ -e 's/;\(clear_env\) = .*/\1 = no/i' \ From 2444e197c28a4ad01efeb82c568a74ea4769ccdc Mon Sep 17 00:00:00 2001 From: Mossroy Date: Sat, 25 Feb 2023 14:40:13 +0100 Subject: [PATCH 3/4] Allow to replace "app" server name in nginx by value of an env var By default, nginx sends php requests to an upstream "app" server. While keeping this default behavior, this commit allows the user to override this server name at runtime, by setting an APP_SERVERNAME env var to the nginx container --- web-nginx/Dockerfile | 12 +++++++++++- web-nginx/nginx.conf | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/web-nginx/Dockerfile b/web-nginx/Dockerfile index 50d976b..234a60f 100644 --- a/web-nginx/Dockerfile +++ b/web-nginx/Dockerfile @@ -2,4 +2,14 @@ FROM nginx:alpine HEALTHCHECK CMD curl --fail http://localhost/tt-rss/index.php || exit 1 -COPY nginx.conf /etc/nginx/nginx.conf +COPY nginx.conf /etc/nginx/templates/nginx.conf.template + +# By default, nginx will send the php requests to "app" server, but this server +# name can be overridden at runtime by passing an APP_SERVERNAME env var +ENV APP_SERVERNAME=${APP_SERVERNAME:-app} + +# It's necessary to set the following NGINX_ENVSUBST_OUTPUT_DIR env var to tell +# nginx to replace the env vars of /etc/nginx/templates/nginx.conf.template +# and put the result in /etc/nginx/nginx.conf (instead of /etc/nginx/conf.d/nginx.conf) +# See https://github.com/docker-library/docs/tree/master/nginx#using-environment-variables-in-nginx-configuration-new-in-119 +ENV NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx diff --git a/web-nginx/nginx.conf b/web-nginx/nginx.conf index 40b11f7..54a7c20 100644 --- a/web-nginx/nginx.conf +++ b/web-nginx/nginx.conf @@ -17,7 +17,7 @@ http { index index.php; upstream app { - server app:9000; + server ${APP_SERVERNAME}:9000; } server { From 71e21bb99a93c36a1eca5c91285b6fc59db14b0c Mon Sep 17 00:00:00 2001 From: Mossroy Date: Sat, 25 Feb 2023 15:11:39 +0100 Subject: [PATCH 4/4] Rename env var to APP_UPSTREAM --- web-nginx/Dockerfile | 4 ++-- web-nginx/nginx.conf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web-nginx/Dockerfile b/web-nginx/Dockerfile index 234a60f..b92f8f2 100644 --- a/web-nginx/Dockerfile +++ b/web-nginx/Dockerfile @@ -5,8 +5,8 @@ HEALTHCHECK CMD curl --fail http://localhost/tt-rss/index.php || exit 1 COPY nginx.conf /etc/nginx/templates/nginx.conf.template # By default, nginx will send the php requests to "app" server, but this server -# name can be overridden at runtime by passing an APP_SERVERNAME env var -ENV APP_SERVERNAME=${APP_SERVERNAME:-app} +# name can be overridden at runtime by passing an APP_UPSTREAM env var +ENV APP_UPSTREAM=${APP_UPSTREAM:-app} # It's necessary to set the following NGINX_ENVSUBST_OUTPUT_DIR env var to tell # nginx to replace the env vars of /etc/nginx/templates/nginx.conf.template diff --git a/web-nginx/nginx.conf b/web-nginx/nginx.conf index 54a7c20..7616169 100644 --- a/web-nginx/nginx.conf +++ b/web-nginx/nginx.conf @@ -17,7 +17,7 @@ http { index index.php; upstream app { - server ${APP_SERVERNAME}:9000; + server ${APP_UPSTREAM}:9000; } server {