contentdb
contentdb copied to clipboard
Unable to get a "fresh" database though docker image, or to delete current db
Summary
I wanted to make a quick and easy change to the "test databse" - but couldn't because it was a postgresql database. All attempts to delete the db failed.
Steps to reproduce
- Install docker (
sudo dnf docker-ce docker-composeafter enabling the official COPR from the official docker website on Fedora 39) - set
secret_keyandwtf... yada yada key to gibberish values likeasdfasdfasfd - set
USER_ENABLE_EMAILtoFalse(an attempt to fix the SMTPS errors- still get them with or without it) - created config.env verbatim as in the
getting_started.md docker-compose up --build./utils/run_migrations.sh./utils/bash.sh- (from inside docker)
python utils/setup.py -t - At this point I had realized that I needed to ensure that at least one of the mods had multiple releases
- Log into the local webservice using the creds in the
getting_started.md - Attempt and fail to
- Add a new release to an existing package
- Using Git (failed because package didn't match, then next
PermissionError: [Errno 13] Permission denied: '/var/cdb/uploads/45b0153bb2.zip') - Using zip (same permission error)
- Using Git (failed because package didn't match, then next
- Add a new package (same permission error)
- Using git (same permission error)
- Using zip (same permission error)
- Add a new release to an existing package
- (from inside docker)
python utils/setup.py -d- an attempt to delete the database, after looking at the code for that file.
The database remained, even after (attempting) to delete it. I couldn't figure out how to delete the database using docker.
The sheer number of error messages I saw the whole time are so vast, I can't post all of them - partially due to the terminal trimming them out. I can attempt to recreate them upon request.
The truncated error message when I do anything with utils/setup.py:
sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) dup
licate key value violates unique constraint "license_name_key"
DETAIL: Key (name)=(GPLv2.1) already exists.
~~Workaround: sudo git clean -fd (this is the nuclear option - never use this command unless you know what it does)~~
FAILED - during test package creation, sql "duplicate key" errors were my only reply due to the database not being empty
Also:
psqlisn't present in the docker image, so I couldn't manually delete the database- When the service is running, on the host
ps -s | grep postgreturns a few items, but when it isn't, nothing.
Workaround: (DANGEROUS) use sudo to recursively remove the contents of the data folder
EDIT: this might not be working either - but I'm emotionally exhausted from this project for today.
proposed solution: document this somewhere for the next guy?
The way I delete the db is by shutting the container down, doing sudo rm -rf data/db, and then restarting the container. The -d arg is left over from when I used sqlite
As for uploads, you need to do sudo chown $(whoami):5123 -R data/uploads
https://github.com/minetest/contentdb/commit/b919cd087a12c01d007ac91b8a8839f3a71237d3
https://github.com/minetest/contentdb/commit/2711dbd23fd26dd93f47cf85ca3c1c974530aeb9
As for uploads, you need to do sudo chown $(whoami):5123 -R data/uploads
You may also need to do chmod g+w data/uploads, I haven't checked. Should be documented if so