diff --git a/README.md b/README.md index ccf53e4..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 @@ -26,7 +24,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 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/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 / diff --git a/src/app/build-prepare.sh b/src/app/build-prepare.sh index edc37f6..5e5a5c2 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 --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 - diff --git a/src/app/startup.sh b/src/app/startup.sh index 0459af4..18853cc 100755 --- a/src/app/startup.sh +++ b/src/app/startup.sh @@ -30,6 +30,7 @@ else --exclude plugins.local \ --exclude templates.local \ --exclude themes.local \ + --exclude config.php \ $SRC_DIR/ $DST_DIR/ rsync -aP --delete \ 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: 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; + } + + } +}