There is little information online concerning the linux version of the high fidelity server, and non detailing how to build on Ubuntu 16.04 and run as a service at boot time. I wanted to share my experience here.
The documentation online suggests a Digital Ocean droplet with one GB memory. However, my own tests showed that the hifi server uses around a gig of memory itself, causing the server performance to slow, especially with regard to live audio.
I tried running the server on the free aws T1.micro tier with 1 GB and experienced terrible performance.
At the time of this writing (May 2017), the m3.medium server was the best cost/performance server. The instance can be shut down when not in use to save money. If left on 24/7, the server and hosting costs will be approximately $50 a month. Furthermore, the m3 is a step up in network speed (medium use rather than light use, no additional specifics) according to amazon.
Server setup: (much of this copied from another post here)
System:
Ubuntu 16.04 64 bit OS
I used an elastic IP to lock down a fixed ip so that we can easily assign a domain name in the future.
After provisioning the server and assigning an elastic IP, open ssh port to your up to your IP in the default security group. In order to be able to remotely administer our domain, we want to access its domain settings page from a web browser. When you run the Domain Server, it serves the settings page on port 40100. Also open ports 40100-40105 to UDP and TCP.
Install the pem key provided by amazon and install/build the server:
sudo su
apt-get update
apt-get install -y build-essential mesa-common-dev libglu1-mesa-dev libasound2 libxmu-dev libxi-dev freeglut3-dev libasound2-dev libjack0 libjack-dev libxrandr-dev libudev-dev software-properties-common git libssl-dev zlib1g-dev
add-apt-repository ppa:george-edison55/cmake-3.x
apt-get update
apt-get install -y cmake
add-apt-repository ppa:beineri/opt-qt562-xenial
apt-get update
apt-get install -y qt-latest
apt install cmake
git clone -b master https://github.com/highfidelity/hifi.git
(Or you can try stable… I’ve noticed that the latest server sometimes doesn’t play nice with the latest interface)
use: git clone -b stable --single-branch https://github.com/highfidelity/hifi.git
cd hifi
mkdir build
cd build
cmake …-DQT_CMAKE_PREFIX_PATH=/opt/qt56/lib/cmake/
make domain-server assignment-client
For testing you can do the following (pay attention to the user, as domain settings are stored in the user’s home directory… :~/.local/share/High Fidelity
tmux
./domain-server/domain-server
*Now press “Ctrl-B” and then “D” to exit but leave this process running
tmux
./assignment-client/assignment-client -n 6
*Now press “Ctrl-B” and then “D” to exit but leave this process running
However once you have everything set up and running, it’s easier to set the server up as a service. Kill the server and do the following:
Ubuntu 16.04 uses systemd for startup scripts:
First create these two files as root:
/etc/systemd/system/startHIFI-domainserver.service:
[Unit]
Description=start
HIFI domain server
[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu
ExecStart=/home/ubuntu/hifi/build/domain-server/domain-server
[Install]
WantedBy=multi-user.target
……………….
/etc/systemd/system/startHIFI-assign-client.service:
[Unit]
Description=start
HIFI assignment client server
[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu/hifi/build
ExecStart=/home/ubuntu/hifi/build/assignment-client/assignment-client -n 6
Restart=always
[Install]
WantedBy=multi-user.target
…………………
Now tell systemd to read your new services:
systemctl enable startHIFI-assign-client.service
systemctl enable startHIFI-domainserver.service
systemctl daemon-reload
Now manually test your scripts before rebooting:
systemctl start startHIFI-domainserver.service
systemctl start startHIFI-assign-client.service
If everything looks good, try rebooting and see if your server comes up. Please note that I forced the service to run as user ubuntu (amazon’s default user account). Running as root caused some problems for me due to the location of the server config files.