Skip to content

Commit

Permalink
doc: simplified steps for upgrading to Fedora N+2
Browse files Browse the repository at this point in the history
  • Loading branch information
praiskup committed Dec 6, 2023
1 parent 94f00da commit cf10ec3
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 407 deletions.
52 changes: 42 additions & 10 deletions doc/database_backup.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,50 @@
.. _database_backup:

Database backup
===============
Database backups
================

We periodically create a databse dump and offer users to download
it. At the same time, it can be used as a database backup if something
wrong happens. Please see ``/etc/cron.d/cron-backup-database-coprdb``.
We periodically create two kinds of database dumps.

To backup the database manually (this can be useful e.g. before
upgrading to a new major version of PostgreSQL), run::
Private/backup dump
-------------------

This "complete" dump is done for potential disaster-recovery situations. It
contains all the data (including private stuff like API tokens), and therefore
we **never publish it or download it onto our machines**. The dump is created in
the ``/backups/`` directory on Copr Frontend, and it is periodically pulled by
a rdiff-backup Fedora Infrastructure bot `configured by Ansible
<https://pagure.io/fedora-infra/ansible/blob/main/f/playbooks/rdiff-backup.yml>`_.

To generate the backup manually (this can be useful e.g. before upgrading to a
new major version of PostgreSQL), run::

[root@copr-fe ~][PROD]# su - postgres
bash-5.0$ /usr/local/bin/backup-database coprdb

Please be aware that the script does ``sleep`` for some
undeterministic amount of time. You might want to kill the ``sleep``
process to speed it up a little.
.. warning::

Please be aware that the script does an initial ``sleep`` for some
undeterministic amount of time (to not backup all the Fedora Infra databases
at the same time). You might want to kill the ``sleep`` process to speed it
up a little. Still, be prepared that the dump, mostly because of the XZ
compression, takes more than 20 minutes!

.. warning::

If you run this manually to have the :ref:`last-minute pre-upgrade dump
<how_to_upgrade_persistent_instances>`, you need to **keep the machine
running** till the upgrade is done — to keep the ``/backups`` directory
existing!

Public dumps
------------

These dumps are `publicly available
<https://copr.fedorainfracloud.org/db_dumps/>`_ for anyone's experiments.
These are generated overnight via::

/etc/cron.d/cron-backup-database-coprdb

Those dumps have all the private data filtered out (namely the contents of
``_private`` tables), but still usable as-is for debugging purposes (e.g.
spawning a dtesting Copr Frontend container with pre-generated database).
Loading

0 comments on commit cf10ec3

Please sign in to comment.