Browse Source

Merge branch 'static-dockerhub' of git.tt-rss.org:fox/ttrss-docker-compose into static-dockerhub

Andrew Dolgov 6 months ago
parent
commit
2cdf7937d0
8 changed files with 88 additions and 24 deletions
  1. 4 6
      README.md
  2. 10 0
      docker-compose.yml
  3. 1 1
      src/app/Dockerfile
  4. 3 17
      src/app/build-prepare.sh
  5. 1 0
      src/app/startup.sh
  6. 11 0
      src/docker-compose.yml
  7. 3 0
      src/web-nginx/Dockerfile
  8. 55 0
      src/web-nginx/nginx.conf

+ 4 - 6
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

+ 10 - 0
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:  

+ 1 - 1
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 /

+ 3 - 17
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
-

+ 1 - 0
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 \

+ 11 - 0
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:  

+ 3 - 0
src/web-nginx/Dockerfile

@@ -0,0 +1,3 @@
+FROM nginx:alpine
+
+COPY nginx.conf /etc/nginx/nginx.conf

+ 55 - 0
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;
+		}
+
+	}
+}