docs: update manual setup/update (#368)
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
1 parent
39fd77d065
commit
89bc5d6e7d
7 files changed
+173
-79
No files matched your search
@@ -9,57 +9,78 @@ permalink: /setup/manual-setup/klipper
|
||||
|
||||
# Klipper
|
||||
## Installation
|
||||
The following commands will clone Klipper to an appropriate directory in HOME and run the setup script.
|
||||
At first we have to install some OS dependencies:
|
||||
```bash
|
||||
sudo apt install virtualenv python-dev libffi-dev build-essential libncurses-dev libusb-dev avrdude gcc-avr binutils-avr avr-libc stm32flash dfu-util libnewlib-arm-none-eabi gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0
|
||||
```
|
||||
|
||||
The following commands will clone Klipper to an appropriate directory in HOME.
|
||||
```bash
|
||||
cd ~
|
||||
git clone https://github.com/KevinOConnor/klipper
|
||||
cd ~/klipper
|
||||
./scripts/install-octopi.sh
|
||||
```
|
||||
|
||||
## Configuration
|
||||
After Klipper is installed, you will need to change the default location of the printer.cfg and add the UDS (unix domain socket). This is defined in the file `/etc/default/klipper`
|
||||
Then we can initialize the python virtual environment and install the python dependencies:
|
||||
```bash
|
||||
cd ~
|
||||
virtualenv -p python2 ./klippy-env
|
||||
./klippy-env/bin/pip install -r ./klipper/scripts/klippy-requirements.txt
|
||||
```
|
||||
|
||||
## Configuration & startup service
|
||||
After Klipper is installed, you will need to create a startup script to define log, config & UDS service location:
|
||||
|
||||
To edit this file type:
|
||||
```bash
|
||||
sudo nano /etc/default/klipper
|
||||
sudo nano /etc/systemd/system/klipper.service
|
||||
```
|
||||
|
||||
find the following line:
|
||||
```
|
||||
KLIPPY_ARGS="/home/pi/klipper/klippy/klippy.py /home/pi/printer.cfg -l /tmp/klippy.log"
|
||||
```
|
||||
and change the config location to `/home/pi/klipper_config/printer.cfg` and add `-a /tmp/klippy_uds` to define UDS.
|
||||
```
|
||||
KLIPPY_ARGS="/home/pi/klipper/klippy/klippy.py /home/pi/klipper_config/printer.cfg -l /tmp/klippy.log -a /tmp/klippy_uds"
|
||||
fill in these lines:
|
||||
```yaml
|
||||
#Systemd Klipper Service
|
||||
|
||||
[Unit]
|
||||
Description=Starts Klipper and provides klippy Unix Domain Socket API
|
||||
Documentation=https://www.klipper3d.org/
|
||||
After=network.target
|
||||
Before=moonraker.service
|
||||
Wants=udev.target
|
||||
|
||||
[Install]
|
||||
Alias=klippy
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
Environment=KLIPPER_CONFIG=/home/pi/klipper_config/printer.cfg
|
||||
Environment=KLIPPER_LOG=/home/pi/klipper_logs/klippy.log
|
||||
Environment=KLIPPER_SOCKET=/tmp/klippy_uds
|
||||
Type=simple
|
||||
User=pi
|
||||
RemainAfterExit=yes
|
||||
ExecStart= /home/pi/klippy-env/bin/python /home/pi/klipper/klippy/klippy.py ${KLIPPER_CONFIG} -l ${KLIPPER_LOG} -a ${KLIPPER_SOCKET}
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
```
|
||||
Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
|
||||
You have to create the directories for your klipper configuration and the virtual_sdcard directory:
|
||||
**Please check and modify the username!**
|
||||
If you do not use the user `pi`, you must replace it in each path and in the variable user in the service file.
|
||||
{: .warning }
|
||||
|
||||
To enable and start the Klipper service execute these commands:
|
||||
```bash
|
||||
sudo systemctl enable klipper.service
|
||||
```
|
||||
|
||||
You have to create the directories for your klipper configuration, logs and the virtual_sdcard directory:
|
||||
|
||||
```bash
|
||||
mkdir ~/klipper_config
|
||||
mkdir ~/klipper_logs
|
||||
mkdir ~/gcode_files
|
||||
touch ~/klipper_config/printer.cfg
|
||||
```
|
||||
|
||||
Move your printer.cfg to ~/klipper_config and check if the following entries are present in the config.
|
||||
```ini
|
||||
[virtual_sdcard]
|
||||
# for gcode upload
|
||||
path: ~/gcode_files
|
||||
|
||||
[display_status]
|
||||
# for display messages in status panel
|
||||
|
||||
[pause_resume]
|
||||
# for pause/resume functionality.
|
||||
# Mainsail needs gcode macros for `PAUSE`, `RESUME` and `CANCEL_PRINT` to make the buttons work.
|
||||
```
|
||||
**These entries are very important.**
|
||||
For the full functionality of mainsail, you should also define gcode macros for `PAUSE`, `RESUME` and `CANCEL_PRINT`. You'll find further information in [this](../../necessary-cfg.md){: target="_blank"} document.
|
||||
{: .info }
|
||||
|
||||
After your config is in place, restart klipper with `sudo service klipper restart`. Check the `/tmp/klippy.log` for errors, if Klipper starts correctly you can continue the guide.
|
||||
After your config is in place, restart klipper with `sudo systemctl start klipper`.
|
||||
|
||||
---
|
||||
[< previous step](operating-system.md){: .btn } [next step >](moonraker.md){: .btn}
|
||||
@@ -31,16 +31,29 @@ Each file can be filled with the following content:
|
||||
# /etc/nginx/conf.d/upstreams.conf
|
||||
|
||||
upstream apiserver {
|
||||
#if you need to change your api port, edit it here
|
||||
ip_hash;
|
||||
server 127.0.0.1:7125;
|
||||
}
|
||||
|
||||
upstream mjpgstreamer {
|
||||
#if you need to change your webcam port, edit it here
|
||||
upstream mjpgstreamer1 {
|
||||
ip_hash;
|
||||
server 127.0.0.1:8080;
|
||||
}
|
||||
|
||||
upstream mjpgstreamer2 {
|
||||
ip_hash;
|
||||
server 127.0.0.1:8081;
|
||||
}
|
||||
|
||||
upstream mjpgstreamer3 {
|
||||
ip_hash;
|
||||
server 127.0.0.1:8082;
|
||||
}
|
||||
|
||||
upstream mjpgstreamer4 {
|
||||
ip_hash;
|
||||
server 127.0.0.1:8083;
|
||||
}
|
||||
```
|
||||
Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
|
||||
@@ -64,12 +77,11 @@ Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
access_log /var/log/nginx/mainsail-access.log;
|
||||
error_log /var/log/nginx/mainsail-error.log;
|
||||
|
||||
#disable this section on smaller hardware like a pi zero
|
||||
# disable this section on smaller hardware like a pi zero
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
@@ -77,21 +89,24 @@ server {
|
||||
gzip_comp_level 4;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml;
|
||||
gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript application/json application/xml;
|
||||
|
||||
#web_path from mainsail static files
|
||||
# web_path from mainsail static files
|
||||
root /home/pi/mainsail;
|
||||
|
||||
index index.html;
|
||||
server_name _;
|
||||
|
||||
#disable max upload size
|
||||
# disable max upload size checks
|
||||
client_max_body_size 0;
|
||||
|
||||
# disable proxy request buffering
|
||||
proxy_request_buffering off;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||||
}
|
||||
@@ -114,9 +129,21 @@ server {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
}
|
||||
|
||||
|
||||
location /webcam/ {
|
||||
proxy_pass http://mjpgstreamer/;
|
||||
proxy_pass http://mjpgstreamer1/;
|
||||
}
|
||||
|
||||
location /webcam2/ {
|
||||
proxy_pass http://mjpgstreamer2/;
|
||||
}
|
||||
|
||||
location /webcam3/ {
|
||||
proxy_pass http://mjpgstreamer3/;
|
||||
}
|
||||
|
||||
location /webcam4/ {
|
||||
proxy_pass http://mjpgstreamer4/;
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -128,13 +155,13 @@ Create directory for static files and active nginx config:
|
||||
mkdir ~/mainsail
|
||||
sudo rm /etc/nginx/sites-enabled/default
|
||||
sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/
|
||||
sudo service nginx restart
|
||||
sudo systemctl restart nginx
|
||||
```
|
||||
|
||||
Now you can check again the API if it works with the reverse proxy. Open the url http://\<printer-ip\>/printer/info in your browser. if you see a content like this:
|
||||
|
||||
```
|
||||
{"result": {"hostname": "voron250", "error_detected": false, "version": "v0.8.0-479-gd586fb06", "is_ready": true, "message": "Printer is ready", "cpu": "4 core ARMv7 Processor rev 4 (v7l)"}}
|
||||
{"result": {"state_message": "Printer is ready", "klipper_path": "/home/pi/klipper", "config_file": "/home/pi/klipper_config/printer.cfg", "software_version": "v0.9.1-785-g1be19177", "hostname": "raspberrypi", "cpu_info": "4 core ARMv7 Processor rev 4 (v7l)", "state": "ready", "python_path": "/home/pi/klippy-env/bin/python", "log_file": "/home/pi/klipper_log/klippy.log"}}
|
||||
```
|
||||
|
||||
Now we can install Mainsail (static httpdocs).
|
||||
|
||||
@@ -10,16 +10,22 @@ permalink: /setup/manual-setup/moonraker
|
||||
Moonraker is a web server that exposes APIs which lets Mainsail interact with Klipper.
|
||||
|
||||
## Installation
|
||||
At first we have to install some OS dependencies:
|
||||
```bash
|
||||
sudo apt install python3-virtualenv python3-dev libopenjp2-7 python3-libgpiod curl libcurl4-openssl-dev libssl-dev liblmdb0 libsodium-dev zlib1g-dev
|
||||
```
|
||||
|
||||
Clone Moonraker into your HOME directory:
|
||||
```bash
|
||||
cd ~
|
||||
git clone https://github.com/Arksine/moonraker.git
|
||||
```
|
||||
|
||||
Run Moonrakers install script:
|
||||
Then we can initialize the python virtual environment and install the python dependencies:
|
||||
```bash
|
||||
cd ~/moonraker/scripts
|
||||
./install-moonraker.sh -c /home/pi/klipper_config/moonraker.conf
|
||||
cd ~
|
||||
virtualenv -p python3 ./moonraker-env
|
||||
./moonraker-env/bin/pip install -r ./moonraker/scripts/moonraker-requirements.txt
|
||||
```
|
||||
|
||||
## Configuration
|
||||
@@ -31,32 +37,49 @@ For Moonraker you'll need to create a separate config file.
|
||||
|
||||
`nano ~/klipper_config/moonraker.conf`
|
||||
|
||||
Insert the following part and modify `trusted_clients` according to arksines description below.
|
||||
Also consider further IP ranges, e.g. when connecting via VPN. To determine your local ip `ip a` and `ifconfig -a` are common ways to do so on Linux and `ipconfig` on Windows.
|
||||
|
||||
**This is a very basic config**
|
||||
For more options and detailed explanations you should follow [arksines instructions](https://github.com/Arksine/moonraker/blob/master/docs/installation.md).
|
||||
{: .info }
|
||||
|
||||
Insert the following part:
|
||||
```
|
||||
[server]
|
||||
host: 0.0.0.0
|
||||
port: 7125
|
||||
enable_debug_logging: False
|
||||
config_path: ~/klipper_config
|
||||
log_path: ~/klipper_logs
|
||||
|
||||
[authorization]
|
||||
enabled: true
|
||||
cors_domains:
|
||||
https://my.mainsail.xyz
|
||||
http://my.mainsail.xyz
|
||||
http://*.local
|
||||
http://*.lan
|
||||
trusted_clients:
|
||||
192.168.1.0/24
|
||||
2a02:810d:9340:33f6::/64
|
||||
10.0.0.0/8
|
||||
127.0.0.0/8
|
||||
169.254.0.0/16
|
||||
172.16.0.0/12
|
||||
192.168.0.0/16
|
||||
FE80::/10
|
||||
::1/128
|
||||
|
||||
# enables partial support of Octoprint API
|
||||
[octoprint_compat]
|
||||
|
||||
# enables moonraker to track and store print history.
|
||||
[history]
|
||||
|
||||
# this enables moonraker's update manager
|
||||
[update_manager]
|
||||
|
||||
[update_manager client mainsail]
|
||||
[update_manager mainsail]
|
||||
type: web
|
||||
repo: meteyou/mainsail
|
||||
path: ~/mainsail
|
||||
```
|
||||
|
||||
**This is a very basic config**
|
||||
For more options and detailed explanations you should follow [arksines instructions](https://github.com/Arksine/moonraker/blob/master/docs/installation.md).
|
||||
{: .info }
|
||||
|
||||
🔥 **trusted_clients - read carefully** 🔥
|
||||
A list of newline separated ip addresses and/or ip ranges that are
|
||||
trusted. Trusted clients are given full access to the API. Both IPv4
|
||||
@@ -70,11 +93,47 @@ trusted.
|
||||
|
||||
Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
|
||||
Restart Moonraker
|
||||
## Startup service
|
||||
To edit this file type:
|
||||
```bash
|
||||
sudo service moonraker restart
|
||||
sudo nano /etc/systemd/system/moonraker.service
|
||||
```
|
||||
|
||||
fill in these lines:
|
||||
```yaml
|
||||
#Systemd moonraker Service
|
||||
|
||||
[Unit]
|
||||
Description=Moonraker provides Web API for klipper
|
||||
Documentation=https://moonraker.readthedocs.io/en/latest/
|
||||
After=network.target klipper.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
Environment=MOONRAKER_CONFIG=/home/pi/klipper_config/moonraker.conf
|
||||
Environment=MOONRAKER_LOG=/home/pi/klipper_logs/moonraker.log
|
||||
Type=simple
|
||||
User=pi
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/home/pi/moonraker-env/bin/python /home/pi/moonraker/moonraker/moonraker.py -c ${MOONRAKER_CONFIG} -l ${MOONRAKER_LOG}
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
```
|
||||
Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
|
||||
**Please check and modify the username!**
|
||||
If you do not use the user `pi`, you must replace it in each path and in the variable user in the service file.
|
||||
{: .warning }
|
||||
|
||||
To enable Moonraker service execute these commands:
|
||||
```bash
|
||||
sudo systemctl enable moonraker.service
|
||||
```
|
||||
|
||||
After your config is in place, start Moonraker with `sudo systemctl start moonraker`.
|
||||
|
||||
Open the following url with your printers IP in your browser
|
||||
```
|
||||
http://<printer-ip>:7125/printer/info
|
||||
@@ -82,7 +141,7 @@ http://<printer-ip>:7125/printer/info
|
||||
|
||||
If everything has been set up successfully, a message like this should appear:
|
||||
```
|
||||
{"result": {"hostname": "voron250", "error_detected": false, "version": "v0.8.0-643-g528f9f25", "is_ready": true, "message": "Printer is ready", "cpu": "4 core ARMv7 Processor rev 4 (v7l)"}}
|
||||
{"result": {"state_message": "Printer is ready", "klipper_path": "/home/pi/klipper", "config_file": "/home/pi/klipper_config/printer.cfg", "software_version": "v0.9.1-785-g1be19177", "hostname": "raspberrypi", "cpu_info": "4 core ARMv7 Processor rev 4 (v7l)", "state": "ready", "python_path": "/home/pi/klippy-env/bin/python", "log_file": "/home/pi/klipper_log/klippy.log"}}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -28,7 +28,7 @@ Once you have finished the installation and are connected via SSH, you can conti
|
||||
Install the required packages and update the system:
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade
|
||||
sudo apt update --allow-releaseinfo-change && sudo apt upgrade
|
||||
sudo apt install git dfu-util unzip
|
||||
```
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Restart Klipper (`sudo service klipper restart`) and check the `klippy.log`, if
|
||||
correctly and then continue the guide.
|
||||
|
||||
### Klipper config changes
|
||||
If you have issues after update your Klipper instance, you can check config changes [here](https://github.com/KevinOConnor/klipper/blob/master/docs/Config_Changes.md).
|
||||
If you have issues after update your Klipper instance, you can check config changes [here](https://www.klipper3d.org/Config_Changes.html){:target="_blank"}.
|
||||
|
||||
---
|
||||
[< table of contents](index.md){: .btn } [next step >](moonraker.md){: .btn}
|
||||
@@ -14,12 +14,6 @@ rm -R ./*
|
||||
wget -q -O mainsail.zip https://github.com/meteyou/mainsail/releases/latest/download/mainsail.zip && unzip mainsail.zip && rm mainsail.zip
|
||||
```
|
||||
|
||||
### Move gui.json from gcodes to klipper_config
|
||||
This is only necessary if you update from 0.2.2 to 0.2.3 or higher. If you use MainsailOS, the virtual_sdcard directory is `gcode_files` instead of `sdcard`.
|
||||
```
|
||||
mv ~/sdcard/gui.json ~/klipper_config/
|
||||
```
|
||||
|
||||
Now it should be possible to open the interface: `http://<printer-ip>/`.
|
||||
|
||||
---
|
||||
|
||||
@@ -20,13 +20,6 @@ If you see a content like this
|
||||
{"result": {"hostname": "voron250", "error_detected": false, "version": "v0.8.0-643-g528f9f25", "is_ready": true, "message": "Printer is ready", "cpu": "4 core ARMv7 Processor rev 4 (v7l)"}}
|
||||
```
|
||||
|
||||
### Change Moonraker to systemd service (December 6th 2020)
|
||||
Moonraker is now installed as a systemd service. If `moonraker.conf` is not located in the home directory, the command will looks something like the following:
|
||||
```bash
|
||||
~/moonraker/scripts/install-moonraker.sh -f -c /home/pi/klipper_config/moonraker.conf
|
||||
```
|
||||
This allows logging to stdout which can be viewed with the `journalctl -u moonraker command`.
|
||||
|
||||
### Update Moonraker dependence
|
||||
This is only nessasary, if you see missing modules in the moonraker log.
|
||||
```bash
|
||||
@@ -34,7 +27,7 @@ This is only nessasary, if you see missing modules in the moonraker log.
|
||||
```
|
||||
|
||||
### Moonraker config changes
|
||||
If you have issues after update your Moonraker instance, you can check config changes [here](https://github.com/Arksine/moonraker/blob/master/docs/user_changes.md).
|
||||
If you have issues after update your Moonraker instance, you can check config changes [here](https://moonraker.readthedocs.io/en/latest/user_changes/){:target="_blank"}.
|
||||
|
||||
---
|
||||
[< previous step](klipper.md){: .btn } [next step >](mainsail.md){: .btn }
|
||||
Reference in new issue
Block a user