MusicBrainz Server/Setup: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
No edit summary
m (→‎Requirements: Remove the required version of PostgreSQL, which was outdated and would like become outdated again, mention some other key software requirements)
 
(90 intermediate revisions by 20 users not shown)
Line 1: Line 1:
== Setup from Docker Compose ==
<small>[[Products]] > [[MusicBrainz Server]] > Server Setup</small>


This method is recommended as it makes install, setup, and maintenance much easier for you, to the cost of a small overhead compared to the size of the database.
== MusicBrainz Server virtual machine ==


It can be used to:
Running an NGS virtual machine requires some Linux knowledge, but it vastly simpler than installing NGS from scratch. To use the virtual machine instance, follow these steps:
* Replicate the MusicBrainz website/web service/database,
* Test your own app that queries MusicBrainz web service,
* Develop MusicBrainz Server itself.


See [https://github.com/metabrainz/musicbrainz-docker MusicBrainz Docker] and its [https://github.com/metabrainz/musicbrainz-docker/releases release notes].
=== With Virtual Box ===
# Start downloading the latest [http://ftp.musicbrainz.org/pub/musicbrainz/vm/MusicBrainz%20NGS%202012-01-12.ova virtual machine instance] ([http://ftp.uk.musicbrainz.org/pub/musicbrainz/vm/MusicBrainz%20NGS%202012-01-12.ova UK mirror]). Beware: This is a large (5Gb) download!
# Download and install [http://virtualbox.org Virtual Box] on your machine.
# Start Virtual Box and choose ''Import Appliance'' from the File menu. Select the downloaded file.
# Once Virtual Box has imported the appliance, select the imported virtual machine from the list of virtual machines and click on Start.
# Once the instance has started up, log in on the console using the username ''musicbrainz'' and password ''musicbrainz''. This account has sudo privileges -- if you would like to set a root passwd, you can do that via sudo.
# Run ''ifconfig'' and look at the ''inet addr'' for eth0. This is the IP address of your virtual machine. Note this IP address.
# Optional: The console for Virtual Box is very slow. I find it faster to SSH into the virtual box with a good terminal program.
# Copy lib/DBDefs.pm.default to lib/DBDefs.pm, and update MB_SERVER_ROOT and DEVELOPMENT_SERVER values
# To start the NGS server, enter these commands:


== Setup from source code ==
musicbrainz@clear:~$ cd musicbrainz-server/script
This can potentially be a very laborious and time consuming method of getting a functioning MusicBrainz server. Use it only if you cannot use MusicBrainz Docker for some reason (disk space, development, …).
musicbrainz@clear:~/musicbrainz-server/script$ ./musicbrainz_server.pl -r


Get a copy of musicbrainz-server from git:
Now you can reach the MusicBrainz server by pointing your browser to port 3000 of the IP address in step 6. If your IP address from step 7 was: 10.1.1.104, then point your browser to http://10.1.1.104:3000
git clone --recursive https://github.com/metabrainz/musicbrainz-server.git musicbrainz-server

To change the default port (3000) to some other port use the --port option when running musicbrainz_server.pl

For more configuration options, see the -help switch:

musicbrainz@clear:~/musicbrainz-server/script$ ./musicbrainz_server.pl --help

=== Troubleshooting ===

If you update the code base in an early version of the virtual server, you may encounter an error that complains about DEVELOPMENT_SERVER not being defined, please add this line to your lib/DBDefs.pm file:

sub DEVELOPMENT_SERVER { 1 }

And then start the server.

=== Running Replication ===

This VM comes "replication ready". To enable replication, and have the database catch up with the latest replication packets, do this:

* Switch your instance to be a slave. Edit musicbrainz-server/lib/DBDefs.pm and ensure REPLICATION_TYPE is RT_SLAVE.
sub REPLICATION_TYPE { RT_SLAVE }
* Start replication
cd musicbrainz-server/admin/replication
./LoadReplicationChanges

This will load all of the changes to the database since the VM update. To automate this, add this script to a cron job that fires off 10 minutes after each hour. NOTE: Loading replication changes might take a long time. If the VM is more than a couple of weeks old, it might be better for you to import a [[Database Download|fresh data set]]. Check [https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL the INSTALL file] for how to import new data.

=== Accessing the database ===

To access the main postgres database, you can do this:

cd musicbrainz-server/admin
./psql READWRITE

to accces the RAWDATA database (that also contains edits), use RAWDATA, instead of READWRITE. If you would like to access the DB from outside the virtual box, take a look at [http://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html how to change postgres connection settings].

=== Turning the VM into development box ===

If you would like to use the VM to do development instead of using it as a simple database slave, you'll need to edit lib/DBDefs.pm and set REPLICATION_TYPE to RT_STANDALONE and run admin/psql READWRITE and execute the following queries:

DELETE FROM annotation WHERE editor > (SELECT max(id) FROM editor);
DELETE FROM release_annotation WHERE NOT EXISTS (SELECT 1 FROM annotation WHERE annotation.id = release_annotation.annotation);

then from the command line execute:
# run admin/psql READWRITE < admin/sql/CreateFKConstraints.sql
# run admin/psql READWRITE < admin/sql/CreateFunctions.sql

TODO: The server will probably run out of disk space during this process. We need to add instructions on how to move the DB to a new partition.

== Setup MusicBrainz Server from source code ==
This can potentially be a very laborious and time consuming method of getting a functioning MusicBrainz server. Using the virtual machine is recommended.

Get a copy of musicbrainz-server from git:
git clone git://git.musicbrainz.org/musicbrainz-server.git musicbrainz-server
cd musicbrainz-server
cd musicbrainz-server
And follow the instructions in the [https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL INSTALL] file.
And follow the instructions in the [https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md INSTALL] file.


== Support ==
=== Support ===


The setup process may look daunting, but please don't let this discourage you; the INSTALL is thorough and contains a lot of information, and we are willing to provide assistance. If you have questions about installing, join us in the [http://webchat.freenode.net/?channels=musicbrainz-devel #musicbrainz-devel IRC channel] or post a question on the [[Developers Mailing List|developers mailing list]] and we will attempt to help you out.
The setup process may look daunting, but please don't let this discourage you; the INSTALL is thorough and contains a lot of information, and we are willing to provide assistance. If you have questions about installing, join us in the [http://webchat.freenode.net/?channels=metabrainz #metabrainz IRC channel] or post a question on the [https://community.metabrainz.org/tags/musicbrainz-server community forum] and we will attempt to help you out.


We recommend that you dive in and give it a try - who knows how far you'll get and what you might learn along the way!
We recommend that you dive in and give it a try - who knows how far you'll get and what you might learn along the way!


==Requirements==
===Requirements===


In order to set up a running MusicBrainz server with the full database you will need:
In order to set up a running MusicBrainz server with the full database you will need:
* A linux box, preferably Ubuntu, that is a PIII-700 or better with 256MB RAM.
* A linux box, preferably Ubuntu.
* 8GB of free disk space, (if you are a developer and only want the server code and database structure 2GB is more than enough).
* 60GB+ of free disk space, (if you are a developer and only want the server code and database structure 2GB+ should do, count 6GB+ if you want sample data).
* [[Git]] knowledge which will enable you to check out the source code.
* [[Git]] knowledge which will enable you to check out the source code.
* PostgreSQL, Perl, Node.js, and some other dependencies (See [https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md#prerequisites all software prerequisites])


As a developer the following knowledge/skills are beneficial:
As a developer the following knowledge/skills are beneficial:
* Apache, Perl, mod_perl, PostgreSQL and a number of perl modules.
* Perl and a number of perl modules, PostgreSQL, React/JSX.
* How to compile and install packages from source on a Linux box.
* How to compile and install packages from source on a Linux box.
* How to patch existing packages, although we can help you out if you have questions about that.
* How to patch existing packages, although we can help you out if you have questions about that.


Note: The server has ''never been ported to Windows'', and we suspect that it would be a fair amount of work to make that happen.
Note: The server has ''never been ported to Windows'', and we suspect that it would be a fair amount of work to make that happen.


==License==
==External Links==
* [https://github.com/metabrainz/musicbrainz-server MusicBrainz Server] on GitHub
** List of [https://blog.metabrainz.org/category/musicbrainz+server/?tag=changelog MusicBrainz Server updates] on the MetaBrainz blog
** List of supplemental [http://blog.musicbrainz.org/category/musicbrainz+server/?tag=instructions instructions] on the MetaBrainz blog


* [https://github.com/metabrainz/musicbrainz-server MusicBrainz Docker] on GitHub
The MusicBrainz Server is licensed under the [http://www.gnu.org/copyleft/gpl.html GPL (Gnu Public License)].
** List of [https://blog.metabrainz.org/category/musicbrainz+virtual-machine/ MusicBrainzB Virtual Machine releases] on the MetaBrainz blog
** List of [https://github.com/metabrainz/musicbrainz-server/releases MusicBrainz Docker releases] on GitHub


[[Category:WikiDocs Page]] [[Category:Download]] [[Category:Development]] [[Category:Server]]
[[Category:WikiDocs Page]] [[Category:Download]] [[Category:Development]] [[Category:Server]]

Latest revision as of 19:58, 28 March 2023

Setup from Docker Compose

This method is recommended as it makes install, setup, and maintenance much easier for you, to the cost of a small overhead compared to the size of the database.

It can be used to:

  • Replicate the MusicBrainz website/web service/database,
  • Test your own app that queries MusicBrainz web service,
  • Develop MusicBrainz Server itself.

See MusicBrainz Docker and its release notes.

Setup from source code

This can potentially be a very laborious and time consuming method of getting a functioning MusicBrainz server. Use it only if you cannot use MusicBrainz Docker for some reason (disk space, development, …).

Get a copy of musicbrainz-server from git:

git clone --recursive https://github.com/metabrainz/musicbrainz-server.git musicbrainz-server
cd musicbrainz-server

And follow the instructions in the INSTALL file.

Support

The setup process may look daunting, but please don't let this discourage you; the INSTALL is thorough and contains a lot of information, and we are willing to provide assistance. If you have questions about installing, join us in the #metabrainz IRC channel or post a question on the community forum and we will attempt to help you out.

We recommend that you dive in and give it a try - who knows how far you'll get and what you might learn along the way!

Requirements

In order to set up a running MusicBrainz server with the full database you will need:

  • A linux box, preferably Ubuntu.
  • 60GB+ of free disk space, (if you are a developer and only want the server code and database structure 2GB+ should do, count 6GB+ if you want sample data).
  • Git knowledge which will enable you to check out the source code.
  • PostgreSQL, Perl, Node.js, and some other dependencies (See all software prerequisites)

As a developer the following knowledge/skills are beneficial:

  • Perl and a number of perl modules, PostgreSQL, React/JSX.
  • How to compile and install packages from source on a Linux box.
  • How to patch existing packages, although we can help you out if you have questions about that.

Note: The server has never been ported to Windows, and we suspect that it would be a fair amount of work to make that happen.

External Links