Notes to Self

Alex Sokolsky's Notes on Computers and Programming

OctoPrint in a ProxMox Container

Sources

Container

Pass through the USB ports for controller and webcam connection.

Create User

Create user to run octoprint, say pi:

Add user/group pi

adduser pi
usermod -a -G adm,sudo,tty,dialout pi

Install Dependencies

Update OS, install dependencies:

apt update
apt upgrade
apt install python3-pip python3-dev python3-setuptools python3-venv \
    git libyaml-dev build-essential

Install OctoPrint

As user pi, create python venv:

mkdir ~/OctoPrint && cd ~/OctoPrint
python3 -m venv venv
source venv/bin/activate

Within that venv:

pip install pip --upgrade
pip install octoprint

Test Start

You should be able to start the OctoPrint server using:

pi@raspberrypi:~ $ ~/OctoPrint/venv/bin/octoprint serve

After you done with testing - shut it by Ctrl+C

GUI

Should be available on http://octo:5000.

Automatic Start-up

Setup the start-up script:

wget https://github.com/OctoPrint/OctoPrint/raw/master/scripts/octoprint.service && sudo mv octoprint.service /etc/systemd/system/octoprint.service

Add the script to autostart:

sudo systemctl enable octoprint.service

Enable restart/shutdown via OctoPrint’s system menu

In the UI, under Settings > Commands, configure the following commands:

Passthrough USB ports to the OctoPrint Container

Passthrough USB ports to LXC Container

Edit /etc/pve/nodes/pve/lxc/<id>.conf, edit the following lines:

lxc.cgroup.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/bus/usb/001/016 dev/bus/usb/001/016 none bind,optional,create=file