Configuration of secrets is done via environment variables. Copy
.env.sample to .env and fill in appropriate values.
Tunebot has two major external dependencies:
It also requires a number of Node packages, defined in package.json.
-
Install Vagrant.
-
Install Virtualbox.
-
Clone this repo.
$ git clone git@github.com:nextbigsoundinc/Tunebot-2.0.git
-
Install the
vagrant-hostmanagerplugin.$ vagrant plugin install vagrant-hostmanager
-
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 redissv restart mopidysv restart tunebot
-
Install Homebrew
-
Install XQuartz
-
Tap the Mopidy keg:
$ brew tap mopidy/mopidy
-
Install mopidy and plugins:
$ brew install mopidy mopidy-spotify $ pip install mopidy-scrobbler
-
Install Nodejs:
$ brew install nodejs
-
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
-
Get Tunebot:
$ cd ~ && git clone git@github.com:nextbigsoundinc/Tunebot-2.0.git tunebot $ sudo ln -s ~/tunebot /opt/tunebot
-
Install Node dependencies:
$ cd /opt/tunebot && npm install $ npm install -g forever -
Configure Tunebot:
$ cd /opt/tunebot $ cp .env.sample .env # Edit .env to set appropriate values $ ./scripts/build_templates.sh
-
Start Mopidy:
$ cp /opt/tunebot/launchd/homebrew.mopidy.mopidy.plist ~/Library/LaunchAgents $ launchctl load ~/Library/LaunchAgents/homebrew.mopidy.mopidy.plist
-
Start Tunebot:
$ cd /opt/tunebot; sudo forever start -o tunebot-api.log -e tunebot-err.log api-server.js
-
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>
These instructions assume you have a working Docker setup already.
-
Build a Docker image.
$ docker build -t=tunebot . -
Run the container, exposing port 80 on the host.
$ docker run -d -p 80:80 tunebot