mirror of
				https://git.tt-rss.org/fox/ttrss-docker-compose
				synced 2025-11-04 08:24:13 +01:00 
			
		
		
		
	backups: also backup tt-rss local directories
This commit is contained in:
		
							parent
							
								
									707b79b52f
								
							
						
					
					
						commit
						04a5438966
					
				
					 3 changed files with 12 additions and 2 deletions
				
			
		| 
						 | 
					@ -12,7 +12,7 @@ ADD startup.sh /
 | 
				
			||||||
ADD updater.sh /
 | 
					ADD updater.sh /
 | 
				
			||||||
ADD index.php /
 | 
					ADD index.php /
 | 
				
			||||||
ADD dcron.sh /
 | 
					ADD dcron.sh /
 | 
				
			||||||
ADD backup-database.sh /etc/periodic/weekly/backup-database
 | 
					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/^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 sed -i.bak 's/\(memory_limit =\) 128M/\1 256M/' /etc/php7/php.ini
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DST_DIR=/backups
 | 
					DST_DIR=/backups
 | 
				
			||||||
KEEP_DAYS=28
 | 
					KEEP_DAYS=28
 | 
				
			||||||
 | 
					APP_ROOT=/var/www/html/tt-rss
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if pg_isready -h $DB_HOST -U $DB_USER; then
 | 
					if pg_isready -h $DB_HOST -U $DB_USER; then
 | 
				
			||||||
	DST_FILE=ttrss-backup-$(date +%Y%m%d).sql.gz
 | 
						DST_FILE=ttrss-backup-$(date +%Y%m%d).sql.gz
 | 
				
			||||||
| 
						 | 
					@ -12,9 +13,17 @@ if pg_isready -h $DB_HOST -U $DB_USER; then
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pg_dump --clean -h $DB_HOST -U $DB_USER $DB_NAME | gzip > $DST_DIR/$DST_FILE
 | 
						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...
 | 
						echo cleaning up...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	find $DST_DIR -type f -name '*.sql.gz' -mtime +$KEEP_DAYS -delete
 | 
						find $DST_DIR -type f -name '*.gz' -mtime +$KEEP_DAYS -delete
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo done.
 | 
						echo done.
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
| 
						 | 
					@ -47,6 +47,7 @@ services:
 | 
				
			||||||
      - OWNER_GID=${OWNER_GID}
 | 
					      - OWNER_GID=${OWNER_GID}
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - backups:/backups
 | 
					      - backups:/backups
 | 
				
			||||||
 | 
					      - app:/var/www/html
 | 
				
			||||||
    depends_on:
 | 
					    depends_on:
 | 
				
			||||||
      - db
 | 
					      - db
 | 
				
			||||||
    command: /dcron.sh -f
 | 
					    command: /dcron.sh -f
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue