Should I run Mopidy as a Service?

I’m new to Mopidy so please forgive my dumb questions. I’m running Mopidy on a raspberry pi and have been successful accessing Mopidy, Mopify and the API Explorer when viewing it on the raspberry pi (by use of localhost:6680). I’m trying to now access Mopify using my laptop on the same network.

To the best of my understanding, this means I need to operate Mopidy as a service (although I’m far from certain on this), so I’ve enabled SSH and edited both the /etc/mopidy/mopidy.conf and the /.config/mopidy/mopidy.conf files to enable MPD and HTTP.

Beyond this, I’m a bit lost… I’ve read confusing things on what I should do with the hostname in each of these config settings and where I should be attempting to access mopify from my browser. I’m going to do my best to paste the config values for both the /etc/ and /.config/ below.

/etc/mopidy/mopidy.conf values:
https://pastebin.com/nb2i8DR6

/.config/mopidy/mopidy.conf values:
https://pastebin.com/xfEjgLGs

Please let me know if there are other config values I should share…

I’m no Mopidy expert, but I do have Mopidy running as a service on a Pi, and control Mopidy (on my local network only) through a browser on my desktop. That is similar to what I believe you wish to do. The way that I talk to the Mopidy on the Pi is to edit the /etc/mopidy/mopidy.conf [http] section “hostname” to have the IP address of the Pi. Then I can address the Pi by putting in the IP address of the Pi into my desktop browser and use the “musicbox_webclient” to manage the Mopidy installation on the Pi. There may be other ways to achieve this end, but that works for me. So, you may wish to edit that config section to add the IP of the Pi. Start Mopidy running as a service (thru SSH), work out any errors that show up, and see about getting the client working on your laptop. Here is what the URL of my Musicbox client (in my desktop browser) looks like: “http://192.168.0.8:6680/musicbox_webclient/index.html#home”, where that IP address is what is assigned to the Pi.

1 Like

Apologies, I meant to reply to you.

This isn’t dependent on running as a service or not but there are other benefits to running Mopidy as a service so I would suggest you do so. But either way, to access your Mopidy server from another device you need to set the hostname setting in the http section to :: in order for the HTTP server to listen for both local and remote connections. For example:

[http]
enabled = true
hostname = ::
port = 6680

As explained here:

As a simple security measure, the web server is by default only available from localhost. To make it available from other computers, change the http/hostname config value. Before you do so, note that the HTTP extension does not feature any form of user authentication or authorization. Anyone able to access the web server can use the full core API of Mopidy. Thus, you probably only want to make the web server available from your local network or place it behind a web proxy which takes care or user authentication. You have been warned.

If you are running as a service then only the config file at /etc/mopidy/mopidy.conf is relevant. Once you’ve changed the hostname setting in that file, restart Mopidy and you’ll be able to connect using the IP address (as @Graham_Buxton says) or usually you can also use the name of your Raspberry Pi on the network. This might be http://raspberrypi:6680 or http://raspberrypi.local:6680.

1 Like

Thank you, that worked! Also, you answered my question of how to access the pi via using it’s hostname rather than IP Address. Double win!

Thank you to @Graham_Buxton for your help as well!