Skip to content

Instantly share code, notes, and snippets.

@dmyerscough
dmyerscough / gist:f042bcfb5215f1966340fd99d1e3ad91
Last active April 18, 2022 03:39
FluxCD HelmRelease definition
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: angi-helloworld
namespace: angi
spec:
interval: 1m
releaseName: angi-helloworld
chart:
spec:
@dmyerscough
dmyerscough / gist:d82bde66910cf7690f41ac90e3f187c7
Last active April 21, 2022 04:39
Create a GitRepository to sync
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: GitRepository
metadata:
name: angi-helloworld
namespace: angi
spec:
interval: 5m
url: https://github.com/dmyerscough/angi-helloworld
ref:
branch: main
pi@raspberrypi:~ $ docker logs 4df8be62edb9
> tesla@1.0.0 start
> node server.mjs
(node:19) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
{"level":"info","message":"Scraping powerwall","timestamp":"2022-04-06T05:25:28.864Z"}
{"level":"info","message":"Listening on 0.0.0.0:9961","timestamp":"2022-04-06T05:25:28.881Z"}
{"level":"info","message":"Finished scraping powerwall","timestamp":"2022-04-06T05:25:29.034Z"}
pi@raspberrypi:~ $ docker run -p 9090:9090 \
-v $( pwd )/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus
# Sample config for Prometheus.
global:
scrape_interval: 30s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 30s # Evaluate rules every 15 seconds. The default is every 1 minute.
remote_write:
- url: https://prometheus-prod-10-prod-us-central-0.grafana.net/api/prom/push
basic_auth:
username: <PROMETHEUS USERNAME>
pi@raspberrypi:~ $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4df8be62edb9 damianmyerscough/tesla-powerwall-exporter:0.0.1 "docker-entrypoint.s…" 5 seconds ago Up 3 seconds 8080/tcp, 0.0.0.0:9961->9961/tcp, :::9962->9962/tcp dazzling_jackson
pi@raspberrypi:~ $ docker run -d -p 9961:9961 \
-e TESLA_ADDR="192.168.1.3" \
-e TESLA_EMAIL="damian@example.com" \
-e TESLA_PASSWORD="MyTeslaPassword" \
-e SCRAPE_INTERVAL=30 damianmyerscough/tesla-powerwall-exporter:0.0.1
4df8be62edb9c493c4b08c064f297bf93f2b97c6fa393eb409f812506b63048c
pi@raspberrypi:~ $ docker pull damianmyerscough/tesla-powerwall-exporter:0.0.1
0.0.1: Pulling from damianmyerscough/tesla-powerwall-exporter
d4bf0b27c669: Pull complete
d65b27641f7b: Pull complete
5f3cb788c4e3: Pull complete
b9ab8ace8d81: Pull complete
0f72e21a724d: Pull complete
4329af468ae5: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:0ef7b07ab36bb296e5bc06fa34c60110027974f9f6983064eca0d5222b90226a
const multiply = (a, b) => {
return parseInt(a) * parseInt(b);
}
describe('Multiply functionality', () => {
test('multiply 2 by 2 to equal 4', () => {
expect(multiply(2, 2)).toBe(4);
});
test('verify return value is a number', () => {
❯ jest myscript.js
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /Users/damianmyerscough/project1
4 files checked.
testMatch: myscript.js - 0 matches
testPathIgnorePatterns: /node_modules/ - 4 matches
testRegex: - 0 matches
Pattern: - 0 matches