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:10] – [Do a test run] 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 476: | Line 476: | ||
==== Autostart Octoprint as a Linux Service ==== | ==== 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.1684415428.txt.gz · Last modified: 2023/05/18 13:10 by jattie