Skip to content

Instantly share code, notes, and snippets.

View reubenmiller's full-sized avatar

Reuben Miller reubenmiller

  • Hamburg, Germany
View GitHub Profile
@reubenmiller
reubenmiller / README.md
Last active August 17, 2023 07:29
Download and build a ca-certificate store file using openssl

How to use

Option 1: Configure ca bundle (and download one if necessary) - No openssl required!

  1. Download the configure-ca-bundle.sh script (or either copy paste the contents and write to a file called ./configure-ca-bundle.sh)

  2. Make the script executable

chmod +x ./configure-ca-bundle.sh

@reubenmiller
reubenmiller / check-sysvinit-status.sh
Created August 8, 2023 05:43
Check a sysv init system to gather information about if tedge-agent can be run or not
#!/bin/sh
echo "------------ System info ------------"
uname -a
echo "sysvinit version: $(/sbin/init --version)"
echo
echo "----------- Checking setup -----------"
command -V service || echo "FAIL: service does not exist"
command -V start-stop-daemon || echo "WARN: start-stop-daemon does not exist, this is used by the service definitions currently"
@reubenmiller
reubenmiller / EDIT_MOSQUITTO_SYSTEMD_SERVICE.md
Last active July 17, 2023 13:56
How to edit mosquitto systemd service restart interval to fix dns resolution error on startup

Option 1: Override mosquitto systemd service

This solution relies on using systemd override functionality require allows additional settings to be applied to existing systemd configuration files without having to redefined the entire systemd service definition.

Editing the mosquitto systemd definition

  1. Edit the mosquitto service definition
@reubenmiller
reubenmiller / deploy.sh
Last active June 26, 2023 06:13
example refactored deploy.sh script
#!/bin/bash
set -e
info () { echo "INFO $*" >&2; }
error () { echo "ERROR $*" >&2; }
print_usage() {
echo "
Deploy a Cumulocity IoT microservice from a github release url
@reubenmiller
reubenmiller / example.sh
Created June 14, 2023 09:11
go-c8y-cli examples
c8y util repeat 3 | c8y devices create --template "{name: 'device_%04d' % input.index, uuid: _.Hex(24)}" --dry
c8y devices list --query "has(uuid)" | c8y identity create --template "{externalId: input.value.uuid, type: 'mytype'}" --dry
@reubenmiller
reubenmiller / README.md
Last active March 24, 2023 13:30
Add signedoff-by message to all git commits via a git hook

Getting started

Add the following signedoff-by git hook using the following steps:

  1. Create a new file (from above) and add it to the project's git folder .git/hooks/commit-msg
  2. Make the hook executable
chmod +x .git/hooks/commit-msg
@reubenmiller
reubenmiller / README.md
Last active March 8, 2023 13:04
POC: tedge pki interface

PKI Device certificate interface example

There is a script called tedge-cert.sh which can be used to managed the certificate used by thin-edge.

The device.id (which will be used as the Common Name in the certificate) will be controlled by an environment variable (for now). So before using the tedge-cert.sh script, the environment variable needs to be set. Ideally this is done when creating the docker environment, or alternatively a dummy certificate can be created us

Certificate Management Interface

The following commands are supported by the tedge-cert.sh script.

@reubenmiller
reubenmiller / bootstrap.sh
Last active March 2, 2023 17:39
thin-edge.io install/bootstrapping script
#!/bin/sh
set -e
# TODO:
# * Run stop_services if there is an actual update (e.g. check if apt-get will actually do something or not)
# * Look at using a nicer command console progresss bar: printf "\033c";
# * Sometimes restart some services is required to get everything to work, e.g.
# * systemctl restart tedge-mapper-c8y
# * systemctl restart tedge-agent
# * systemctl restart c8y-log-plugin
@reubenmiller
reubenmiller / README.md
Last active May 26, 2025 14:13
thin-edge.io install and bootstrap for thin-edge connected to AWS

Bootstrap thin-edge.io for AWS

The script is a convience script to get started with thin-edge.io and AWS as quick as possible.

By default thin-edge.io will only be installed if it is not already, but if you want to update to the latest version you can provide the --update flag.

For more details check the --help of the script.

Interactive mode

@reubenmiller
reubenmiller / lock-testcases.sh
Created February 17, 2023 15:54
Test cases to check tedge locking
#!/bin/sh
cleanup() {
sudo systemctl stop tedge-agent || true
sudo rm -f /run/lock/tedge-agent.lock
}
test_case_1() {
echo
echo "--------------------------------------------------------"