|
1 | 1 | .. _database_backup:
|
2 | 2 |
|
3 |
| -Database backup |
4 |
| -=============== |
| 3 | +Database backups |
| 4 | +================ |
5 | 5 |
|
6 |
| -We periodically create a databse dump and offer users to download |
7 |
| -it. At the same time, it can be used as a database backup if something |
8 |
| -wrong happens. Please see ``/etc/cron.d/cron-backup-database-coprdb``. |
| 6 | +We periodically create two kinds of database dumps. |
9 | 7 |
|
10 |
| -To backup the database manually (this can be useful e.g. before |
11 |
| -upgrading to a new major version of PostgreSQL), run:: |
| 8 | +Private/backup dump |
| 9 | +------------------- |
| 10 | + |
| 11 | +This "complete" dump is done for potential disaster-recovery situations. It |
| 12 | +contains all the data (including private stuff like API tokens), and therefore |
| 13 | +we **never publish it or download it onto our machines**. The dump is created in |
| 14 | +the ``/backups/`` directory on Copr Frontend, and it is periodically pulled by |
| 15 | +a rdiff-backup Fedora Infrastructure bot `configured by Ansible |
| 16 | +<https://pagure.io/fedora-infra/ansible/blob/main/f/playbooks/rdiff-backup.yml>`_. |
| 17 | + |
| 18 | +To generate the backup manually (this can be useful e.g. before upgrading to a |
| 19 | +new major version of PostgreSQL), run:: |
12 | 20 |
|
13 | 21 | [root@copr-fe ~][PROD]# su - postgres
|
14 | 22 | bash-5.0$ /usr/local/bin/backup-database coprdb
|
15 | 23 |
|
16 |
| -Please be aware that the script does ``sleep`` for some |
17 |
| -undeterministic amount of time. You might want to kill the ``sleep`` |
18 |
| -process to speed it up a little. |
| 24 | +.. warning:: |
| 25 | + |
| 26 | + Please be aware that the script does an initial ``sleep`` for some |
| 27 | + undeterministic amount of time (to not backup all the Fedora Infra databases |
| 28 | + at the same time). You might want to kill the ``sleep`` process to speed it |
| 29 | + up a little. Still, be prepared that the dump, mostly because of the XZ |
| 30 | + compression, takes more than 20 minutes! |
| 31 | + |
| 32 | +.. warning:: |
| 33 | + |
| 34 | + If you run this manually to have the :ref:`last-minute pre-upgrade dump |
| 35 | + <how_to_upgrade_persistent_instances>`, you need to **keep the machine |
| 36 | + running** till the upgrade is done — to keep the ``/backups`` directory |
| 37 | + existing! |
| 38 | + |
| 39 | +Public dumps |
| 40 | +------------ |
| 41 | + |
| 42 | +These dumps are `publicly available |
| 43 | +<https://copr.fedorainfracloud.org/db_dumps/>`_ for anyone's experiments. |
| 44 | +These are generated overnight via:: |
| 45 | + |
| 46 | + /etc/cron.d/cron-backup-database-coprdb |
| 47 | + |
| 48 | +Those dumps have all the private data filtered out (namely the contents of |
| 49 | +``_private`` tables), but still usable as-is for debugging purposes (e.g. |
| 50 | +spawning a dtesting Copr Frontend container with pre-generated database). |
0 commit comments