-
Notifications
You must be signed in to change notification settings - Fork 17
Install Nodel as a serviced (Ubuntu post 15.04) process
Please note: a bug in Ubuntu 16.04 kernel is affecting JSVC (17/7/17). Details here
The workaround is to use this extra flag in the JSVC configuration:
-Xss1280k
The latest Nodel JAR contains entry-points to allow use with JSVC.
There are two options to install Nodel. The first is to use this installer script, which also installs a basic node on the machine:
https://gist.github.com/rhulse/d292fe7b349b9a49131d14d6961bd630
Or you can do it manually:
Copy Nodel files into place. Replace with your nodel version.
sudo mkdir /opt/nodel
sudo cp nodelHost-<nodelversion>.jar /opt/nodel/nodel.jar
Test for installation of Java
java -version
If you do not see the Java version number, or the Java version is not 8 (1.8), install Java.
sudo apt-get install openjdk-8-jre-headless
Repeat the test above to verify installation.
If required, change the default Java version to 8.
sudo update-alternatives --config java
Run on the console (for testing):
cd /opt/nodel
sudo java -jar nodel.jar
After running this test, you should be able to view Nodel in a browser.
Install JSVC
sudo apt-get install jsvc
Run on the console using jsvc (for testing):
sudo /usr/bin/jsvc -cwd /opt/nodel -home /usr/lib/jvm/java-1.8.0-openjdk-amd64 -pidfile /var/run/jsvc.pid -cp /opt/nodel/nodel.jar:/usr/share/java/commons-daemon.jar org.nodel.nodelhost.Service
After running this test, you should be able to view Nodel in a browser.
If the computer is multi-homed (has two or more active network interfaces) then you will need to create a bootstrap.json file before proceeding. Check _example_bootstrap.json for details.
NOTE: fixed in new releases.
Be sure to have a 'nodel' user with a home directory (for pulseaudio to work), network access and audio controls. Optionally adding to the sudo group to grant administrative privilieges, which is required for some functionality.
sudo adduser nodel
sudo usermod -aG sudo nodel
sudo useradd -G netdev,audio,pulse,pulse-access -m -s /bin/bash nodel
Create daemon startup script:
sudo nano /lib/systemd/system/nodel.service
Copy and paste the following code into the editor. You may want to modify the 'user' parameter to run Nodel as a different user ('nodel' by default).
[Unit]
Description=Nodel
After=network-online.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
RestartSec=30
Restart=on-failure
User=nodel
ExecStart=/usr/bin/jsvc \
-cp /usr/share/java/commons-daemon.jar:/opt/nodel/nodel.jar \
-cwd /opt/nodel \
-user nodel \
-java-home ${JAVA_HOME} \
-pidfile /var/run/nodel/nodel.pid \
-errfile SYSLOG \
-outfile SYSLOG \
org.nodel.nodelhost.Service
ExecStop=/usr/bin/jsvc \
-pidfile /var/run/nodel/nodel.pid \
-stop \
org.nodel.nodelhost.Service
[Install]
WantedBy=multi-user.target
Press ctrl-x to exit and save the file
Configure Ubuntu to automatically create the folder for .pid on startup
sudo sh -c "echo 'd /var/run/nodel 0755 nodel nodel' > /usr/lib/tmpfiles.d/nodel.conf"
Set user permissions for Nodel directory
sudo chown -R nodel.nodel /opt/nodel
Add to startup
sudo systemctl enable nodel.service
Reboot and Nodel should start automatically
sudo shutdown -r now
Nodel: http://nodel.io/ | White Paper