### Enable Yarn using Corepack Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Installs Yarn, a JavaScript package manager, using the corepack command. This example installs Yarn to /usr/local/bin. ```bash sudo corepack enable ``` -------------------------------- ### Start artwork-redirect Server Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING-IMG.md Starts the artwork-redirect server. Ensure your virtual environment is active. ```bash (.venv) $ python artwork_redirect_server.py ``` -------------------------------- ### Install Git Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Installs the Git version control system using apt-get. ```bash sudo apt-get install git ``` -------------------------------- ### Install Valkey Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Installs Valkey, a required in-memory data structure store used for sessions and caching. ```bash sudo apt-get install valkey ``` -------------------------------- ### Configure artwork-indexer Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING-IMG.md Example configuration for artwork-indexer's config.ini file. Ensure URLs and credentials match your local setup. ```ini [musicbrainz] # Set to the host:port plackup is listening on. url=http://localhost:5000 database=READWRITE [database] host=localhost port=5432 user=musicbrainz dbname=musicbrainz_db [s3] # Set to the host:port ssssss.psgi is listening on. url=http://localhost:5050/{bucket}?file={file} caa_access=caa_user caa_secret=caa_pass eaa_access=eaa_user eaa_secret=eaa_pass [sentry] dsn= ``` -------------------------------- ### Install sir Extensions and Functions Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Manually install SQL extensions and functions for the sir service into the musicbrainz_selenium database. ```sh psql -U postgres -d musicbrainz_selenium -f sql/CreateExtension.sql psql -U musicbrainz -d musicbrainz_selenium -f sql/CreateFunctions.sql ``` -------------------------------- ### Start artwork-indexer Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING-IMG.md Starts the artwork-indexer using poetry. Ensure your Python environment is set up correctly. ```bash $ poetry run python indexer.py ``` -------------------------------- ### Install Gettext for Translations Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Install the gettext package, which provides necessary tools like msgmerge and msgfmt for compiling and installing translations. This is a prerequisite for managing translations. ```bash sudo apt-get install gettext ``` -------------------------------- ### Start Development Server Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Run the lightweight development server for MusicBrainz Server. This command provides good debug output and is convenient for development. ```bash plackup -Ilib -r ``` -------------------------------- ### Install bzip2 package Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Installs the bzip2 compression utility, which is required for extracting database dump archives. ```bash apt-get install bzip2 ``` -------------------------------- ### Install pgtap for Database Testing Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Install the pgtap testing framework on Ubuntu. This is required for running database function unit tests. ```bash $ sudo apt-get install pgtap ``` -------------------------------- ### Install PostgreSQL and Development Libraries Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Installs PostgreSQL version 18 and its associated development libraries using apt-get. ```bash POSTGRES_VERSION=18 \ sudo apt-get install \ postgresql-${POSTGRES_VERSION} \ postgresql-contrib-${POSTGRES_VERSION} \ postgresql-server-dev-${POSTGRES_VERSION} ``` -------------------------------- ### Install Build Tools Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Installs essential build tools like a C compiler and make, required for compiling certain dependencies. ```bash sudo apt-get install build-essential ``` -------------------------------- ### Install Node Modules Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Installs all the necessary Node.js dependencies for jQuery UI development. This command reads the package.json file to determine which modules to install. ```bash npm install ``` -------------------------------- ### Configure artwork-redirect Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING-IMG.md Example configuration for artwork-redirect's config.ini file. Set the download_prefix to your local ssssss.psgi instance. ```ini [database] host=localhost port=5432 user=musicbrainz database=musicbrainz_db [listen] address=localhost port=8080 [ia] # Set to the host:port ssssss.psgi is listening on. Image/index requests # will be redirect here. download_prefix=http://localhost:5050 [sentry] dsn= ``` -------------------------------- ### Enable Yarn with Custom Install Directory Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Installs Yarn using corepack to a specified directory, avoiding the need for sudo. ```bash corepack enable --install-directory=~/bin ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Install necessary development headers and Perl modules required for building the server. This command requires root privileges. ```bash sudo apt-get install \ libdb-dev \ libexpat1-dev \ libicu-dev \ liblocal-lib-perl \ libpq-dev \ libxml2 \ libxml2-dev \ cpanminus \ pkg-config ``` -------------------------------- ### Install Script Dependencies Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Installs the 'file' command and the 'moreutils' package, which provides the 'ts' command needed for one-off scripts. ```bash sudo apt-get install file moreutils ``` -------------------------------- ### Create a clean MusicBrainz database Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Initializes a new, clean database schema for MusicBrainz Server. Use this for a fresh setup. ```bash ./admin/InitDb.pl --createdb --clean ``` -------------------------------- ### Install Grunt Globally Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Installs the Grunt build system globally on your machine. This is a prerequisite for building jQuery UI. ```bash npm install grunt -g ``` -------------------------------- ### Install Translations Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Compile and install translation files. This command processes the .po files and creates .mo files in the appropriate locale directories. ```bash make install ``` -------------------------------- ### Install Graphviz and Scour Source: https://github.com/metabrainz/musicbrainz-server/blob/master/docs/database_schema_diagrams/README.md Installs the necessary 'dot' and 'scour' programs required for generating database schema diagrams. ```bash apt-get install graphviz scour ``` -------------------------------- ### Start Slow Down Emulation Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING-IMG.md Starts a Plack script to simulate a 503 Slow Down error by using slowdown.psgi instead of ssssss.psgi. ```bash $ plackup --port 5050 contrib/slowdown.psgi ``` -------------------------------- ### Start Emulated S3 Storage Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING-IMG.md Starts a Plack script that emulates the Internet Archive S3 protocol for local image storage. Set the SSSSSS_STORAGE environment variable to your desired directory. ```bash $ SSSSSS_STORAGE=./ssssss plackup --port 5050 -r contrib/ssssss.psgi ``` -------------------------------- ### Run mb-mail-service with Mailpit Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Starts the mb-mail-service, configuring it to use Mailpit on port 1025. ```sh APP_SMTP_PORT=1025 ./target/release/mb-mail-service ``` -------------------------------- ### Install System Locale for Languages Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Ensure that system locales are available for the languages you intend to use. This command installs language packs for many common languages. ```bash sudo apt-get install language-pack-{language code} ``` -------------------------------- ### Check Perl Version Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Verify the installed version of Perl on your system. ```bash perl -v ``` -------------------------------- ### Install Perl Dependencies with cpanm Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Install all required Perl dependencies for MusicBrainz Server using cpanminus. Ensure you are in the MusicBrainz source code directory. The dot at the end is significant. ```bash cpanm --installdeps --notest . ``` -------------------------------- ### Clone artwork-redirect Repository Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING-IMG.md Clones the artwork-redirect repository from GitHub. Follow the manual installation instructions in its README. ```bash $ git clone https://github.com/metabrainz/artwork-redirect.git ``` -------------------------------- ### Immutable State Update Example Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Demonstrates how to create a mutable copy of state before making modifications to ensure immutability. Useful for managing deeply nested state. ```javascript const newState = {...state}; // ... and while handling some action: newState.someList = [...newState.someList, newItem]; ``` -------------------------------- ### Navigate to PO Directory Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Change the current directory to the 'po' folder, which contains translation files. This is a necessary step before installing translations. ```bash cd po/ ``` -------------------------------- ### Clone artwork-indexer Repository Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING-IMG.md Clones the artwork-indexer repository from GitHub. Follow the installation instructions in its README. ```bash $ git clone https://github.com/metabrainz/artwork-indexer.git ``` -------------------------------- ### Enable local::lib Environment Variables Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Append local::lib configuration to your .bashrc file to set necessary environment variables for Perl module installation. Reload your shell configuration afterwards. ```bash echo 'eval $( perl -Mlocal::lib )' >> ~/.bashrc source ~/.bashrc ``` -------------------------------- ### Verify downloaded database dump integrity Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Checks the integrity of downloaded database dump files using MD5 checksums. Ensure bzip2 is installed first. ```bash pushd /tmp/dumps/ && md5sum -c MD5SUMS && popd ``` -------------------------------- ### Example Pull Request Comment Referencing a Ticket Source: https://github.com/metabrainz/musicbrainz-server/blob/master/CONTRIBUTING.md Include a summary in the pull request comment that references the associated ticket using the format '# Summary\n\nFix MBS-1234567: [Description]'. This provides a clear link between the code change and the issue. ```markdown # Summary Fix MBS-1234567: Change things relevant to users ``` -------------------------------- ### Example Pull Request Title for Multiple Ticket References Source: https://github.com/metabrainz/musicbrainz-server/blob/master/CONTRIBUTING.md When a pull request relates to multiple tickets, separate their keys with commas in the title (e.g., MBS-1234567, MBS-2345678). This ensures all relevant issues are linked. ```text MBS-1234567, MBS-2345678: Change two related things at once ``` -------------------------------- ### Example Pull Request Title for Ticket Resolution Source: https://github.com/metabrainz/musicbrainz-server/blob/master/CONTRIBUTING.md Prefix your pull request title with the ticket key (e.g., MBS-1234567) when your change resolves a ticket. This helps in linking the pull request to the corresponding issue. ```text MBS-1234567: Change things relevant to users ``` -------------------------------- ### Example Pull Request Title for Partial Ticket Resolution Source: https://github.com/metabrainz/musicbrainz-server/blob/master/CONTRIBUTING.md Use parentheses in the pull request title to indicate a partial resolution of a ticket (e.g., MBS-1234567 (I)). This signifies that the change addresses only a portion of the ticket's requirements. ```text MBS-1234567 (I): Make first part of needed changes ``` -------------------------------- ### Copy Server Configuration Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Copy the sample server configuration file to be used by the server. ```bash cp lib/DBDefs.pm.sample lib/DBDefs.pm ``` -------------------------------- ### Build Static Web Resources (Production) Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Compile static web resources, excluding development dependencies, for a production environment. This can save time and disk space. ```bash NODE_ENV=production ./script/compile_resources.sh ``` -------------------------------- ### Build Static Web Resources Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Compile all necessary static web resources (CSS, JavaScript) for the server to be accessible in a web browser. ```bash ./script/compile_resources.sh ``` -------------------------------- ### Configure Database for pgtap Tests Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Set up environment variables for database connection using the provided script. This allows pgtap to connect to the test database. ```bash eval `perl -Ilib script/database_configuration TEST` ``` -------------------------------- ### Create Database for Schema Change Test Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Create an empty database for testing schema changes. Ensure proper roles and privileges are granted. ```sh # You may require custom host/port connection parameters to your local DB. psql -U postgres -d template1 -c 'CREATE DATABASE musicbrainz_prod_schema;' # It's okay if these already exist. psql -U postgres -d template1 -c 'CREATE ROLE musicbrainz;' psql -U postgres -d template1 -c 'CREATE ROLE musicbrainz_ro;' psql -U postgres -d template1 -c 'CREATE ROLE caa_redirect;' psql -U postgres -d template1 -c 'CREATE ROLE sir;' psql -U postgres -d template1 -c 'GRANT CREATE ON DATABASE musicbrainz_prod_schema TO musicbrainz;' ``` -------------------------------- ### Import database dump Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Imports MusicBrainz database dumps into the PostgreSQL server. The `--echo` flag provides feedback during the process. ```bash ./admin/InitDb.pl --createdb --import /tmp/dumps/mbdump*.tar.bz2 --echo ``` -------------------------------- ### Update Docker Images for Beta Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md Build Docker images for the beta environment. Specify 'beta' for the IMAGE_BRANCH_ parameter. ```bash ./script/update_containers.sh beta ``` -------------------------------- ### Configure SELENIUM Database Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Add SELENIUM database configuration to DBDefs.pm. Ensure connection options match your TEST database. ```perl SELENIUM => { database => 'musicbrainz_selenium', schema => 'musicbrainz', username => 'musicbrainz', host => 'localhost', port => 5432, } ``` -------------------------------- ### Allow all local connections with trust Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md A simpler alternative for development servers that allows all local connections without requiring authentication. Insert before other permissions. ```sql local all all trust ``` -------------------------------- ### Run Selenium Tests Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Execute Selenium UI tests from the command line. Specify SIR_DIR if search is required. ```sh $ SIR_DIR=~/code/sir ./t/selenium.js ``` -------------------------------- ### Configure PostgreSQL pg_ident.conf Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Add this line to pg_ident.conf to map database users to system users. ```sql mb_map www-user musicbrainz ``` -------------------------------- ### Clone MusicBrainz Server Repository Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Clone the MusicBrainz Server repository and its submodules. Navigate into the cloned directory. ```bash git clone --recursive git://github.com/metabrainz/musicbrainz-server.git cd musicbrainz-server ``` -------------------------------- ### Run Individual pgtap Database Test Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Execute a single pgtap test file. Use the 'prove' command with verbose output and specify the SQL file. ```bash $ prove --verbose --source pgTAP t/pgtap/unaccent.sql ``` -------------------------------- ### Configure Migration Test Databases Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Defines two new database configurations in DBDefs.pm for testing schema migrations. Adjust host/port as needed. ```perl MIGRATION_TEST1 => { database => 'musicbrainz_test_migration_1', host => 'localhost', password => '', port => 5432, username => 'musicbrainz', }, MIGRATION_TEST2 => { database => 'musicbrainz_test_migration_2', host => 'localhost', password => '', port => 5432, username => 'musicbrainz', }, ``` -------------------------------- ### Configure PostgreSQL pg_hba.conf Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Add this line to pg_hba.conf for specific database user access. The order of columns is important. ```sql local musicbrainz_db musicbrainz ident map=mb_map ``` -------------------------------- ### Run All Reports Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Execute the RunReports.pl script to generate all available reports. Ensure you are in the project's root directory. ```bash $ ./admin/RunReports.pl ``` -------------------------------- ### Build materialized tables Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Initializes the materialized tables for MusicBrainz Server, which are recommended for performance optimization. These tables are automatically updated via triggers after initial creation. ```bash ./admin/BuildMaterializedTables --database=MAINTENANCE all ``` -------------------------------- ### Merge Beta to Production Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md Merge the 'beta' branch into 'production' and push. This command includes logging of the last 876423 commits and uses no-fast-forward merge strategy. ```bash git merge --log=876423 --no-ff beta ``` -------------------------------- ### Configure MusicBrainz Server for Local Archives Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING-IMG.md Perl code snippets for configuring MusicBrainz Server to use local instances of the Internet Archive, Cover Art Archive, and Event Art Archive. Update these values in lib/DBDefs.pm. ```perl # Set to the host:port ssssss.psgi is listening on. sub INTERNET_ARCHIVE_UPLOAD_PREFIXER { shift; sprintf("//localhost:5050/%s", shift) } # Set to the host:port artwork-redirect is listening on. sub COVER_ART_ARCHIVE_DOWNLOAD_PREFIX { "http://localhost:8080" } sub EVENT_ART_ARCHIVE_DOWNLOAD_PREFIX { "http://localhost:8080" } sub INTERNET_ARCHIVE_IA_DOWNLOAD_PREFIX { '' } # Set to the host:port ssssss.psgi is listening on. sub INTERNET_ARCHIVE_IA_METADATA_PREFIX { 'http://localhost:5050/metadata' } # Must match the configured values for `caa_access`, `caa_secret`, # `eaa_access`, and `eaa_secret` under the `[s3]` section of your # artwork-indexer config.ini. sub COVER_ART_ARCHIVE_ACCESS_KEY { 'caa_user' } sub COVER_ART_ARCHIVE_SECRET_KEY { 'caa_pass' } sub EVENT_ART_ARCHIVE_ACCESS_KEY { 'eaa_user' } sub EVENT_ART_ARCHIVE_SECRET_KEY { 'eaa_pass' } ``` -------------------------------- ### Update Docker Images for Test Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md Build Docker images for the test environment. Specify 'test' for the IMAGE_BRANCH_ parameter. ```bash ./script/update_containers.sh test ``` -------------------------------- ### Run Schema Migration Check Script Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Executes the CheckSchemaMigration.sh script to compare schemas between a new and an upgraded database. Ensure no local changes under admin/ before running. ```bash $ PGPORT=25432 REPLICATION_TYPE=3 ./t/script/CheckSchemaMigration.sh ``` -------------------------------- ### Generate cpanfile.snapshot Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING-PROD.md Run this script to generate a new cpanfile.snapshot after modifying the cpanfile, especially when adding new packages. This process can take a significant amount of time. ```bash #!/bin/bash ./docker/generate_cpanfile_snapshot.sh ``` -------------------------------- ### Navigate to jQuery UI Directory Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Changes the current directory to the cloned jQuery UI project folder. This is necessary to run subsequent build commands. ```bash cd jquery-ui ``` -------------------------------- ### Running ESLint for Code Quality Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Enforce code style and identify potential issues by running ESLint. Use the provided script to check against project-specific rules. ```shell ./node_modules/.bin/eslint path/to/file.js ``` ```shell ./script/check_unfixed_eslint_rules path/to/file.js ``` -------------------------------- ### Run JavaScript Code Standards Check Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Uses eslint to check JavaScript files or directories against defined rules. Replace $file_or_directory with the actual path. ```bash $ ./node_modules/.bin/eslint $file_or_directory ``` -------------------------------- ### Tag Production Release Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md Use this script to tag production releases. It will prompt for necessary information. ```bash ./script/tag.sh ``` -------------------------------- ### Restart PostgreSQL Service (Ubuntu) Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Command to restart the PostgreSQL service on Ubuntu systems to apply configuration changes. ```bash sudo /etc/init.d/postgresql restart ``` -------------------------------- ### Verify GPG signature of database dumps Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Verifies the GPG signature of downloaded MusicBrainz database dump files using the official GPG key. ```bash gpg --recv-keys C777580F gpg --verify-files /tmp/dumps/*.asc ``` -------------------------------- ### Generate SVG Images Source: https://github.com/metabrainz/musicbrainz-server/blob/master/docs/database_schema_diagrams/README.md Executes the make command to generate SVG images from the database schema definitions. ```bash make ``` -------------------------------- ### List Code Contributors Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md Use this script to list code contributors for release notes. ```bash ./script/list_code_contributors ``` -------------------------------- ### List Translators Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md Use this script to list translators for release notes. ```bash ./po/list_translators ``` -------------------------------- ### Generate New .pot Files Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md Generate new .pot files from the database and templates on the master or beta branch. This script is used to update translation source messages. ```bash ./po/update_pot.sh ``` -------------------------------- ### Dump MusicBrainz Production Schema Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Dumps the schema of the MusicBrainz production database. Ensure the production standby host and container name are set correctly. ```bash prod_standby_pg_host= prod_standby_pg_container= ssh -C $prod_standby_pg_host docker exec $prod_standby_pg_container sudo -E -H -u postgres \ pg_dump --schema-only musicbrainz_db \ > musicbrainz_prod_schema.dump psql -U postgres -d musicbrainz_prod_schema -f musicbrainz_prod_schema.dump SKIP_EXPORT=1 REPLICATION_TYPE=1 DATABASE=PROD_SCHEMA_CHANGE_TEST ./upgrade.sh ``` -------------------------------- ### Rebuild Database Indexes Using Collations Source: https://github.com/metabrainz/musicbrainz-server/blob/master/MAINTENANCE.md Use this script to rebuild all database indexes that use the 'default' or 'musicbrainz' collations. By default, it runs concurrently to minimize disruption. ```bash ./admin/RebuildIndexesUsingCollations.pl ``` -------------------------------- ### Run JavaScript Tests in Headless Chrome Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Execute JavaScript unit tests using Node.js, provided a headless Chrome instance is available. This command runs the web.js test runner. ```bash $ node t/web.js ``` -------------------------------- ### Run Specific Selenium Tests Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Execute specific Selenium tests by providing their paths as arguments. Use flags for debugging. ```sh t/selenium.js -h=false -s=true ``` -------------------------------- ### Clone jQuery UI Repository Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Clones the official jQuery UI Git repository to your local machine. This is the first step in setting up the project for development. ```bash git clone git://github.com/jquery/jquery-ui.git ``` -------------------------------- ### Run All pgtap Database Tests Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Execute all pgtap tests, including those in subdirectories. This command runs tests from the main pgTAP directory and unused-tags directory. ```bash $ prove --verbose --source pgTAP t/pgtap/* t/pgtap/unused-tags/* ``` -------------------------------- ### Execute JavaScript Module with Webpack Imports Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Use the ./webpack/exec utility to run any JavaScript script, including those with CommonJS or ESM syntax and magic Webpack imports. This tool compiles the script to a temporary file for execution. ```sh $ cat < test.js const commaOnlyList = require('./root/static/scripts/common/i18n/commaOnlyList.js').default; console.log(commaOnlyList([1, 2, 3])); EOF $ ./webpack/exec test.js ``` -------------------------------- ### Compile Resources for Modern Browsers Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Specify the BROWSER_TARGET environment variable to compile static resources targeting only modern browsers, improving the debugging experience by reducing Babel helper code. ```sh env BROWSER_TARGET=modern ./script/compile_resources.sh ``` -------------------------------- ### List All Grunt Tasks Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Displays a list of all available Grunt tasks for the jQuery UI project. This is useful for exploring different build and development options. ```bash grunt --help ``` -------------------------------- ### Configure Mail Service Base URL Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Sets the base URL for the mb-mail-service. This service handles email sending and should be pointed to Mailpit. ```Perl sub MAIL_SERVICE_BASE_URL { 'http://localhost:3000' } ``` -------------------------------- ### Update Translations Branch and Merge Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md Fetches the latest translations, checks out the beta branch, merges translations, and pushes the changes. Ensure GitHub Actions are successful after this merge. ```bash git fetch origin && \ git checkout origin/translations -B translations && \ git checkout beta && \ git merge --log=876423 --no-ff translations && \ git push ``` -------------------------------- ### Build jQuery UI Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Executes the default build task for jQuery UI using Grunt. This compiles the project assets. ```bash grunt build ``` -------------------------------- ### Compile JavaScript Tests Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Compile JavaScript tests before running them in a browser. This script prepares the test files for execution. ```bash $ script/compile_resources.sh tests ``` -------------------------------- ### Run Flow Type Checker Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Execute the Flow command to check all types in the JavaScript codebase. This should be run after making changes to ensure type consistency. ```bash $ ./node_modules/.bin/flow ``` -------------------------------- ### Run Perl Code Standards Check Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Invokes prove to check Perl code against defined standards using Perl::Critic. Ensure you are on the correct branch before running. ```bash $ prove -lv t/critic.t ``` -------------------------------- ### Run Specific Report Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Generate a specific report by providing its name as an argument to the RunReports.pl script. Refer to the documentation for available report names. ```bash $ ./admin/RunReports.pl DuplicateArtists ``` -------------------------------- ### Loading React Component in Catalyst Controller Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Add this to your Catalyst controller's action method to load a React component for a page. Specify the component path and any necessary props. ```perl $c->stash( current_view => 'Node', component_path => 'relative/path/to/component/from/root', component_props => {prop_name => prop_value} ); ``` -------------------------------- ### Set Beta Website Banner Message Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md HTML snippet to set the banner message on the beta MusicBrainz website after synchronization with the main website. ```html Beta website is currently the same as the main website, nothing to be tested for now. ``` -------------------------------- ### Merge Production to Master Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md Merge the 'production' branch into 'master' and push. This command includes logging of the last 876423 commits and uses no-fast-forward merge strategy. ```bash git merge --log=876423 --no-ff production ``` -------------------------------- ### Customizing JSON Serialization for Entity Props Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Extend the TO_JSON subroutine in entity modules to customize JSON serialization for props. Use provided utility functions for common conversions. ```perl around TO_JSON => sub { my ($orig, $self) = @_; return { %{ $self->$orig }, prop_name => covert_to_json($self->prop_name) }; }; ``` -------------------------------- ### Normalize SVG Images Source: https://github.com/metabrainz/musicbrainz-server/blob/master/docs/database_schema_diagrams/README.md Runs the 'make normalized' command to clean up and normalize SVG images after manual edits, addressing potential formatting issues. ```bash make normalized ``` -------------------------------- ### Configure Mailpit SMTP and API Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Configures the SMTP server and Mailpit API endpoint. Mailpit is used for testing email functionality. ```Perl sub SMTP_SERVER { 'localhost:1025' } sub MAILPIT_API { 'http://localhost:8025/api/v1' } ``` -------------------------------- ### Cherry-pick Commit with No Commit Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Applies the changes from a specific commit to your working directory without creating a new commit. This allows for manual modification of the changes before committing. ```bash git cherry-pick -n [sha-of-commit] # make changes git commit --author="[author-name-and-email]" ``` -------------------------------- ### Configure HTML Validator URL Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Sets the URL for the HTML5 validator. It's recommended to use a local instance for faster testing. ```Perl sub HTML_VALIDATOR { 'http://localhost:8888?out=json' } ``` -------------------------------- ### Set Statement Timeout for Database Source: https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md Configure a statement timeout for the musicbrainz_db database to prevent excessively long SQL queries. This is an optional setting if statement timeouts are an issue. ```sql ALTER DATABASE musicbrainz_db SET statement_timeout TO 60000; ``` -------------------------------- ### Cherry-pick Commit with Edit Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Applies a specific commit and allows you to edit the commit message before finalizing. Useful for refining commit messages before landing. ```bash git cherry-pick -e [sha-of-commit] ``` -------------------------------- ### Fetch Remote Repository Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Fetches changes from a remote Git repository without merging them. This is typically used to update your local repository with the latest changes from a fork. ```bash git fetch [their-fork.git] [their-branch] ``` -------------------------------- ### Set Website Banner Message Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md HTML snippet to set the banner message on the MusicBrainz website during updates. ```html MusicBrainz servers are being updated, slowdowns may occur for a few minutes, thanks for your patience. ``` -------------------------------- ### Embedding React Component in TT Page Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Use this syntax to embed a React component within a TT template. Ensure the path is relative to the 'root' directory. ```perl [%~ React.embed(c, 'relative/path/to/component/from/root', { prop_name => prop_val }) ~%] ``` -------------------------------- ### Generate Flow Type from Edit Data Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Generate a Flow object type for edit data based on an edit type ID. This requires a configured PROD_STANDBY database. ```bash ./script/generate_edit_data_flow_type.mjs --edit-type $EDIT_TYPE_ID ``` -------------------------------- ### Encapsulating Child Actions in Parent Reducer Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Shows how to manage child component actions within a parent reducer by encapsulating them under a single parent action type. This simplifies dispatch creation and allows for centralized handling of child state updates. ```javascript import { type ActionT as ChildActionT, reducer as childReducer, } from './Child.js'; type ActionT = | {+type: 'update-child', +action: ChildActionT} // ... ; function reducer(state: StateT, action: ActionT): StateT { match (action) { /* * No need to list every child action here, since they're * encapsulated by `update-child`. */ {type: 'update-child', const action} => { const childAction = action; /* * You could even have another switch statement here on * childAction.type, in case you need to handle particular actions * in the parent reducer (because they affect state in the parent * that the child doesn't know about). */ state.child = childReducer(state.child, childAction); } } } function ParentComponent(props: PropsT) { const [state, dispatch] = React.useReducer( reducer, props, createInitialState, ); /* * Create the child's dispatch function. The child need not worry how * it was defined, just that it can pass its own actions to it. */ const childDispatch = React.useCallback((action: ChildActionT) => { /* * If you need to identify the child in some way (perhaps its index * in a list), you can add extra arguments to this function. The * child will of course have to adjust how it calls dispatch, e.g. * `dispatch(myIndex, action)`. */ dispatch({type: 'update-child', action}); }, [dispatch]); return ; } ``` -------------------------------- ### Enable Flow Strict Type Checking Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Add the '@flow strict-local' header to new JavaScript files to enable static type checking with Flow. This ensures type correctness. ```javascript // @flow strict-local ``` -------------------------------- ### Cherry-pick Commit Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Applies a specific commit from another branch to your current branch. This is used to integrate changes without a full merge. ```bash git cherry-pick [sha-of-commit] ``` -------------------------------- ### PostgreSQL Collation Version Mismatch Warning Source: https://github.com/metabrainz/musicbrainz-server/blob/master/MAINTENANCE.md This warning indicates a discrepancy between the database's collation version and the operating system's library version. It requires rebuilding indexes affected by the collation. ```sql WARNING: collation "XYZ" has version mismatch DETAIL: The collation in the database was created using version 1.2.3, but the operating system provides version 4.5.6. HINT: Rebuild all objects affected by this collation and run ALTER COLLATION "XYZ" REFRESH VERSION, or build PostgreSQL with the right library version. ``` -------------------------------- ### Merge Master into Beta Branch Source: https://github.com/metabrainz/musicbrainz-server/blob/master/RELEASING.md Merge the master branch into the beta branch for updates. This command logs the merge history and prevents fast-forward merges. ```bash git merge --log=876423 --no-ff master ``` -------------------------------- ### Cherry-pick to Stable Branch Source: https://github.com/metabrainz/musicbrainz-server/blob/master/root/static/lib/jquery.ui/README.md Applies a commit from the master branch to a stable branch (e.g., 1-8-stable). This is done after the commit has been pushed upstream from master. ```bash git checkout 1-8-stable git cherry-pick -x [sha-of-commit-from-master] ``` -------------------------------- ### Generate Flow Type from JSON Stream Source: https://github.com/metabrainz/musicbrainz-server/blob/master/HACKING.md Generate a Flow object type from a stream of JSON objects or a single JSON object. Each JSON object must be on a single line. ```bash cat $JSON | ./script/generate_json_flow_type.js ``` -------------------------------- ### Rebuild Database Indexes Without Concurrency Source: https://github.com/metabrainz/musicbrainz-server/blob/master/MAINTENANCE.md This option disables concurrent index rebuilding, which can speed up the process but will temporarily lock tables against writes. ```bash ./admin/RebuildIndexesUsingCollations.pl --noconcurrently ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.