From aba5bdf339054e1cc1cae83ded6e48a4b62ae56e Mon Sep 17 00:00:00 2001 From: Arksine Date: Sat, 5 Dec 2020 17:21:29 -0500 Subject: [PATCH] docs: add clarification This clarifies the installation and configuration instructions, updating some outdated info. Also added is a sample moonraker.conf file. Signed-off-by: Eric Callahan --- docs/configuration.md | 39 ++++++++++++++++++++++++++----- docs/installation.md | 53 +++++++++++++++++++++++++++++++++---------- docs/moonraker.conf | 15 ++++++++++++ 3 files changed, 89 insertions(+), 18 deletions(-) create mode 100644 docs/moonraker.conf diff --git a/docs/configuration.md b/docs/configuration.md index 0d98ac0..2093d56 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1,9 +1,14 @@ -This document describes Moonraker's full configuration. +This document describes Moonraker's full configuration. As this file +references configuration for both Klipper (printer.cfg) and Moonraker +(moonraker.conf), each example contains a commment indicating which +configuration file is being refrenenced. # Primary Configuration The sections outlined here are required for Moonraker to function. A minimal functional configuration might look like the following: ``` +# moonraker.conf + [server] host: 0.0.0.0 port: 7125 @@ -19,6 +24,8 @@ trusted_clients: ## server ``` +# moonraker.conf + [server] host: 0.0.0.0 # The host address in which to bind the HTTP server. Default is to bind @@ -34,15 +41,21 @@ enable_debug_logging: True # When set to True Moonraker will log in verbose mode. During this stage # of development the default is True. In the future this will change. config_path: -# An optional path where configuration files are located. If specified, -# Moonraker will serve this path allowing file and directory manipulation -# within it. This path must be located within the user's HOME directory, -# by may not be the home directory itself. The default is no path, which -# results in no configuration files being served. +# The path to a directory where configuration files are located. This +# directory may contain Klipper config files (printer.cfg) or Moonraker +# config files (moonraker.conf). Clients may also write their own config +# files to this directory. This path must be located within the user's +# HOME directory, but may not be the home directory itself. When this +# option is set the contents of the directory will be served to connected +# clients, allowing them to modify the various configuration files. NOTE: +# If the config_path is not set, clients will not be able to save their +# UI configuration to disk. ``` ## authorization ``` +# moonraker.conf + [authorization] enabled: True # Enables authorization. When set to true, requests must either contain @@ -79,6 +92,8 @@ converter. Currently PanelDue Firmware Version 1.24 is supported. Other releases may not behave correctly. ``` +# moonraker.conf + [paneldue] serial: # The serial port in which the PanelDue is connected. This parameter @@ -111,6 +126,8 @@ in the PanelDue's "macro" menu. Note that buzzing the piezo requires the following gcode_macro in `printer.cfg`: ``` +# printer.cfg + [gcode_macro PANELDUE_BEEP] # Beep frequency default_parameter_FREQUENCY: 300 @@ -127,6 +144,8 @@ Enables device power control. Currently GPIO (relays), TPLink Smartplug, and Tasmota (via http) devices are supported. ``` +# moonraker.conf + [power device_name] type: gpio # The type of device. Can be either gpio, tplink_smartplug or tasmota. @@ -161,6 +180,8 @@ output_id: ``` Below are some potential examples: ``` +# moonraker.conf + [power printer] type: gpio pin: gpio26 @@ -182,6 +203,8 @@ password: password1 It is possible to toggle device power from the Klippy host, this can be done with a gcode_macro, such as: ``` +# printer.cfg + [gcode_macro POWER_OFF_PRINTER] gcode: {action_call_remote_method("set_device_power", @@ -192,6 +215,8 @@ The `POWER_OFF_PRINTER` gcode can be run to turn off the "printer" device. This could be used in conjunction with Klipper's idle timeout to turn the printer off when idle with a configuration similar to that of below: ``` +# printer.cfg + [delayed_gcode delayed_printer_off] initial_duration: 0. gcode: @@ -212,6 +237,8 @@ performed on pristine git repos. Repos that have been modified on disk or cloned from unofficial sources are not supported. ``` +# moonraker.conf + [update_manager] client_repo: # This is the GitHub repo of the client, in the format of user/client. diff --git a/docs/installation.md b/docs/installation.md index 6b0320b..0496c67 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -8,7 +8,8 @@ Python 3 packages meet this requirement. Klipper should be installed prior to installing Moonraker. Please see [Klipper's Documention](https://github.com/KevinOConnor/klipper/blob/master/docs/Installation.md) -for instructions on how to do this. +for instructions on how to do this. After installation you should make +sure that the [prerequistes](#prerequisites-klipper-configuration) are configured. After Klipper is installed, you need to modify its "default" file. This file contains klipper's command line arguments, and you must add an argument that @@ -38,8 +39,27 @@ KLIPPY_EXEC=/home/pi/klippy-env/bin/python KLIPPY_ARGS="/home/pi/klipper/klippy/klippy.py /home/pi/printer.cfg -l /tmp/klippy.log -a /tmp/klippy_uds" ``` You may also want to take this opportunity to change the location of -printer.cfg if you enable Moonraker's "config_path" option (see the -[configuration section](#moonraker-configuration-moonrakerconf) for more information). +printer.cfg to match Moonraker's "config_path" option (see the +[configuration document](configuration.md#primary-configuration) +for more information on the config_path). For example, if the `config_path` +option is set to `~/printer_config`, your klipper defaults file might look +like the following: +``` +# Configuration for /etc/init.d/klipper + +KLIPPY_USER=pi + +KLIPPY_EXEC=/home/pi/klippy-env/bin/python + +KLIPPY_ARGS="/home/pi/klipper/klippy/klippy.py /home/pi/printer_config/printer.cfg -l /tmp/klippy.log -a /tmp/klippy_uds" +``` + +If necessary, create the config directory and move printer.cfg to it: +``` +cd ~ +mkdir printer_config +mv printer.cfg printer_config +``` You can now install the Moonraker application: ``` @@ -47,12 +67,24 @@ cd ~ git clone https://github.com/Arksine/moonraker.git ``` -Finally, run moonraker's install script: +Prior to installation it is a good idea to create +[moonraker.conf](configuration.md). If you are using the `config_path`, +create it in the specified directory otherwise create it in the HOME +directory. A sample `moonraker.conf` may be found in the `docs` folder +of this repo. + +For a default installation run the following commands: ``` cd ~/moonraker/scripts ./install-moonraker.sh ``` +Or to install with `moonraker.conf` in the `config_path`: +``` +cd ~/moonraker/scripts +./install-moonraker.sh -f -c /home/pi/printer_config/moonraker.conf +``` + The install script has a few command line options that may be useful, particularly for those upgrading: - -r\ @@ -64,18 +96,15 @@ particularly for those upgrading: detected as present. - -c /path/to/moonraker.conf\ This allows the user to specify the path to Moonraker's config file. - The default location is "/home//moonraker.conf". + The default location is `/home//moonraker.conf`. When the script completes it should start both Moonraker and Klipper. In `klippy.log` you should find the following entry:\ -`webhooks: New connection established` +`webhooks client : Client info {'program': 'Moonraker', 'version': ''}`\ -Now you may install a client, such as [Mainsail]( -https://github.com/meteyou/mainsail). -- Note that as of the time of this writing (August 11 2020) the current version - of Mainsail (0.1.2) is not compatible with this repo. Please give the - developer some time to bring up Mainsail in line with the latest release - of Moonraker. +Now you may install a client, such as +[Mainsail](https://github.com/meteyou/mainsail) or +[Fluidd](https://github.com/cadriel/fluidd) ## Command line Usage The configuration and log file paths may be specified via the command diff --git a/docs/moonraker.conf b/docs/moonraker.conf new file mode 100644 index 0000000..9fef94d --- /dev/null +++ b/docs/moonraker.conf @@ -0,0 +1,15 @@ +# Sample Moonraker Configuration File + +[server] +# Bind server defaults of 0.0.0.0, port 7125 +enable_debug_logging: True +config_path: ~/printer_config + +[authorization] +enabled: True +trusted_clients: +# Enter your client IP here or range here + 192.168.1.0/24 +cors_domains: +# Allow CORS requests for Fluidd + http://app.fluidd.xyz