MusicBrainz Server/Setup: Difference between revisions
(Clarify replication status) |
RobertKaye (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
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: |
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: |
||
# Start downloading the latest [http://ftp.musicbrainz.org/pub/musicbrainz/vm/MusicBrainz%20NGS% |
# Start downloading the latest [http://ftp.musicbrainz.org/pub/musicbrainz/vm/MusicBrainz%20NGS%202012-01-12.7z virtual machine instance] ([http://ftp.uk.musicbrainz.org/pub/musicbrainz/vm/MusicBrainz%20NGS%202012-01-12.7z UK mirror]). Beware: This is a large (4.2Gb) download! |
||
# Decompress the virtual machine with a 7zip program (TODO: flesh this out) |
|||
# Download and install [http://virtualbox.org Virtual Box] on your machine. |
|||
# Download and install [http://www.vmware.com/products/player/ VMware player] (linux, windows) or [http://www.vmware.com/products/fusion/overview.html VMware Fusion] (mac) on your machine. |
|||
# Start |
# Start VMware player (or VMware fusion) and chose "Open" from the File menu. Select the downloaded virtual machine. |
||
# Once Virtual Box has imported the appliance, select the imported virtual machine from the list of virtual machines and click on Start. |
|||
# Once the VMware player has opened the virtual machine, click on play to start the machine. |
|||
# 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. |
# 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. |
# 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 |
|||
⚫ | |||
musicbrainz@ |
musicbrainz@mbserver:~$ ./runserver.sh |
||
⚫ | |||
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 |
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 |
||
To change the |
To change the any options, such as the port and address the server listens on, you'll need to invoke the musicbrainz_server.pl script. For instance to change the port (3000) to some other port use the --port option when running musicbrainz_server.pl it the scripts subdirectory of musicbrainz-server: |
||
musicbrainz@mbserver:~$ cd ~/musicbrainz-server/script |
|||
⚫ | |||
musicbrainz@mbserver:~/musicbrainz-server/script$ ./musicbrainz_server.pl -r --port <port number> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
=== 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 === |
=== Running Replication === |
||
To have the virtual machine catch up to the main server, do this: |
|||
⚫ | |||
* Switch your instance to be a slave. Edit musicbrainz-server/lib/DBDefs.pm and ensure REPLICATION_TYPE is RT_SLAVE. |
|||
musicbrainz@mbserver:~/musicbrainz-server/admin/replication$ ./LoadReplicationChanges |
|||
sub REPLICATION_TYPE { RT_SLAVE } |
|||
* Start replication |
|||
⚫ | |||
./LoadReplicationChanges |
|||
This will load all of the changes to the database since the VM |
This will load all of the changes to the database since the VM was created. 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 === |
=== Accessing the database === |
||
Line 50: | Line 40: | ||
To access the main postgres database, you can do this: |
To access the main postgres database, you can do this: |
||
cd musicbrainz-server/admin |
musicbrainz@mbserver:~$ cd ~/musicbrainz-server/admin |
||
./psql READWRITE |
musicbrainz@mbserver:~/musicbrainz-server/admin$ ./psql READWRITE |
||
If you would like to access the DB from outside the virtual machine, 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 === |
=== 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: |
This VM comes "replication ready" and it setup as a slave, which means that you cannot make changes to the DB, or the replication will break. 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 annotation WHERE editor > (SELECT max(id) FROM editor); |
||
Line 63: | Line 53: | ||
then from the command line execute: |
then from the command line execute: |
||
⚫ | |||
⚫ | |||
musicbrainz@mbserver:~$ cd ~/musicbrainz-server/admin |
|||
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. |
|||
⚫ | |||
⚫ | |||
NOTE: Once you make changes to the database you need to re-import a clean dataset to turn replication back on. |
|||
== Setup MusicBrainz Server from source code == |
== Setup MusicBrainz Server from source code == |
||
Line 91: | Line 82: | ||
As a developer the following knowledge/skills are beneficial: |
As a developer the following knowledge/skills are beneficial: |
||
* |
* Perl, Catalyst, PostgreSQL and a number of perl modules. |
||
* 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. |
Revision as of 21:08, 18 January 2012
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:
- Start downloading the latest virtual machine instance (UK mirror). Beware: This is a large (4.2Gb) download!
- Decompress the virtual machine with a 7zip program (TODO: flesh this out)
- Download and install VMware player (linux, windows) or VMware Fusion (mac) on your machine.
- Start VMware player (or VMware fusion) and chose "Open" from the File menu. Select the downloaded virtual machine.
- Once the VMware player has opened the virtual machine, click on play to start the machine.
- 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.
- To start the default NGS server, enter this command:
musicbrainz@mbserver:~$ ./runserver.sh
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
To change the any options, such as the port and address the server listens on, you'll need to invoke the musicbrainz_server.pl script. For instance to change the port (3000) to some other port use the --port option when running musicbrainz_server.pl it the scripts subdirectory of musicbrainz-server:
musicbrainz@mbserver:~$ cd ~/musicbrainz-server/script musicbrainz@mbserver:~/musicbrainz-server/script$ ./musicbrainz_server.pl -r --port <port number>
For more configuration options, see the --help switch:
musicbrainz@mbserver:~/musicbrainz-server/script$ ./musicbrainz_server.pl --help
Running Replication
To have the virtual machine catch up to the main server, do this:
musicbrainz@mbserver:~$ cd ~/musicbrainz-server/admin/replication musicbrainz@mbserver:~/musicbrainz-server/admin/replication$ ./LoadReplicationChanges
This will load all of the changes to the database since the VM was created. 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:
musicbrainz@mbserver:~$ cd ~/musicbrainz-server/admin musicbrainz@mbserver:~/musicbrainz-server/admin$ ./psql READWRITE
If you would like to access the DB from outside the virtual machine, take a look at how to change postgres connection settings.
Turning the VM into development box
This VM comes "replication ready" and it setup as a slave, which means that you cannot make changes to the DB, or the replication will break. 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:
musicbrainz@mbserver:~$ cd ~/musicbrainz-server/admin musicbrainz@mbserver:~/musicbrainz-server/admin$ ./psql READWRITE < admin/sql/CreateFKConstraints.sql musicbrainz@mbserver:~/musicbrainz-server/admin$ ./psql READWRITE < admin/sql/CreateFunctions.sql
NOTE: Once you make changes to the database you need to re-import a clean dataset to turn replication back on.
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
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 #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:
- Perl, Catalyst, 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).