1
0
mirror of https://github.com/funkypenguin/geek-cookbook/ synced 2025-12-13 17:56:26 +00:00

Update TTRSS for backup

This commit is contained in:
David Young
2017-08-12 21:38:37 +12:00
parent 12b206d164
commit 8c082542e8
2 changed files with 47 additions and 14 deletions

View File

@@ -69,6 +69,13 @@ Depending on your hosting environment, you may have DNS automatically setup for
192.168.31.13 ds3 ds3.funkypenguin.co.nz 192.168.31.13 ds3 ds3.funkypenguin.co.nz
``` ```
### Set timezone
Set your local timezone, by running:
```
ln -sf /usr/share/zoneinfo/<your timezone> /etc/localtime
```
## Serving ## Serving

View File

@@ -15,6 +15,16 @@
## Preparation ## Preparation
### Setup data locations
We'll need several directories to bind-mount into our container, so create them in /var/data/ttrss:
```
mkdir /var/data/ttrss
cd /var/data/ttrss
mkdir -p {database,database-dump}
```
### Prepare environment ### Prepare environment
Create ttrss.env, and populate with the following variables, customizing at least the database password (POSTGRES_PASSWORD **and** DB_PASS) and the TTRSS_SELF_URL to point to your installation. Create ttrss.env, and populate with the following variables, customizing at least the database password (POSTGRES_PASSWORD **and** DB_PASS) and the TTRSS_SELF_URL to point to your installation.
@@ -25,6 +35,13 @@ POSTGRES_USER=ttrss
POSTGRES_PASSWORD=mypassword POSTGRES_PASSWORD=mypassword
DB_EXTENSION=pg_trgm DB_EXTENSION=pg_trgm
# Variables for pg_dump running in postgres/latest (used for db-backup)
PGUSER=ttrss
PGPASSWORD=mypassword
PGHOST=db
BACKUP_NUM_KEEP=3
BACKUP_FREQUENCY=1d
# Variables for funkypenguin/docker-ttrss # Variables for funkypenguin/docker-ttrss
DB_USER=ttrss DB_USER=ttrss
DB_PASS=mypassword DB_PASS=mypassword
@@ -45,32 +62,41 @@ services:
db: db:
image: postgres:latest image: postgres:latest
env_file: /var/data/ttrss/ttrss.env env_file: /var/data/ttrss/ttrss.env
networks:
- internal
volumes: volumes:
- /var/data/ttrss/database:/var/lib/postgresql/data - /var/data/ttrss/database:/var/lib/postgresql/data
deploy: networks:
restart_policy: - internal
delay: 10s
max_attempts: 10
window: 60s
app: app:
image: x86dev/docker-ttrss image: funkypenguin/docker-ttrss
env_file: /var/data/ttrss/ttrss.env env_file: /var/data/ttrss/ttrss.env
deploy: deploy:
labels: labels:
- traefik.frontend.rule=Host:ttrss.example.com - traefik.frontend.rule=Host:ttrss.funkypenguin.co.nz
- traefik.docker.network=traefik - traefik.docker.network=traefik
- traefik.port=8080 - traefik.port=8080
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
networks: networks:
- internal - internal
- traefik - traefik
db-backup:
image: postgres:latest
env_file: /var/data/ttrss/ttrss.env
volumes:
- /var/data/ttrss/database-dump:/dump
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
sleep 2m
while /bin/true; do
pg_dump -Fc > /dump/dump_\`date +%d-%m-%Y"_"%H_%M_%S\`.psql
(ls -t /dump/dump*.psql|head -n $$BACKUP_NUM_KEEP;ls /dump/dump*.psql)|sort|uniq -u|xargs rm -- {}
sleep $$BACKUP_FREQUENCY
done
EOF'
networks:
- internal
networks: networks:
traefik: traefik:
external: true external: true