Skip to content

julienbenatar/Tunebot-2.0

Repository files navigation

Tunebot

Configuration

Configuration of secrets is done via environment variables. Copy .env.sample to .env and fill in appropriate values.

Dependencies

Tunebot has two major external dependencies:

It also requires a number of Node packages, defined in package.json.

Hacking on Tunebot

  1. Install Vagrant.

  2. Install Virtualbox.

  3. Clone this repo.

    $ git clone git@github.com:nextbigsoundinc/Tunebot-2.0.git
  4. Install the vagrant-hostmanager plugin.

    $ vagrant plugin install vagrant-hostmanager
  5. Bring up a VM with all of Tunebot's dependencies installed.

    $ cd Tunebot-2.0
    $ vagrant up

You should now be able to hit http://tunebot.dev in a browser. As you make changes to files in your local Tunebot directory, the VM you started above will automatically reload the server and pick up your changes. If you need to examine logs, etc, you can SSH into the running Tunebot VM with vagrant ssh.

The following logs may be of interest:

  • /var/log/redis/current
  • /var/log/mopidy/current
  • /var/log/tunebot/current

If you need to restart a service, you can do so with the sv command, like so:

  • sv restart redis
  • sv restart mopidy
  • sv restart tunebot

Installing on Mac OS X

  1. Install Homebrew

  2. Install XQuartz

  3. Tap the Mopidy keg:

    $ brew tap mopidy/mopidy
  4. Install mopidy and plugins:

    $ brew install mopidy mopidy-spotify
    $ pip install mopidy-scrobbler
  5. Install Nodejs:

    $ brew install nodejs
  6. Install & start Redis:

    $ brew install redis
    $ ln -sfv /usr/local/opt/redis/homebrew.mxcl.redis.plist ~/Library/LaunchAgents
    $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
  7. Get Tunebot:

    $ cd ~ && git clone git@github.com:nextbigsoundinc/Tunebot-2.0.git tunebot
    $ sudo ln -s ~/tunebot /opt/tunebot
  8. Install Node dependencies:

    $ cd /opt/tunebot && npm install
    $ npm install -g forever
    
  9. Configure Tunebot:

    $ cd /opt/tunebot
    $ cp .env.sample .env
    
    # Edit .env to set appropriate values
    
    $ ./scripts/build_templates.sh
  10. Start Mopidy:

    $ cp /opt/tunebot/launchd/homebrew.mopidy.mopidy.plist ~/Library/LaunchAgents
    $ launchctl load ~/Library/LaunchAgents/homebrew.mopidy.mopidy.plist
  11. Start Tunebot:

    $ cd /opt/tunebot; sudo forever start -o tunebot-api.log -e tunebot-err.log api-server.js
  12. To stop Tunebot:

    $ ps auxww | grep api-server.js
    
    # Note the PID of both the node process running api-server.js and
    # the forever monitor process.
    
    $ sudo kill -9 <node PID> <forever monitor PID>

Building & running a Docker container

These instructions assume you have a working Docker setup already.

  1. Build a Docker image.

    $ docker build -t=tunebot .
  2. Run the container, exposing port 80 on the host.

    $ docker run -d -p 80:80 tunebot

About

Music bot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published