Danger!!
This may well break your installation, but it may get you out of a hole.
Use these instructions with great care.
If you can’t get the discourse container to run with ./launcher rebuild app
for any reason and need to access the database to resolve the problem, do try these instructions.
The technique uses a Docker image of Postgres to access the volume of your installed Discourse. Do not run this while Discourse is running!
This assumes that discourse is installed in /var/discourse, and that you know how to operate Postgres via the command line.
Change ‘mysecretpassword’ to a more secure value.
# Pull the correct image for your version of Discourse.
docker pull postgres:15
# Start the container and direct it to the local database files.
docker run --name postgres_container -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 -v /var/discourse/shared/standalone/postgres_data:/var/lib/postgresql/data postgres:15
# Enter the container
docker exec -it postgres_container /bin/bash
# Once in the container:
su postgres
# run the db client
psql
# Trash the database as you see fit.
# When finished:
docker stop postgres_container
docker rm postgres_container
docker rmi postgres:15
You may need to restart docker before attempting to restart discourse.
service restart docker.