Skip to content

Instantly share code, notes, and snippets.

Avatar

Phill Paraphraser

  • Cootamundra NSW Australia
View GitHub Profile
@Paraphraser
Paraphraser / Docker+OctoPrint - When your 3D printer turns on and off.md
Created May 6, 2021
IOTstack+OctoPrint: When your 3D printer turns on and off
View Docker+OctoPrint - When your 3D printer turns on and off.md

IOTstack+OctoPrint: When your 3D printer turns on and off

The README.md at OctoPrint/octoprint-docker on GitHub contains the statement:

… we know that OctoPrint is not the best suited type of application for containerization, but we're working hard to make it as compatible as possible.

There is no elaboration on why OctoPrint is not "best suited" but it may have something to do with what happens when OctoPrint is running in a container and the 3D printer it is controlling is turned off: the container crashes and the service disappears.

Similarly, any attempt to bring up the OctoPrint service before the 3D printer has been switched on results in docker-compose refusing the jump because it can't satisfy the device mapping.

@Paraphraser
Paraphraser / Using the PiHole container as your container DNS.md
Last active May 4, 2021
IOTstack - Using the PiHole container as your container DNS
View Using the PiHole container as your container DNS.md

IOTstack - Using the PiHole container as your container DNS

First, a small bit of editorialising (my gist, my rules). PiHole is an excellent ad-blocker. It's perfectly OK for just about every other device on your home network to use PiHole as its primary DNS.

The one device in your network that shouldn't use PiHole-in-a-container for its DNS is the Raspberry Pi running PiHole in a Docker container. I'll go so far as to describe it as a seriously dumb idea.

Why? Several reasons:

  • Containers start quite late in the boot cycle. Any process starting before Docker that depends on the DNS being "there" can be disappointed. PiHole being late to the party and occasionally disappearing when you do perfectly ordinary things like…
  • … Taking down your stack can trigger resolver failover conditions which don't always recover gracefully. You might think your DNS setup is working just fine with the PiHole container in the prime role but then it all turns to custard and you don't know why.
@Paraphraser
Paraphraser / IOTstackNextCloud.md
Last active Apr 27, 2021
Getting Nextcloud to work under IOTstack
View IOTstackNextCloud.md

Getting Nextcloud to work under IOTstack

docker-compose.yml fragment

This is a docker-compose.yml that works on my Raspberry Pi 4B. Either use it as-is or copy everything except the first four lines to the clipboard, then paste them into your existing docker-compose.yml, replacing any previous definitions for "nextcloud" and "nextcloud_db".

version: '3.6'

services:
@Paraphraser
Paraphraser / Mount Raspberry Pi home directory on your Mac.md
Created Mar 8, 2021
Using SSHFS to mount your Raspberry Pi's home directory on your Mac
View Mount Raspberry Pi home directory on your Mac.md

Using SSHFS to mount your Raspberry Pi's home directory on your Mac

It is useful to be able to mount your Raspberry Pi's file system on your Mac's desktop. The Raspberry Pi is ready to rock-'n-roll but some work needs to be done on the Mac. This gist assumes macOS Mojave 10.14. Your mileage may vary on earlier or later versions.

Set up passwordless SSH (optional)

You can make your life quite a bit simpler if you set up SSH on your Mac so that it can login to your Raspberry Pi without needing a password. Follow this tutorial.

The tutorial assumes two Raspberry Pis but there is no difference in approach if you use a Mac and a Pi, or two Macs.

@Paraphraser
Paraphraser / IOTstack Wireguard - Quick and Dirty.md
Last active Mar 31, 2021
IOTstack tutorial: Quick and Dirty WireGuard
View IOTstack Wireguard - Quick and Dirty.md

IOTstack tutorial: Quick and Dirty WireGuard

Have you been tearing your hair out trying to get WireGuard to work under IOTstack? If so, you've (probably — hopefully) come to the right place.

This gist has been tested on both a Raspberry Pi 3B+ and 4B running Raspberry Pi OS (aka Raspbian). Your mileage may vary on other hardware or operating systems.


@Paraphraser
Paraphraser / Migrating IOTstack from gcgarner to SensorsIot.md
Last active Apr 8, 2021
Migrating IOTstack from gcgarner to SensorsIot
View Migrating IOTstack from gcgarner to SensorsIot.md

Migrating IOTstack from gcgarner to SensorsIot

These instructions explain how to migrate from gcgarner/IOTstack to SensorsIot/IOTstack.

Originally, there were clear instructions at the SensorsIot README but:

  1. They have become slightly mixed up with installation instructions; and
  2. No longer work "as is" because some conflicts have emerged.

The probability that conflicts will develop increases as a function of time since SensorsIot forked from gcgarner. Conflicts were and are pretty much inevitable.

@Paraphraser
Paraphraser / Tutorial - Debugging MQTT traffic flows in IOTstack.md
Last active Apr 19, 2021
Tutorial: Debugging MQTT traffic flows in IOTstack
View Tutorial - Debugging MQTT traffic flows in IOTstack.md

Tutorial: Debugging MQTT traffic flows in IOTstack

You have built an ESP32, ESP8266 or similar project. You are sure it is sending payloads via MQTT but the data doesn't seem to be arriving in Node-Red. You're at a bit of a loss as to what to do next.

This tutorial is specific to IOTstack where Mosquitto and Node-Red are running as Docker containers on a Raspberry Pi. Much of it is probably applicable to other environments but "your mileage may vary".

Related resources

@Paraphraser
Paraphraser / node-red-exec-node-ssh.md
Last active Mar 31, 2021
IOTstack tutorial: Executing commands outside the Node-Red container via SSH
View node-red-exec-node-ssh.md

IOTstack tutorial: Executing commands outside the Node-Red container

A reasonably common requirement in a Node-Red flow is the ability to execute a command on the host system. The standard tool for this is an "exec" node.

An "exec" node works as expected when Node-Red is running as a native service but not when Node-Red is running in a container. That's because the command is running inside the container.

To help you understand the difference, consider this command:

$ grep "^PRETTY_NAME=" /etc/os-release
@Paraphraser
Paraphraser / Mosquitto security under IOTstack.md
Last active Mar 31, 2021
Mosquitto password protection in IOTstack
View Mosquitto security under IOTstack.md

Mosquitto password protection in IOTstack

Setting up passwords for Mosquitto is a topic that comes up fairly frequently in GitHub issues and on the Discord channel, usually as a result of it not working as expected.

The purpose of this gist is to explain the how-to of password setup, as at Feb 16, 2021 when 2.0.7 was the "latest" version of Mosquitto.

Mosquitto underwent some changes between 1.6.x and 2.0, including how passwords were handled. See Migrating to Mosquitto 2.0.

Contents

@Paraphraser
Paraphraser / Reset_IOTstack_container.md
Last active Mar 27, 2021
Resetting IOTstack containers to "factory fresh" conditions
View Reset_IOTstack_container.md