Skip to content
This repository was archived by the owner on Jan 12, 2022. It is now read-only.

Commit a56a99a

Browse files
committed
Update README with restore instructions
1 parent ebf503a commit a56a99a

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,48 @@ The [Moodle eMailTest](https://moodle.org/plugins/local_mailtest) plugin is bake
8787
```bash
8888
openssl req -x509 -newkey rsa:4096 -keyout moodle.key -out moodle.crt -days 365 -nodes -subj "/C=CA/ST=ON/L=Toronto/O=SC/OU=Org/CN=www.example.com"
8989
```
90+
91+
## Restoring a database backup
92+
93+
First, ensure you have a backup and delta to restore from! On systems installed from .deb package, the files are stored on the docker host under /backups by default.
94+
95+
Pause the backup cron on the docker host by commenting the job:
96+
97+
```
98+
# sed -i 's/^\([^#]\)/#\1/g' /etc/cron.d/postgres-backup
99+
```
100+
101+
Switch to the moodle config folder:
102+
103+
```
104+
# cd /etc/moodle-docker
105+
```
106+
107+
Enable the site maintenance page:
108+
109+
```
110+
# docker-compose exec nginx-php-moodle /usr/bin/php /opt/moodle/app/admin/cli/maintenance.php --enable
111+
```
112+
113+
Drop and re-create the database:
114+
115+
```
116+
# docker-compose run postgres-backup /bin/drop_and_create
117+
```
118+
119+
Restore the DB by running the script and answering the interactive prompts regarding which backup to restore:
120+
121+
```
122+
# docker-compose run postgres-backup /bin/restore_db_from_delta
123+
```
124+
125+
Disable the site maintenance page:
126+
127+
```
128+
# docker-compose exec nginx-php-moodle /usr/bin/php /opt/moodle/app/admin/cli/maintenance.php --disable
129+
```
130+
Unpause the backup:
131+
132+
```
133+
# sed -i 's/^#//g' /etc/cron.d/postgres-backup
134+
```

0 commit comments

Comments
 (0)