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 12:51] – [Set up a Python 3.9 virtual environment (venv)] 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 418: | Line 418: | ||
Note the last line showing our 3.9 environment to be activated. | Note the last line showing our 3.9 environment to be activated. | ||
- | Now add pip and wheel updates. | + | ==== Add pip and wheel updates |
<cli> | <cli> | ||
Line 434: | Line 435: | ||
Successfully installed pip-23.1.2 wheel-0.40.0 | Successfully installed pip-23.1.2 wheel-0.40.0 | ||
</ | </ | ||
+ | |||
+ | ==== Install Octoprint ==== | ||
On successful completion, proceed to install octoprint | On successful completion, proceed to install octoprint | ||
Line 447: | Line 450: | ||
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. | 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. | Now let us assign two more permissions to our octo user. | ||
Line 456: | Line 461: | ||
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. | 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 ==== | ||
<cli> | <cli> | ||
Line 466: | Line 473: | ||
So we have concluded the basics to get a base install for Octoprint working. | 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: | ||
+ | |||
+ | <cli> | ||
+ | (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: | ||
+ | |||
+ | <cli> | ||
+ | (venv) octo@octo: | ||
+ | </ | ||
+ | |||
+ | Once the edits are completed and matching our setup, enable and start the service. | ||
+ | |||
+ | |||
+ | <cli> | ||
+ | (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 === | ||
+ | |||
+ | <cli> | ||
+ | (venv) octo@octo: | ||
+ | Reading package lists... Done | ||
+ | Building dependency tree... Done | ||
+ | Reading state information... Done | ||
+ | </ | ||
+ | |||
+ | === Config === | ||
+ | |||
+ | <cli> | ||
+ | (venv) octo@octo: | ||
+ | </ | ||
+ | |||
+ | <code apache haproxy.cfg> | ||
+ | global | ||
+ | log / | ||
+ | log / | ||
+ | chroot / | ||
+ | stats socket / | ||
+ | stats timeout 30s | ||
+ | user haproxy | ||
+ | group haproxy | ||
+ | daemon | ||
+ | |||
+ | # Default SSL material locations | ||
+ | ca-base / | ||
+ | crt-base / | ||
+ | |||
+ | # See: https:// | ||
+ | ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256: | ||
+ | ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256: | ||
+ | ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets | ||
+ | |||
+ | defaults | ||
+ | log | ||
+ | mode http | ||
+ | option | ||
+ | option | ||
+ | timeout connect 5000 | ||
+ | timeout client | ||
+ | timeout server | ||
+ | errorfile 400 / | ||
+ | errorfile 403 / | ||
+ | errorfile 408 / | ||
+ | errorfile 500 / | ||
+ | errorfile 502 / | ||
+ | errorfile 503 / | ||
+ | errorfile 504 / | ||
+ | |||
+ | frontend public | ||
+ | bind :::80 v4v6 | ||
+ | use_backend webcam if { path_beg /webcam/ } | ||
+ | default_backend octoprint | ||
+ | |||
+ | backend octoprint | ||
+ | option forwardfor | ||
+ | server octoprint1 127.0.0.1: | ||
+ | |||
+ | backend webcam | ||
+ | http-request replace-path / | ||
+ | server webcam1 | ||
+ | </ | ||
+ | |||
+ | * Restart the service | ||
+ | * Check the status after the edits and restart | ||
+ | |||
+ | <cli> | ||
+ | (venv) octo@octo: | ||
+ | (venv) octo@octo: | ||
+ | ● haproxy.service - HAProxy Load Balancer | ||
+ | | ||
+ | | ||
+ | Docs: man: | ||
+ | | ||
+ | Process: 16750 ExecStartPre=/ | ||
+ | Main PID: 16752 (haproxy) | ||
+ | Tasks: 9 (limit: 9209) | ||
+ | | ||
+ | CPU: 239ms | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | May 18 13:43:46 octo haproxy[10866]: | ||
+ | May 18 13:43:46 octo haproxy[10866]: | ||
+ | May 18 13:43:46 octo haproxy[10866]: | ||
+ | May 18 13:43:46 octo haproxy[10866]: | ||
+ | May 18 13:43:46 octo systemd[1]: haproxy.service: | ||
+ | May 18 13:43:46 octo systemd[1]: Stopped HAProxy Load Balancer. | ||
+ | May 18 13:43:46 octo systemd[1]: haproxy.service: | ||
+ | May 18 13:43:46 octo systemd[1]: Starting HAProxy Load Balancer... | ||
+ | May 18 13:43:46 octo haproxy[16752]: | ||
+ | May 18 13:43:46 octo systemd[1]: Started HAProxy Load Balancer. | ||
+ | (venv) octo@octo: | ||
+ | |||
+ | </ | ||
+ | We should now be able to access the server on the standard port 80, i.e. no port specification required. | ||
==== Setting up SSH access to your container ==== | ==== Setting up SSH access to your container ==== |
projects/3dprint/octoprint.1684414281.txt.gz · Last modified: 2023/05/18 12:51 by jattie