User:Derat/MusicBrainzServerDevelopmentNotes
Here are some personal notes about trying to do MusicBrainz server development in June 2023.
Getting the code and setting up my local environment
I cloned the musicbrainz-server and musicbrainz-docker repositories.
Next, I followed the instructions in the "Local development of MusicBrainz Server" section of musicbrainz-docker's README.md. I encountered a DateTime::Locale version error the first time I ran the createdb.sh
command, but it worked when I ran it again.
I stepped away from the code for a few weeks at this point. When I came back, I synced both repositories and ran the following command to recreate the database:
sudo docker-compose run --rm musicbrainz recreatedb.sh -sample -fetch
I ran the following to start the containers (without detaching from the terminal, so I could watch the logs):
sudo docker-compose up
At this point, I was able to access my local server at http://localhost:5000/.
The server doesn't seem to have search indexes by default (I think there are more steps for getting that working), so I had to look up an MBID on the real MB site: http://localhost:5000/release/15f5c2cb-41ea-3630-a0f6-2f86785cf608
I edited root/release/add_cover_art.tt
in the musicbrainz-server
repo and verified that my changes showed up at http://localhost:5000/release/15f5c2cb-41ea-3630-a0f6-2f86785cf608/add-cover-art.
Creating an account
I added a user account via the web interface but my server wasn't able to send email messages, so I wasn't able to verify my email address (needed to perform edits).
I ran the following to connect to PostgreSQL:
sudo docker-compose run musicbrainz psql postgres -U musicbrainz -h db
Next, I ran the following to manually mark my account as being verified:
\l -- list databases \c musicbrainz_db -- change DB \dt -- list tables UPDATE EDITOR SET email = 'user@example.org', email_confirm_date = now() WHERE name = 'my_username';
At this point, the server viewed my account as having been verified.
Running tests
I didn't have any luck running Selenium tests against my local installation when following the instructions from the "Selenium" section of musicbrainz-server's HACKING.md. The setup commands seemed to complete successfully:
sudo docker-compose run --rm musicbrainz ./script/create_test_db.sh SELENIUM sudo docker-compose run --rm musicbrainz ./script/compile_resources.sh
Running ./t/selenium.js --help
outside of Docker just produced an error, though:
node:fs:1396 handleErrorFromBinding(ctx); ^ Error: ENOENT: no such file or directory, mkdir '/musicbrainz-server/.nyc_output' at Object.mkdirSync (node:fs:1396:3) at file:///home/.../temp/src/musicbrainz-server/root/utility/writeCoverage.mjs:18:6 at ModuleJob.run (node:internal/modules/esm/module_job:194:25) { errno: -2, syscall: 'mkdir', code: 'ENOENT', path: '/musicbrainz-server/.nyc_output' } Node.js v18.16.1
I couldn't figure out where MB_SERVER_ROOT
was getting set incorrectly, and I didn't expect the test script to work within Docker (since I assume it'd have no way to access Chrome), so I just relied on Jenkins to run my tests after I uploaded a PR.