Skip to content

reosarevok/listenbrainz-server

 
 

listenbrainz-server

Server for the ListenBrainz project.

Installation

These instructions are meant to get you started quickly with development process. Installation process in production environment might be different.

First, install ChefDK, then:

$ kitchen create    # creates vm for first time
$ kitchen converge  # provisions/installs from chef cookbooks
$ kitchen login     # ssh in to vm

Database installation

Since chef doesn't install PostgreSQL and initialize database yet, this has to be done manually. First, after you are logged into the virtual machine, install postgresql-9.4 package:

$ sudo apt-get install postgresql-9.4

After PostgreSQL is installed, add this line at the beginning of /etc/postgresql/9.4/main/pg_hba.conf file:

local all all trust

and restart PostgreSQL:

$ sudo service postgresql restart

Python dependencies

Database should be ready. Before running any Python scripts, you need to install Python dependencies:

$ cd ~/listenbrainz
$ pip install -r requirements.txt

Configuration file

Copy the file config.py.sample to config.py and edit the postgres settings. For now you will need to allow your system user to connect as the postgres admin user with no password.

Register for a MusicBrainz application at https://musicbrainz.org/account/applications. During registration set the callback url to http://<your_host>/login/musicbrainz/post.

Database initialization

To initialize the database (create user, tables, etc.) run this command:

$ python manage.py init_db

After that server should be ready to go.

Running

To run the webserver use this command:

$ python manage.py runserver

It should be accessible at http://10.1.2.3:8080/.

For information about running listenstore module see /listenstore/README.md file.

Fixing problems

LeaderNotAvailableError

After setting up the server and trying to submit your listens to the server, this error might appear:

Kafka listens write error: <class 'kafka.common.LeaderNotAvailableError'>

One way to fix it is to delete all data directories created for Kafka and Zookeeper.

First, stop both Kafka and Zookeeper services:

$ sudo service kafka stop
$ sudo service zookeeper stop

Wipe Kafka's data directory:

$ sudo rm /var/lib/kafka/kafka-logs/*

and Zookeeper's:

$ sudo rm /var/lib/zookeeper/*

Start them again:

$ sudo service kafka start
$ sudo service zookeeper start

Finally, create a listens topic in Kafka:

$ sudo /opt/kafka/bin/kafka-topics.sh --create --zookeeper localhost:2181 --topic "listens" --partitions 1 --replication-factor 1

This should fix the issue. See this page for more info about described method: http://stackoverflow.com/a/24028480.

About

Server for the ListenBrainz project

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 59.9%
  • Python 15.0%
  • HTML 13.9%
  • Ruby 7.0%
  • JavaScript 3.6%
  • Shell 0.3%
  • Other 0.3%