Skip to content

Instantly share code, notes, and snippets.

🐒
Chaos Monkey

Gergely Imreh imrehg

🐒
Chaos Monkey
Block or report user

Report or block imrehg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View healthcheck
#!/bin/bash
# Check succeeds if file found to be modified in shorter time than threshold
[[ -n "$(find /data/container_healthchecks/balena_tags -mmin -21)" ]]
View gist:6386b02f198858aca82cbcfcd133bd88
systemctl stop resin-supervisor
balena rm -f $(balena ps -a -q) || true
balena tag $(balena images | grep registry2 | awk '{print $1}') backup
balena rmi $(balena images | grep registry2 | awk '{print $1}')
systemctl restart resin-supervisor
while ! balena images | grep -q registry2 ; do echo "waiting on supervisor download, sleeping 5s" && sleep 5; done
echo "download finished, removing temporary image tags"
balena rmi backup
@imrehg
imrehg / disable-ethernet
Last active Mar 19, 2019
Network Manager disable ethernet
View disable-ethernet
[connection]
id=disable-ethernet
uuid=35a68233-05e3-4ef0-9150-9a4099f32344
type=ethernet
autoconnect=false
permissions=
[ethernet]
mac-address-blacklist=
View huawei-gsm
[connection]
id=huawei-gsm
type=gsm
[gsm]
apn=rsaweb.mobi
[ipv4]
dns-search=
method=auto
@imrehg
imrehg / fixmig_pretty.js
Created Nov 22, 2018
prettified supervisor migrator
View fixmig_pretty.js
This file has been truncated, but you can view the full file.
!(function(e) {
var t = {};
function n(r) {
if (t[r]) return t[r].exports;
var i = (t[r] = { i: r, l: !1, exports: {} });
return e[r].call(i.exports, i, i.exports, n), (i.l = !0), i.exports;
}
(n.m = e),
(n.c = t),
View delta_test.sh
AUTH_TOKEN=
SRC_RELEASE_ID=
DEST_RELEASE_ID=
IMG_SRC=$(curl --silent -H "Authorization: Bearer $AUTH_TOKEN" "https://api.balena-cloud.com/v4/image?\$filter=is_part_of__release/release%20eq%20${SRC_RELEASE_ID}" | jq -r '.d[0].id')
IMG_DEST=$(curl --silent -H "Authorization: Bearer $AUTH_TOKEN" "https://api.balena-cloud.com/v4/image?\$filter=is_part_of__release/release%20eq%20${DEST_RELEASE_ID}" | jq -r '.d[0].id')
echo "Source Image -> Destination Image"
echo "$IMG_SRC -> $IMG_DEST"
View test.log
May 22 13:44:40 3ac63e7 systemd[1]: balena.service: Service hold-off time over, scheduling restart.
May 22 13:44:40 3ac63e7 systemd[1]: Stopped Balena Application Container Engine.
May 22 13:44:40 3ac63e7 systemd[1]: Starting Balena Application Container Engine...
May 22 13:44:40 3ac63e7 healthdog[15062]: time="2018-05-22T13:44:40Z" level=warning msg="Running experimental build"
May 22 13:44:40 3ac63e7 healthdog[15062]: time="2018-05-22T13:44:40.313203379Z" level=info msg="libcontainerd: new containerd process, pid: 15079"
May 22 13:44:40 3ac63e7 healthdog[15062]: time="2018-05-22T13:44:40.519566295Z" level=error msg="containerd: notify OOM events" error="open /proc/1350/cgroup: no such file or direct
May 22 13:44:41 3ac63e7 healthdog[15062]: time="2018-05-22T13:44:41.326064905Z" level=warning msg="libcontainerd: unknown container 5e85a5a91a0b88066d0fd3fda78d70d7626296566fdac9dda
May 22 13:44:41 3ac63e7 healthdog[15062]: unexpected fault address 0xffffffe8
May 22 13:44:41 3ac63e7 healthdog[15062]: fatal error
@imrehg
imrehg / http_connect_proxy_test.md
Last active Apr 10, 2018
Proxy testing for resinOS
View http_connect_proxy_test.md

HTTP Proxy Test

Test

1) Proxy setup

Connect to the target device's host OS, and create the system-proxy directory:

mkdir -p /mnt/boot/system-proxy/
View services.sh
#the RESIN_API_KEY and RESIN_APP_ID is available in the application container, if enabled
curl -v -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${RESIN_API_KEY}" \
'https://api.resin.io/v4/service?$filter=application%20eq%20'${RESIN_APP_ID}'&$select=id,service_name'
View supervisor_test_api.md

Supervisor update test through the API

Test

This test checks if the update-resin-supervisor script correctly gets the supervisor information from the API.

  • connect to the host OS
  • copy and paste the below script into the shell to run it - it will take the device's credentials, calls the API for the supervisor for cross-check, update the API entry for this device, and calls the supervisor updater to check if it finds the updated info.
You can’t perform that action at this time.