From 92f2f526f6d27fa78a9cf06311f5b79935fde33f Mon Sep 17 00:00:00 2001 From: fox Date: Fri, 24 Jan 2020 20:13:56 +0000 Subject: [PATCH 1/8] Update 'README.md' --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ccf53e4..a274490 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ General outline of the configuration is as follows: ### Installation -#### Get ``docker-compose.yml`` and ``.env-dist`` +#### Get [docker-compose.yml](https://git.tt-rss.org/fox/ttrss-docker-compose/src/static-dockerhub/docker-compose.yml) and [.env-dist](https://git.tt-rss.org/fox/ttrss-docker-compose/src/static-dockerhub/.env-dist) ```sh git clone https://git.tt-rss.org/fox/ttrss-docker-compose.git ttrss-docker From f6f912c2b03ba62cef1d75354f4260d57bd780af Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 25 Jan 2020 08:43:31 +0300 Subject: [PATCH 2/8] include php7-zip in the app image (for data_migration plugin) --- src/app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/Dockerfile b/src/app/Dockerfile index 479d541..e613e43 100644 --- a/src/app/Dockerfile +++ b/src/app/Dockerfile @@ -5,7 +5,7 @@ RUN apk add --no-cache php7 php7-fpm \ php7-pdo php7-gd php7-pgsql php7-pdo_pgsql php7-mbstring \ php7-intl php7-xml php7-curl php7-session \ php7-dom php7-fileinfo php7-json \ - php7-pcntl php7-posix \ + php7-pcntl php7-posix php7-zip \ git postgresql-client sudo rsync ADD startup.sh / From b7671a8f338c682395dda86112b93cb11846ac1d Mon Sep 17 00:00:00 2001 From: fox Date: Sat, 25 Jan 2020 12:14:30 +0000 Subject: [PATCH 3/8] Update 'README.md' --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a274490..057d9de 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,19 @@ The idea is to provide tt-rss working (and updating) out of the box with minimal fuss. +**This compose setup uses prebuilt images from Docker Hub.** + This setup is still WIP. Some features may be unimplemented or broken. Check the following before deploying: - [TODO](https://git.tt-rss.org/fox/ttrss-docker-compose/wiki/TODO) - [FAQ](https://git.tt-rss.org/fox/ttrss-docker-compose/wiki#faq) -**EXPERIMENTAL, DON'T USE IN PRODUCTION** - -**This is an alternative version which uses prebuilt images from Docker Hub.** - General outline of the configuration is as follows: - separate containers (frontend: caddy, database: pgsql, app and updater: php/fpm) - tt-rss latest git master source baked into container on build - - images are pulled from [Docker Hub](https://hub.docker.com/u/cthulhoo) (automatically published on tt-rss master source update) + - images are pulled from [Docker Hub](https://hub.docker.com/u/cthulhoo) (automatically built and published on tt-rss master source update) - working copy is stored on (and rsynced over on restart) a persistent volume so plugins, etc. could be easily added - ``config.php`` is generated if it is missing - database schema is installed automatically if it is missing From 6552ffd9dd62bb5d2f1aaad0880384697e56ba02 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 25 Jan 2020 15:33:04 +0300 Subject: [PATCH 4/8] remove useless code from app build script --- src/app/build-prepare.sh | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/app/build-prepare.sh b/src/app/build-prepare.sh index edc37f6..cf68895 100755 --- a/src/app/build-prepare.sh +++ b/src/app/build-prepare.sh @@ -1,24 +1,10 @@ #!/bin/sh DST_DIR=/src/tt-rss -SRC_REPO=https://git.tt-rss.org/fox/tt-rss.git -if [ ! -d $DST_DIR ]; then - mkdir -p $DST_DIR - git clone $SRC_REPO $DST_DIR -else - cd $DST_DIR && \ - git config core.filemode false && \ - git pull origin master -fi +mkdir -p $DST_DIR -if [ ! -d $DST_DIR/plugins.local/nginx_xaccel ]; then - git clone https://git.tt-rss.org/fox/ttrss-nginx-xaccel.git $DST_DIR/plugins.local/nginx_xaccel -else - cd $DST_DIR/plugins.local/nginx_xaccel && \ - git config core.filemode false && \ - git pull origin master -fi +git clone https://git.tt-rss.org/fox/tt-rss.git $DST_DIR +git clone https://git.tt-rss.org/fox/ttrss-nginx-xaccel.git $DST_DIR/plugins.local/nginx_xaccel mkdir -p /var/www - From 4e5e529eb6d51cf98d1d225c8f0141c7c20a631b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 25 Jan 2020 16:20:00 +0300 Subject: [PATCH 5/8] don't clone entire git history into container image --- src/app/build-prepare.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/build-prepare.sh b/src/app/build-prepare.sh index cf68895..5e5a5c2 100755 --- a/src/app/build-prepare.sh +++ b/src/app/build-prepare.sh @@ -4,7 +4,7 @@ DST_DIR=/src/tt-rss mkdir -p $DST_DIR -git clone https://git.tt-rss.org/fox/tt-rss.git $DST_DIR -git clone https://git.tt-rss.org/fox/ttrss-nginx-xaccel.git $DST_DIR/plugins.local/nginx_xaccel +git clone --branch master --depth 1 https://git.tt-rss.org/fox/tt-rss.git $DST_DIR +git clone --branch master --depth 1 https://git.tt-rss.org/fox/ttrss-nginx-xaccel.git $DST_DIR/plugins.local/nginx_xaccel mkdir -p /var/www From 93ab83f635c6b80dc92a0272bf6fb85d6704b069 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 1 Feb 2020 10:58:54 +0300 Subject: [PATCH 6/8] add optional configuration for nginx frontend container --- docker-compose.yml | 10 ++++++++++ src/docker-compose.yml | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 959340b..fbd0c8a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,6 +73,16 @@ services: # depends_on: # - app +# web-nginx: +# image: cthulhoo/ttrss-web-nginx +# restart: unless-stopped +# ports: +# - ${HTTP_PORT}:80 +# volumes: +# - app:/var/www/html:ro +# depends_on: +# - app + volumes: db: app: diff --git a/src/docker-compose.yml b/src/docker-compose.yml index 945e346..f5e52b9 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -81,6 +81,17 @@ services: depends_on: - app + web-nginx: + image: cthulhoo/ttrss-web-nginx:latest + build: ./web-nginx + restart: unless-stopped + ports: + - ${HTTP_PORT}:80 + volumes: + - app:/var/www/html:ro + depends_on: + - app + volumes: db: app: From 58014048d26e23f6e5fe8df907e0ae61136c08e5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 1 Feb 2020 10:59:27 +0300 Subject: [PATCH 7/8] add src/web-nginx --- src/web-nginx/Dockerfile | 3 +++ src/web-nginx/nginx.conf | 55 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 src/web-nginx/Dockerfile create mode 100644 src/web-nginx/nginx.conf diff --git a/src/web-nginx/Dockerfile b/src/web-nginx/Dockerfile new file mode 100644 index 0000000..9e620af --- /dev/null +++ b/src/web-nginx/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:alpine + +COPY nginx.conf /etc/nginx/nginx.conf diff --git a/src/web-nginx/nginx.conf b/src/web-nginx/nginx.conf new file mode 100644 index 0000000..efe2eea --- /dev/null +++ b/src/web-nginx/nginx.conf @@ -0,0 +1,55 @@ +worker_processes auto; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + access_log /dev/stdout; + error_log /dev/stderr warn; + + sendfile on; + + index index.php; + + upstream app { + server app:9000; + } + + server { + listen 80; + root /var/www/html; + + location /tt-rss/cache { + aio threads; + internal; + } + + location ~ \.php$ { + # regex to split $uri to $fastcgi_script_name and $fastcgi_path + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + + # Check that the PHP script exists before passing it + try_files $fastcgi_script_name =404; + + # Bypass the fact that try_files resets $fastcgi_path_info + # see: http://trac.nginx.org/nginx/ticket/321 + set $path_info $fastcgi_path_info; + fastcgi_param PATH_INFO $path_info; + + fastcgi_index index.php; + include fastcgi.conf; + + fastcgi_pass app; + } + + location / { + try_files $uri $uri/ =404; + } + + } +} From 1ead810c7854648c882627b5be668dea76ba33bb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 6 Feb 2020 15:36:47 +0300 Subject: [PATCH 8/8] do not remove config.php when rsyncing source to work directory --- src/app/startup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/startup.sh b/src/app/startup.sh index f4eee5c..42e3729 100755 --- a/src/app/startup.sh +++ b/src/app/startup.sh @@ -29,6 +29,7 @@ else --exclude feed-icons \ --exclude plugins.local \ --exclude themes.local \ + --exclude config.php \ $SRC_DIR/ $DST_DIR/ rsync -aP --delete \