Document paste deletion from the Lodgeit database

This is a straightforward administrative task, albeit not one we're
asked to perform often.

Change-Id: I582f70c76c2de1afd7a7c7f6319f3f0202fb7494
This commit is contained in:
Jeremy Stanley
2025-10-01 18:44:21 +00:00
parent 31e9e8bd6c
commit aafa1c85d2

View File

@@ -33,3 +33,39 @@ anti-spam features required by OpenStack.
Ansible configures lodgeit to use mariadb database backend, apache
as a front-end proxy.
Manual Administrative Tasks
===========================
Deleting a Paste
----------------
The quickest way to do this is database surgery. Lodgeit uses a
MariaDB container on the paste server, and only has a single table
in its database, so this is quite straightforward. Connect to the
database with an interactive client session like so::
sudo docker-compose -f /etc/lodgeit-compose/docker-compose.yaml exec \
mariadb bash -c '/usr/bin/mysql -uroot -p"$MYSQL_ROOT_PASSWORD" lodgeit'
These days we've configured Lodgeit to use so-called "private"
identifiers by default, so that's what you'll likely be keying from.
For the sake of example let's pretend the URL is
``https://paste.opendev.org/show/thisIsSomeMadeUpBlob/``. First
check the row you're about to delete::
SELECT code FROM pastes WHERE private_id='thisIsSomeMadeUpBlob';
Note that if you instead have an old-style integer index identifier,
you'll need to use ``paste_id`` with that instead of ``private_id``.
You should see the ``code`` field content from one row matching the
content of the page you're preparing to delete. If it looks correct,
proceed with the deletion::
DELETE FROM pastes WHERE private_id='thisIsSomeMadeUpBlob';
That command should return a response like ``1 row in set (0.001
sec)`` if it was successful. Try to load the paste in your browser
again and hopefully it now says ``PageNot Found`` instead of
returning the prior content. If all's as intended, ``^D`` out of the
interactive shell and you're done!