Skip to content

Commit af58b3f

Browse files
committed
docs: exclude the scratch dirs from the file backup
PHP creates temp files under images/temp with mode 600 owned by www-data, so a backup taken while an upload or thumbnail job runs failed on a file it could not read.
1 parent 79d1209 commit af58b3f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,12 @@ To change the setting, adapt `/etc/docker/daemon.json`
675675
mkdir -p backup
676676
STAMP=$(date +"%Y%m%d_%H%M%S")
677677
docker compose exec db /bin/bash -c 'mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD" 2>/dev/null | gzip | base64 -w 0' | base64 -d > backup/db_backup_$STAMP.sql.gz
678-
tar -zcf backup/file_backup_$STAMP.tar.gz mediawiki/data
678+
tar -zcf backup/file_backup_$STAMP.tar.gz \
679+
--exclude=mediawiki/data/temp --exclude=mediawiki/data/lockdir mediawiki/data
679680
```
680-
One timestamp for both files, so the database dump and the uploads that belong with it keep the same name. `mediawiki/data` is world readable as the container creates it, so no `sudo` is needed; prefix the `tar` with `sudo` if your uploads ended up with stricter permissions.
681+
One timestamp for both files, so the database dump and the uploads that belong with it keep the same name.
682+
683+
`temp` and `lockdir` are scratch space and are left out on purpose. PHP creates temporary files there with mode 600 owned by `www-data`, so an upload or a thumbnail job running while the backup does would otherwise make `tar` fail on a file it cannot read. Add `sudo` in front of `tar` if you prefer to capture them anyway, keeping in mind that the archive then belongs to root.
681684

682685

683686
## Reset

0 commit comments

Comments
 (0)