From aafa1c85d28031790261b21c2d8b369e84c267bd Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 1 Oct 2025 18:44:21 +0000 Subject: [PATCH] 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 --- doc/source/paste.rst | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/doc/source/paste.rst b/doc/source/paste.rst index 163ca9861a..440fae5119 100644 --- a/doc/source/paste.rst +++ b/doc/source/paste.rst @@ -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!