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 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 July 15, 2024 19:49
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 "--------------------------------------------------------"
@reubenmiller
reubenmiller / TEDGE_CHANGE_LOG_OUTPUT_FOLDER.md
Last active February 16, 2023 19:46
thin-edge.io: changing the log output folder

Changing thin-edge.io log output folder

By default thin-edge.io persists logs under the /var/log folder. On some devices the /var folder is volatile, which means that the folder is newly created after each device reboot.

Normally, the folder structure under /var/log is created by thin-edge.io during the installation process, but since the /var/log folder is deleted, some thin-edge.io services do not function as expected.

There are two main ways to solve this problem, they are listed below.

Option 1: Create a initialization service which runs before tedge-agent service

@reubenmiller
reubenmiller / tedge-cross-compile-with-zig.md
Last active May 20, 2024 09:56
How to cross compile tedge using zig

How to cross compile a rust project using zig? wtf.

I was able to compile and cross compile the gnu and musl variants to all of our target triples :)

  1. Install the cargo-zigbuild and dependencies (requires python3)

    pip3 install ziglang
    cargo install cargo-zigbuild
@reubenmiller
reubenmiller / bootstrap-aws.sh
Created January 25, 2023 13:41
thin-edge.io bootstrap aws (custom example)
#!/bin/bash
##################################################################################################
# Install and bootstrap thin-edge.io to enable AWS communication
# A custom tedge and tedge-mapper version is used as the AWS functionality has not been
# merged into the main branch.
#
# Usage:
# sudo ./tedge-aws-bootstrap.sh
#
# Checkout the following links for more guidance on how to setup AWS and connect thin-edge.io to it
@reubenmiller
reubenmiller / mac-install.sh
Created December 16, 2022 11:26
mac install setup - homebrew without sudo
#!/bin/bash
# -------------------------------------------------------------------------------------------------------
# Pre-requisites
# This should be manually installed by the user (though it might be automatically installed by brew?)
# xcode-select --install
# -------------------------------------------------------------------------------------------------------
# Options
HOMEBREW_NO_SUDO=true
HOMEBREW_INSTALL_PATH=
@reubenmiller
reubenmiller / psc8y.completion.definitions.ps1
Created February 2, 2021 08:34
PSc8y argument completions example
<#
.SYNOPSIS
Provides argument completions for dynamic data by querying Cumulocity for the values
#>
$RoleCompleter = {
param ($commandName, $parameterName, $wordToComplete)
if ($wordToComplete -is [array]) {
$searchFor = $wordToComplete | Select-Object -Last 1
} else {
$searchFor = $wordToComplete