Tangible Bytes

A Web Developer’s Blog

Kubectrl Output Using Gotemplate

kubectl is the kubernetes swiss army knife - as well as being able to manipulate kubernetes it gives access to loads of data

But to make use of that data we need to format it - and one of the more powerful ways of doing this is using gotemplates

the help page just says

–template=’':

Template string or path to template file to use when -o=go-template, -o=go-template-file.

The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].

which isn’t on it’s own terribly helpful

Read more ...

Jwt Secret

JWT uses secrets which are stored securely

This secret is used to sign (opr encrypt) the token - and then the token can be validated using this secret. If the secret is shared between multiple servers - the token can ba validated on any of them.

The secret can change over time (at which point any previous tokens expire) and should be different in each environment eg there is no need to have the same secret in staging and production as token should not be valid across these.

It hasn’t been especially clear to me how a new token is best generated.

Read more ...

Yarn, Vscode, and Typescript

The JavaScript ecosystem is a sea of choices and it seems to be all too easy to make an incompatible selection.

In my case I am using the Yarn package manager, the VSCode editor and TypeScript flavoured JS (I don’t think it really counts as a different language)

Every import statement was triggering an error in VScode

Cannot find module ’’ or its corresponding type declarations

Read more ...

Postgresql Public Schema Docker Init

I am working on a postgresql database for a strapi CMS

I’ve taken over the project and when I try and start it I see this error.

create table "public"."strapi_migrations" 
    ("id" serial primary key,
     "name" varchar(255),
      "time" timestamp) 

- permission denied for schema public
Read more ...

Next.js Environment Variables

I’m running Next.js apps in production using Kubernetes - and I’ve inherited some setup that I didn’t fully understand so I’ve been investigating what is going on with environment variables.

My inherited system used a build per environment and bakes in configuration at that point.

I dislike this because …

Read more ...

Golang Prometheus Exporter Raspberry Pi

I have solar panels that are over 10 years old and I wanted to check if performance is degrading

I used an Open Source tool (SBFSpot) to grab some data from the inverter over bluetooth and so it has to be physically near the inverter and runs on a Raspberry Pi

So far so good - I have nice graphs at https://pvoutput.org

But I really wanted grafana graphs it is such a powerful dataviz tool

For that I needed to get the data to Prometheus

Read more ...