projects:3dprint:octoprint
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
projects:3dprint:octoprint [2023/05/18 13:45] – [Make everything accessible on port 80] s to edit configurations and view logs, you need to get this set up. SSH comes bundled with Linux and is already set up and installed, we just need some minor edits to allow users to log in using password authentic jattie | projects:3dprint:octoprint [2023/05/18 19:26] (current) – ↷ Links adapted because of a move operation jattie | ||
---|---|---|---|
Line 2: | Line 2: | ||
<WRAP center round info 60%> | <WRAP center round info 60%> | ||
- | The long way is for if you care about the technical steps and want to reproduce it yourself. See the [[projects: | + | The long way is for if you care about the technical steps and want to reproduce it yourself. See the [[projects: |
</ | </ | ||
Line 303: | Line 303: | ||
==== Initialise LXD ==== | ==== Initialise LXD ==== | ||
- | The next step is to i daemon | + | The next step is to is to edit configurations and view logs, you need to get this set up. |
+ | |||
+ | SSH comes bundled with Linux and is already set up and installed, we just need some minor edits to allow users to log in using password authentication. The linux preferred way is to create RSA tokens and it's a great idea, just beyond the scope if this document. ((https:// | ||
+ | |||
+ | We are just going to allow a password authentication for now: | ||
+ | |||
+ | We need to: | ||
+ | |||
+ | * edit the ssh daemon configuration first | ||
+ | * restart the service | ||
+ | |||
+ | We can do it from our host Linux server OS directly on the container like this: | ||
+ | |||
+ | < | ||
+ | dev@hp-linux: | ||
+ | </ | ||
+ | |||
+ | That opens the sshd_config file on ythe container and allows us to edit it locally. | ||
+ | |||
+ | * find and uncomment/ | ||
+ | |||
+ | <code powershell> | ||
+ | # To disable tunneled clear text passwords, change to no here! | ||
+ | # | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | <code powershell> | ||
+ | # To disable tunneled clear text passwords, change to no here! | ||
+ | # | ||
+ | PasswordAuthentication yes | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | Then remember to restart sshd | ||
+ | </ | ||
+ | |||
+ | |||
+ | < | ||
+ | dev@hp-linux: | ||
+ | </ | ||
+ | |||
+ | Now test ssh connectivity | ||
+ | |||
+ | < | ||
+ | dev@hp-linux: | ||
+ | octo@cr6' | ||
+ | Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-71-generic x86_64) | ||
+ | |||
+ | * Documentation: | ||
+ | * Management: | ||
+ | * Support: | ||
+ | |||
+ | System information as of Thu May 18 09:37:40 UTC 2023 | ||
+ | |||
+ | |||
+ | |||
+ | * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s | ||
+ | just raised the bar for easy, resilient and secure K8s cluster deployment. | ||
+ | |||
+ | | ||
+ | |||
+ | Expanded Security Maintenance for Applications is not enabled. | ||
+ | |||
+ | 13 updates can be applied immediately. | ||
+ | 5 of these updates are standard security updates. | ||
+ | To see these additional updates run: apt list --upgradable | ||
+ | |||
+ | 9 additional security updates can be applied with ESM Apps. | ||
+ | Learn more about enabling ESM Apps service at https:// | ||
+ | |||
+ | |||
+ | Last login: Thu May 18 09:34:52 2023 from 192.168.0.32 | ||
+ | octo@octo: | ||
+ | |||
+ | </ | ||
+ | |||
+ | We are now connected as the octo user on the oct instance of lxc. I use PuTTY((https:// | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Start up and set up Octprint in the container ===== | ||
+ | |||
+ | The last section follows the instruction from the Octoprint community forum for [[https:// | ||
+ | |||
+ | There is a current issue with some of the key plugins I need to work, i.e. Filament manager and Spool manager that causes failures running under Python 3.10 on the Linux setup. Forcing the install to Python 3.9 in the virtual environment creation, resolves the issues. | ||
+ | |||
+ | ==== Set up a Python 3.9 virtual environment (venv) ==== | ||
+ | |||
+ | * add repositories to get access to 3.9 | ||
+ | * install 3.9 | ||
+ | |||
+ | < | ||
+ | octo@octo: | ||
+ | octo@octo: | ||
+ | octo@octo: | ||
+ | octo@octo: | ||
+ | octo@octo: | ||
+ | </ | ||
+ | |||
+ | * Create and change into the OctoPrint folder | ||
+ | * Create a 3.9 venv(Virtual Environment) | ||
+ | * Activate the new environment for further steps to follow | ||
+ | |||
+ | < | ||
+ | octo@octo: | ||
+ | octo@octo: | ||
+ | octo@octo: | ||
+ | (venv) octo@octo: | ||
+ | </ | ||
+ | |||
+ | Note the last line showing our 3.9 environment to be activated. | ||
+ | |||
+ | ==== Add pip and wheel updates ==== | ||
+ | |||
+ | |||
+ | < | ||
+ | (venv) octo@octo: | ||
+ | Requirement already satisfied: pip in ./ | ||
+ | Collecting pip | ||
+ | Using cached pip-23.1.2-py3-none-any.whl (2.1 MB) | ||
+ | Collecting wheel | ||
+ | Using cached wheel-0.40.0-py3-none-any.whl (64 kB) | ||
+ | Installing collected packages: wheel, pip | ||
+ | Attempting uninstall: pip | ||
+ | Found existing installation: | ||
+ | Uninstalling pip-22.0.4: | ||
+ | Successfully uninstalled pip-22.0.4 | ||
+ | Successfully installed pip-23.1.2 wheel-0.40.0 | ||
+ | </ | ||
+ | |||
+ | ==== Install Octoprint ==== | ||
+ | |||
+ | On successful completion, proceed to install octoprint | ||
+ | |||
+ | < | ||
+ | (venv) octo@octo: | ||
+ | Collecting octoprint | ||
+ | Using cached OctoPrint-1.8.7-py2.py3-none-any.whl (3.9 MB) | ||
+ | Collecting OctoPrint-FileCheck> | ||
+ | Using cached OctoPrint_FileCheck-2021.2.23-py2.py3-none-any.whl (19 kB) | ||
+ | |||
+ | </ | ||
+ | |||
+ | Wait for it to run to completion and address any errors that might show up. Hopefully no issues will arise, mine ran through without failures here. | ||
+ | |||
+ | ==== Assign octo user run permissions ==== | ||
+ | |||
+ | Now let us assign two more permissions to our octo user. | ||
+ | |||
+ | < | ||
+ | (venv) octo@octo: | ||
+ | (venv) octo@octo: | ||
+ | </ | ||
+ | |||
+ | The commands above add octo to the tty and dialout groups, so octo can run terminal session and connect to our devices like the prinyter port and camera ports. | ||
+ | |||
+ | ==== Do a test run ==== | ||
+ | |||
+ | < | ||
+ | (venv) octo@octo: | ||
+ | 2023-05-18 12: | ||
+ | 2023-05-18 12: | ||
+ | 2023-05-18 12: | ||
+ | </ | ||
+ | |||
+ | So we have concluded the basics to get a base install for Octoprint working. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ==== Autostart Octoprint as a Linux Service ==== | ||
+ | |||
+ | Run the automated script here: | ||
+ | |||
+ | < | ||
+ | (venv) octo@octo: | ||
+ | </ | ||
+ | |||
+ | Or copy from here: | ||
+ | |||
+ | <code ini octoprint.service> | ||
+ | [Unit] | ||
+ | Description=Octoprint Web Service | ||
+ | After=network-online.target | ||
+ | Wants=network-online.target | ||
+ | |||
+ | [Service] | ||
+ | Environment=" | ||
+ | Environment=" | ||
+ | Type=exec | ||
+ | User=octo | ||
+ | ExecStart=/ | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </ | ||
+ | |||
+ | I use nano: | ||
+ | |||
+ | < | ||
+ | (venv) octo@octo: | ||
+ | </ | ||
+ | |||
+ | Once the edits are completed and matching our setup, enable and start the service. | ||
+ | |||
+ | |||
+ | < | ||
+ | (venv) octo@octo: | ||
+ | Created symlink / | ||
+ | (venv) octo@octo: | ||
+ | (venv) octo@octo: | ||
+ | ● octoprint.service - Octoprint Web Service | ||
+ | | ||
+ | | ||
+ | Main PID: 16533 (octoprint) | ||
+ | Tasks: 12 (limit: 9209) | ||
+ | | ||
+ | CPU: 4.457s | ||
+ | | ||
+ | | ||
+ | |||
+ | May 18 13:25:28 octo octoprint[16533]: | ||
+ | May 18 13:25:28 octo octoprint[16533]: | ||
+ | May 18 13:25:29 octo octoprint[16533]: | ||
+ | May 18 13:25:29 octo octoprint[16533]: | ||
+ | May 18 13:25:29 octo octoprint[16533]: | ||
+ | May 18 13:25:29 octo octoprint[16533]: | ||
+ | May 18 13:25:29 octo octoprint[16533]: | ||
+ | May 18 13:25:29 octo octoprint[16533]: | ||
+ | May 18 13:25:29 octo octoprint[16533]: | ||
+ | May 18 13:25:31 octo octoprint[16533]: | ||
+ | lines 1-20/20 (END) | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Advanced Features ===== | ||
+ | |||
+ | ==== Enable .local network access ==== | ||
+ | |||
+ | to resolve the machine name with octo.local we need the avahi service. | ||
+ | |||
+ | * sudo apt install avahi-daemon | ||
+ | * systemctl restart avahi-daemon | ||
+ | * systemctl status avahi-daemon | ||
+ | |||
+ | |||
+ | |||
+ | ==== Make everything accessible on port 80 ==== | ||
+ | |||
+ | * install haproxy | ||
+ | * configure haproxy | ||
+ | * restart the service | ||
+ | |||
+ | === Install === | ||
+ | |||
+ | < | ||
+ | (venv) octo@octo: | ||
+ | Reading package lists... Done | ||
+ | Building dependency tree... Done | ||
+ | Reading state information... Done | ||
+ | </ | ||
+ | |||
+ | === Config === | ||
+ | |||
+ | < | ||
+ | (venv) octo@octo: | ||
+ | </ | ||
+ | |||
+ | <code apache haproxy.cfg> | ||
+ | global | ||
+ | log / | ||
+ | log / | ||
+ | chroot / | ||
+ | stats socket / | ||
+ | stats timeout 30s | ||
+ | user haproxy | ||
+ | group haproxy | ||
+ | | ||
# Default SSL material locations | # Default SSL material locations | ||
Line 342: | Line 621: | ||
http-request replace-path / | http-request replace-path / | ||
server webcam1 | server webcam1 | ||
- | |||
</ | </ | ||
- | * restart | + | * Restart |
- | * check the status | + | * Check the status after the edits and restart |
<cli> | <cli> | ||
Line 378: | Line 655: | ||
(venv) octo@octo: | (venv) octo@octo: | ||
- | </cli | ||
- | ==== Make everything accessible on port 80 ==== | ||
- | |||
- | * install haproxy | ||
- | * configure haproxy | ||
- | * restart the service | ||
- | |||
- | === Install === | ||
- | |||
- | <cli> | ||
- | (venv) octo@octo: | ||
- | Reading package lists... Done | ||
- | Building dependency tree... Done | ||
- | Reading state information... Done | ||
</ | </ | ||
- | === Config === | + | We should now be able to access the server on the standard port 80, i.e. no port specification required. |
- | <cli> | ||
- | (venv) octo@octo: | ||
- | </ | ||
- | |||
- | <code apache haproxy.cfg> | ||
- | global | ||
- | log / | ||
- | log / | ||
- | chroot / | ||
- | stats socket / | ||
- | stats timeout 30s | ||
- | user haproxy | ||
- | group haproxy | ||
- | | ||
==== Setting up SSH access to your container ==== | ==== Setting up SSH access to your container ==== | ||
projects/3dprint/octoprint.1684417504.txt.gz · Last modified: 2023/05/18 13:45 by jattie