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

pull/5/head
Andrew Dolgov 4 years ago
commit aec490eea1

@ -4,9 +4,6 @@ The idea is to provide tt-rss working (and updating) out of the box with minimal
**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)
@ -21,6 +18,7 @@ General outline of the configuration is as follows:
- Caddy has its http port exposed to the outside
- optional SSL support via Caddy w/ automatic letsencrypt certificates
- feed updates are handled via update daemon started in a separate container (updater)
- optional backups container which performs tt-rss database backup once a week
### Installation

@ -48,6 +48,24 @@ services:
- app
command: /updater.sh
backups:
image: cthulhoo/ttrss-fpm-pgsql-static
restart: unless-stopped
environment:
- DB_TYPE=pgsql
- DB_HOST=db
- DB_NAME=${POSTGRES_USER}
- DB_USER=${POSTGRES_USER}
- DB_PASS=${POSTGRES_PASSWORD}
- OWNER_UID=${OWNER_UID}
- OWNER_GID=${OWNER_GID}
volumes:
- backups:/backups
- app:/var/www/html
depends_on:
- db
command: /dcron.sh -f
web:
image: cthulhoo/ttrss-web
restart: unless-stopped
@ -87,3 +105,4 @@ volumes:
db:
app:
certs:
backups:

@ -1,7 +1,7 @@
FROM alpine:3.9
FROM alpine:3.12
EXPOSE 9000/tcp
RUN apk add --no-cache php7 php7-fpm \
RUN apk add --no-cache dcron 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 \
@ -12,8 +12,11 @@ ADD startup.sh /
ADD updater.sh /
ADD index.php /
ADD build-prepare.sh /
ADD dcron.sh /
ADD backup.sh /etc/periodic/weekly/backup
RUN sed -i.bak 's/^listen = 127.0.0.1:9000/listen = 9000/' /etc/php7/php-fpm.d/www.conf
RUN sed -i.bak 's/\(memory_limit =\) 128M/\1 256M/' /etc/php7/php.ini
RUN sh -c /build-prepare.sh

@ -0,0 +1,31 @@
#!/bin/sh -e
DST_DIR=/backups
KEEP_DAYS=28
APP_ROOT=/var/www/html/tt-rss
if pg_isready -h $DB_HOST -U $DB_USER; then
DST_FILE=ttrss-backup-$(date +%Y%m%d).sql.gz
echo backing up tt-rss database to $DST_DIR/$DST_FILE...
export PGPASSWORD=$DB_PASS
pg_dump --clean -h $DB_HOST -U $DB_USER $DB_NAME | gzip > $DST_DIR/$DST_FILE
DST_FILE=ttrss-backup-$(date +%Y%m%d).tar.gz
echo backing up tt-rss local directories to $DST_DIR/$DST_FILE...
tar -cz -f $DST_DIR/$DST_FILE $APP_ROOT/*.local \
$APP_ROOT/feed-icons/ \
$APP_ROOT/config.php
echo cleaning up...
find $DST_DIR -type f -name '*.gz' -mtime +$KEEP_DAYS -delete
echo done.
else
echo backup failed: database is not ready.
fi

@ -0,0 +1,5 @@
#!/bin/sh
# https://github.com/dubiousjim/dcron/issues/13
set -e
/usr/sbin/crond "$@"

@ -42,7 +42,8 @@ for d in cache lock feed-icons plugins.local themes.local; do
done
for d in cache lock feed-icons; do
chmod -R 777 $DST_DIR/$d
chmod 777 $DST_DIR/$d
find $DST_DIR/$d -type f -exec chmod 666 {} \;
done
chown -R $OWNER_UID:$OWNER_GID $DST_DIR \
@ -83,6 +84,8 @@ else
-i $DST_DIR/config.php
fi
cd $DST_DIR && sudo -u app php ./update.php --update-schema=force-yes
touch $DST_DIR/.app_is_ready
sudo -u app /usr/sbin/php-fpm7 -F

@ -54,6 +54,27 @@ services:
- app
command: /updater.sh
backups:
image: cthulhoo/ttrss-fpm-pgsql-static:${BUILD_TAG}
build:
context:
./app
restart: unless-stopped
environment:
- DB_TYPE=pgsql
- DB_HOST=db
- DB_NAME=${POSTGRES_USER}
- DB_USER=${POSTGRES_USER}
- DB_PASS=${POSTGRES_PASSWORD}
- OWNER_UID=${OWNER_UID}
- OWNER_GID=${OWNER_GID}
volumes:
- backups:/backups
- app:/var/www/html
depends_on:
- db
command: /dcron.sh -f
web:
image: cthulhoo/ttrss-web:latest
build: ./web
@ -96,3 +117,4 @@ volumes:
db:
app:
certs:
backups:

@ -22,6 +22,8 @@ http {
server {
listen 80;
listen [::]:80;
root /var/www/html;
location /tt-rss/cache {
@ -29,6 +31,10 @@ http {
internal;
}
location /tt-rss/backups {
internal;
}
location ~ \.php$ {
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;

@ -5,4 +5,5 @@ root /var/www/html
log stdout
errors stderr
internal /tt-rss/cache
fastcgi / app:9000 php
internal /tt-rss/backups
fastcgi / app:9000 php

@ -3,4 +3,5 @@ root /var/www/html
log stdout
errors stderr
internal /tt-rss/cache
fastcgi / app:9000 php
internal /tt-rss/backups
fastcgi / app:9000 php

Loading…
Cancel
Save