Skip to content

Instantly share code, notes, and snippets.

View Paraphraser's full-sized avatar

Phill Paraphraser

  • Cootamundra NSW Australia
View GitHub Profile
@Paraphraser
Paraphraser / IOTstackPullRequest.md
Last active January 28, 2023 17:26
Preparing IOTstack Pull Requests

Preparing a Pull Request for IOTstack

If you want to fix a bug or propose an enhancement for IOTstack, you will need to prepare a Pull Request (PR).

Please don't try to do anything in this gist inside an ~/IOTstack folder on a Raspberry Pi that is also being used to run your Docker containers. It's easy to get confused and you could accidentally break your own working IOTstack.

You can do everything on the same Raspberry Pi that is running your IOTstack but it's usually easier to work on a desktop or laptop. If you accept this advice, there's no risk of breaking your running IOTstack.

This guide barely scratches the surface of Pull Requests. There is lots of advice on GitHub and Google will find plenty of hits for any question you might have.

@Paraphraser
Paraphraser / IOTstack tutorial - local reversion.md
Created December 12, 2022 23:42
IOTstack tutorial : local image reversion

IOTstack tutorial : local image reversion

One of the main advantages of running services in Docker containers is the relative ease of reverting to the last-known-good container.

One of the biggest problems with reverting to the last-known-good container arises if you don't already know the tag of the image you want to revert to. Sometimes it can be a bit tricky to figure it out. You usually need to go to the container's "tags" page on DockerHub, sort through the update history for your architecture, pick the appropriate tag, edit your compose file to specify that tag, and then, in the words of the old Knight in the third Indiana Jones movie, hope that you have "chosen wisely".

Your chances of choosing wisely are inversely proportional to the amount of panic you're feeling after you realise a key container isn't working and reverting is your best strategy. Panic is the enemy of clear thinking and reasoning.

There is, however, another way. The method described here means you retain the last-known-

@Paraphraser
Paraphraser / Using the PiHole container as your container DNS.md
Last active December 24, 2022 03:15
IOTstack - Using the PiHole container as your container DNS

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 / 999058924152033470.md
Last active December 24, 2022 03:14
PiBuilder + Windows: Discord question

PiBuilder + Windows: Discord question

Question 1

I tried to build a new installation using PiBuilder. I am a Windows user and connect with a terminal emulator (Putty) to the Pi. So far I was not successful. I tried to follow the description. But Windows only mounts the boot partition. The rest of the SD card is not visible to the OS. So I struggle with the step of configuring PiBuilder and also the many steps just to connect to a Pi using SSH.

Answer

macOS is the same as Windows - it can only mount the boot partition. That's why I put all the files on the boot partition. It's the easiest way of getting everything onto the Pi.

@Paraphraser
Paraphraser / InfluxDB security under IOTstack.md
Last active December 24, 2022 02:45
Enabling authentication in InfluxDB for SensorsIot/IOTstack

Tutorial: Enabling authentication in InfluxDB

Assumptions:

  • you are running SensorsIot/IOTstack with InfluxDB as one of the containers
  • you want to enable authentication for your InfluxDB databases.

Note: This tutorial is specific to SensorsIot/IOTstack.

Definition:

@Paraphraser
Paraphraser / Node-Red IOTstack hints.md
Last active December 24, 2022 02:35
Hints: Running Node-Red in IOTstack
@Paraphraser
Paraphraser / TimeMachineRestoreFilesOwnedByRoot.md
Last active December 24, 2022 00:50
macOS Time Machine: restoring files owned by root

macOS Time Machine: restoring files owned by root

when you own the file …

On macOS, Time Machine pretty much just works. You delete or mutilate a file. Then you realise you want to get back to the older version so you:

  1. Use the Finder to open the folder containing the file you want to restore.
  2. Choose "Enter Time Machine" from the Time Machine menu.
  3. Step back in the timeline until you find the version you want to restore.
@Paraphraser
Paraphraser / IOTstack + InfluxDB 2 experiments.md
Last active December 24, 2022 00:47
IOTstack: InfluxDB 2 experiments

IOTstack: InfluxDB 2 experiments

Update #1:

  • Rewrite assuming user only has a single Raspberry Pi which is processing live data. Minimises the down time for InfluxDB 1.8.

This gist explains the steps I followed to:

@Paraphraser
Paraphraser / InfluxDB-data-merging.md
Created November 29, 2022 05:36
IOTstack tutorial: InfluxDB data merging

IOTstack tutorial: InfluxDB data merging

Scenario

A question on Discord described a situation where a new (empty) database had been created. That database contained data acquired since the rebuild but had no historical data prior to the rebuild. However, the person did have a "portable" backup of the older data and wanted to know if it was possible to merge the backup with the live data?

The answer is "yes". Merging measurements will solve this particular problem.

My test environment

@Paraphraser
Paraphraser / ComposeProfiles.md
Created October 18, 2022 05:00
Understanding compose profiles

IOTstack: Understanding compose profiles

You are probably familiar with running a command like:

$ docker-compose up -d

You probably expect that command to bring up a container for every service definition mentioned in your docker-compose.yml. That's its default behaviour.