MusicBrainz Server/Setup: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
No edit summary
(Merge in NGS Server Setup, I haven't verified the VM instructions)
Line 1: Line 1:
<small>[[Products]] > [[MusicBrainz Server]] > Server Setup</small>
<small>[[Products]] > [[MusicBrainz Server]] > Server Setup</small>


== Next Generation MusicBrainz Server (2011 onward) ==
== MusicBrainz Server virtual machine ==


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:
This page gives instructions for setting up the old Mason based MusicBrainz server in use from 2000 until 2011. For information on setting up a new [[Next Generation Schema]] MusicBrainz server, please see [[NGS Server Setup]].


# Start downloading the latest [http://ftp.musicbrainz.org/pub/musicbrainz/vm/MusicBrainz%20NGS%202011-07-20.ova virtual machine instance] ([http://ftp.uk.musicbrainz.org/pub/musicbrainz/vm/MusicBrainz%20NGS%202011-07-20.ova UK mirror]). Beware: This is a large (5Gb) download!
== Old MusicBrainz Server (2000-2010) ==
# 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:


musicbrainz@clear:~$ cd musicbrainz-server/script
The [[MusicBrainz Server]] is not available as an executable application. Setting up the server will require you to checkout the <code>mb_server</code> code from Subversion and manually follow the INSTALL file's directions.
musicbrainz@clear:~/musicbrainz-server/script$ ./musicbrainz_server.pl -r


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
You can browse the <code>mb_server</code> Subversion repository directly using the [http://bugs.musicbrainz.org/browser/mb_server/branches/RELEASE_20090524-BRANCH source browser].


=== Troubleshooting ===
==Setup instructions==
# If you are a MusicBrainz developer follow [http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=blob;f=INSTALL;hb=HEAD INSTALL] from our [[Git]] repository ''(potentially unstable)''.
# For everyone else, follow [http://bugs.musicbrainz.org/browser/mb_server/branches/RELEASE_20090524-BRANCH/INSTALL INSTALL] from our 20090524 release branch ''(latest stable release)''.
# If you just want a running database (i.e. no website frontend) see the [[Database Setup|database setup]] guide instead.
# Additionally, if you want to setup your own search server instead of having to query <code>search.musicbrainz.org</code>, use the <code>search_server</code> [http://bugs.musicbrainz.org/browser/search_server/trunk/README README].


If you update the code base in this 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:
An alternate option is to install a [[NGS Server Setup|virtual MusicBrainz server]]. The virtual image comes fully configured with a Linux environment and the latest stable release of the <code>mb_server</code> source code.


sub DEVELOPMENT_SERVER { 1 }
The requirements may look daunting, but please don't let this discourage you; the INSTALL/README files are thorough and contain 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 #musicbrainz IRC channel] or post a question on the [[Developers Mailing List|developers mailing list]] and we will attempt to help you out.

And then start the server.

=== Running Replication ===

This VM has replication enabled and to have the database catch up with the latest replication packets, do this:

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 fresh data set. Check 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: <code>git clone git://git.musicbrainz.org/musicbrainz-server.git musicbrainz-server</code>
# <code>cd musicbrainz-server</code> and follow the instructions in [https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL INSTALL]

== 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.


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!
Line 28: Line 77:
* A linux box, preferably Ubuntu, that is a PIII-700 or better with 256MB RAM.
* A linux box, preferably Ubuntu, that is a PIII-700 or better with 256MB RAM.
* 8GB of free disk space, (if you are a developer and only want the server code and database structure 2GB is more than enough).
* 8GB of free disk space, (if you are a developer and only want the server code and database structure 2GB is more than enough).
* [[Subversion]] knowledge which will enable you to check out the source code.
* [[Git]] knowledge which will enable you to check out the source code.


As a developer the following knowledge/skills are beneficial:
As a developer the following knowledge/skills are beneficial:
Line 39: Line 88:
==License==
==License==


The <code>mb_server</code> is licensed under the [http://www.gnu.org/copyleft/gpl.html GPL (Gnu Public License)].
The MusicBrainz Server is licensed under the [http://www.gnu.org/copyleft/gpl.html GPL (Gnu Public License)].


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

Revision as of 14:23, 28 October 2011

Products > MusicBrainz Server > Server Setup

MusicBrainz Server virtual machine

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:

  1. Start downloading the latest virtual machine instance (UK mirror). Beware: This is a large (5Gb) download!
  2. Download and install Virtual Box on your machine.
  3. Start Virtual Box and choose Import Appliance from the File menu. Select the downloaded file.
  4. Once Virtual Box has imported the appliance, select the imported virtual machine from the list of virtual machines and click on Start.
  5. 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.
  6. Run ifconfig and look at the inet addr for eth0. This is the IP address of your virtual machine. Note this IP address.
  7. Optional: The console for Virtual Box is very slow. I find it faster to SSH into the virtual box with a good terminal program.
  8. Copy lib/DBDefs.pm.default to lib/DBDefs.pm, and update MB_SERVER_ROOT and DEVELOPMENT_SERVER values
  9. To start the NGS server, enter these commands:
musicbrainz@clear:~$ cd musicbrainz-server/script 
musicbrainz@clear:~/musicbrainz-server/script$ ./musicbrainz_server.pl -r

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

Troubleshooting

If you update the code base in this 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 has replication enabled and to have the database catch up with the latest replication packets, do this:

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 fresh data set. Check 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 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:

  1. run admin/psql READWRITE < admin/sql/CreateFKConstraints.sql
  2. 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.

  1. Get a copy of musicbrainz-server from git: git clone git://git.musicbrainz.org/musicbrainz-server.git musicbrainz-server
  2. cd musicbrainz-server and follow the instructions in INSTALL

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 #musicbrainz-devel IRC channel or post a question on the developers mailing list 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, that is a PIII-700 or better with 256MB RAM.
  • 8GB of free disk space, (if you are a developer and only want the server code and database structure 2GB is more than enough).
  • Git knowledge which will enable you to check out the source code.

As a developer the following knowledge/skills are beneficial:

  • Apache, Perl, mod_perl, PostgreSQL and a number of perl modules.
  • 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.

License

The MusicBrainz Server is licensed under the GPL (Gnu Public License).