Skip to content

Commit

Permalink
✨ added octoprint application
Browse files Browse the repository at this point in the history
  • Loading branch information
HitLuca committed Jul 23, 2022
1 parent a779915 commit abd58ee
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Netdata](https://my-netdata.io/) - An extremely comprehensive system monitoring solution
* [Nextcloud](https://nextcloud.com/) - A self-hosted Dropbox alternative
* [NZBget](https://nzbget.net/) - The most efficient usenet downloader
* [Octoprint](https://octoprint.org/) - Control and monitor your 3D printer
* [Ombi](https://ombi.io/) - web application that automatically gives your users the ability to request content
* [Organizr](https://organizr.app/) - ORGANIZR aims to be your one stop shop for your Servers Frontend.
* [openHAB](https://www.openhab.org/) - A vendor and technology agnostic open source automation software for your home
Expand Down
11 changes: 11 additions & 0 deletions docs/applications/octoprint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Octoprint

Homepage: [https://octoprint.org/](https://octoprint.org/)

Octoprint is a control and monitoring application for your 3D printer. You can start and stop print jobs, view your webcam feed, move the print head and extruder manually and check your gcode files, all from a single web interface. Octoprint doesn't require modifications on the printer firmware, just make sure your NAS is phisically connected to it with a usb cable.

## Usage

Connect the printer to your NAS, and take note of where the serial interface is mounted (usually it's automounted in `/dev/ttyUSB0`). Set `octoprint_enabled: true` in your `inventories/<your_inventory>/nas.yml` file, as well as the `octoprint_printer_mountpoint` variable if your printer doesn't mount to the default location.

If you want to also have a webcam feed, attach one to your NAS and take note of its mountpoint as well (usually `/dev/video0`). Set `octoprint_enable_webcam: true` and add a `octoprint_webcam_mountpoint` variable if the webcam doesn't mount to the default location.
5 changes: 5 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@
- nzbget
when: (nzbget_enabled | default(False))

- role: octoprint
tags:
- octoprint
when: (octoprint_enabled | default(False))

- role: organizr
tags:
- organizr
Expand Down
19 changes: 19 additions & 0 deletions roles/octoprint/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
octoprint_enabled: false
octoprint_available_externally: false

# directories
octoprint_data_directory: "{{ docker_home }}/octoprint"

# network
octoprint_port: "8095"
octoprint_hostname: "octoprint"

# devices
octoprint_printer_mountpoint: "/dev/ttyUSB0"

octoprint_enable_webcam: false
octoprint_webcam_mountpoint: "/dev/video0"

# specs
octoprint_memory: 1g
33 changes: 33 additions & 0 deletions roles/octoprint/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
- name: Create Octoprint Directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ octoprint_data_directory }}"

- name: Octoprint Docker Container
docker_container:
name: octoprint
image: octoprint/octoprint
pull: true
volumes:
- "{{ octoprint_data_directory }}:/octoprint:rw"
ports:
- "{{ octoprint_port }}:80"
devices:
- "{{ octoprint_printer_mountpoint }}"
- "{{ octoprint_enable_webcam | ternary(octoprint_webcam_mountpoint, '/dev/null') }}"
restart_policy: unless-stopped
memory: "{{ octoprint_memory }}"
env:
TZ: "{{ ansible_nas_timezone }}"
MJPG_STREAMER_INPUT: "-n -r 1080x1024 -f 30"
ENABLE_MJPG_STREAMER: "true"
labels:
traefik.enable: "{{ octoprint_available_externally | string }}"
traefik.http.routers.octoprint.rule: "Host(`{{ octoprint_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.octoprint.tls.certresolver: "letsencrypt"
traefik.http.routers.octoprint.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.octoprint.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.octoprint.loadbalancer.server.port: "80"

0 comments on commit abd58ee

Please sign in to comment.