So I have been at this for two days and finally after these two days I can say I figured out how to install Octoprint with multi instances on a laptop running Raspberry pi Desktop os. Now getting Octoprint installed wasn't that hard but getting the multi instances to work together was tricky. I tried following guides on YouTube and searched and searched on here but none of the guides worked. I could get the first instance to work but none of the other ones. I figured I would share what I did so that way if someone wants to do it they can without looking at a million YouTube videos, reading a bunch of posts.
Step 1: check for updates, then install python parts
sudo apt update
sudo apt install python-pip python-dev python-setuptools python-virtualenv git libyaml-dev build-essential
Step 2: create Octoprint dir
mkdir ~/OctoPrint && cd ~/OctoPrint
Step 3: virtual environment
virtualenv venv
source venv/bin/activate
pip install pip --upgrade
pip install octoprint
sudo usermod -a -G tty pi
sudo usermod -a -G dialout pi
Step 4: Setup Octoprint to autostart on restart/reboot
wget https://github.com/foosel/OctoPrint/raw/master/scripts/octoprint.init && sudo mv octoprint.init /etc/init.d/octoprint
wget https://github.com/foosel/OctoPrint/raw/master/scripts/octoprint.default && sudo mv octoprint.default /etc/default/octoprint
sudo chmod +x /etc/init.d/octoprint
Set 5: edit octoprint file
sudo nano /etc/default/octoprint
Remove the hash comment character "#" from the start of the following line in the script file:
DAEMON=/home/pi/OctoPrint/venv/bin/octoprint
Save the file.
Set 6: dd the modified script to the autostart sequence by using this command
sudo update-rc.d octoprint defaults
If you want to test octoprint then run this command and then go to your browser and go to http://ipaddy:5000
~/OctoPrint/venv/bin/octoprint serve
Everything show be working great at this point. go ahead and setup octoprint in the browser and make sure it all works. once you have gone thru all the steps to get octoprint up and running let dive into getting more then one running.
Now lets setup another instances of octoprint. I am going to show you one more instance if you want more just change the number 2 to 3,4,5 so on and so on.
Step 1: First, we copy the Octoprint directory
cp -R /home/pi/.octoprint /home/pi/.octoprint2
Next copy the OctoPrint Configuration script /etc/defaults/octoprint to /etc/defaults/octoprint2
sudo cp /etc/default/octoprint /etc/default/octoprint2
Step 2: Modify the port and add a new basedir.
sudo nano /etc/default/octoprint2
change the configuration file (these are if you have haproxy installed (I don't)
PORT=5001
DAEMON_ARGS="--host=$HOST --port=$PORT --config /home/pi/.octoprint2/config.yaml --basedir /home/pi/.octoprint2/"
Now change the default one
sudo nano /etc/default/octoprint
PORT=5000
DAEMON_ARGS="--host=$HOST --port=$PORT --config /home/pi/.octoprint/config.yaml --basedir /home/pi/.octoprint/"
If you don't have haproxy installed do the following (this is what I did)
sudo nano /etc/default/octoprint
PORT=5000
DAEMON_ARGS="--port=$PORT --config /home/pi/.octoprint/config.yaml --basedir /home/pi/.octoprint/"
sudo nano /etc/default/octoprint2
PORT=5001
DAEMON_ARGS="--port=$PORT --config /home/pi/.octoprint2/config.yaml --basedir /home/pi/.octoprint2/"
In your browser it will be http://ipaddy:5000 and http://ipaddy:5001
Step 3: Get a second instance automatically running after booting
sudo cp /etc/init.d/octoprint /etc/init.d/octoprint2
Now we need to modify the it a little
sudo nano /etc/init.d/octoprint2
You need to make some changes at the top of this file! Change every name from "octoprint" to "octoprint2" and "OctoPrint" to "OctoPrint2" but leave the line
DAEMON=/usr/bin/octoprint
UNTOUCHED!!!
Mine looks like this
#!/bin/sh
### BEGIN INIT INFO
# Provides: octoprint2
# Required-Start: $local_fs networking
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OctoPrint2 daemon
# Description: Starts the OctoPrint daemon with the user specified in
# /etc/default/octoprint2.
### END INIT INFO
# Author: Sami Olmari
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="OctoPrint2 Daemon"
NAME="OctoPrint2"
DAEMON=/usr/bin/octoprint
PIDFILE=/var/run/$NAME.pid
PKGNAME=octoprint2
SCRIPTNAME=/etc/init.d/$PKGNAME
. . . . . .
Save File
Step 4: Now we need to use systemctl
sudo systemctl daemon-reload
run this command to have it start automatically after booting
sudo update-rc.d octoprint2 defaults
To start the service manual
sudo /etc/init.d/octoprint2 start
To check if it has been added successfully to sysemctl
systemctl status octoprint2.service
Step 5: enable restart of second octoprint instance over the web interface
nano /home/pi/.octoprint2/config.yaml
Change the service name in the restart command to octoprint2.
serverRestartCommand: sudo service octoprint2 restart
If there are no errors it should all work
Now reboot
This is a combination of a few guides that are on the net. I just pieced them together that way if someone was trying to get something like this to work they wouldn't have to search and search.
credit for the Multi instances is from here
http://thomas-messmer.com/index.php/14-free-knowledge/howtos/79-setting-up-octoprint-for-multiple-printers
this first part is just your basic install guide of octoprint on linux.
I hope this helps people as I struggled with getting this to work for the last two day and I don't want anyone else to struggle with it..
I didn't include Haproxy because I didn't use it. but on the multi instances link it shows you how to use Haproxy with multi octoprints running!!!