Archive
All published posts
Kubetail is a pretty sick bash script that allows you to tail logs for multiple pods in one stream. Very handy when you have more than one replica running.
wget https://raw.githubusercontent.com/johanhaleby/kubetail/master/kubetail chmod u+x ./kubetail
Now with kubetail I can tail all the logs for every shot-wayl-one pod in the shot namespace.
I’m impressed by kubetail from johanhaleby.
Bash script to tail Kubernetes logs from multiple pods at the same time
I am converting my docker compose env secrets over to k8s secrets. This guide was clear and to the point how I can replicate this exact workflow.
First set the secret, the easiest way is to use kubectl wtih –from-literal because it automatically base64 encodes for you.
kubectl create secret generic minio-access-key --from-literal=ACCESS_KEY=7FkTV**** -n shot
If you don’t use the --from-literal you will have to base64 encode it.
echo "7FkTV****" | openssl base64
Once you have your secret deployed, you have to update the container spec in your deployment manifest to get the valueFrom secretKeyRef.
Wow, shocked at these results. All this time I’ve been told and believed that k8s is incredibly hard, and you need a $1M problem before you think about it because it will take a $1M team to maintain it. So far my experience has been good, and I definitely do not have a $1M problem in my homelab.
Wes has some of the coolest OG images i’ve ever seen. Here he talks about how to enable cache configuration so that its constantly updating the cache without the user waiting for the image to be created.
Looking for inspiration? NeoComposer.nvim by ecthelionvi.
Neovim plugin that simplifies macros, enhancing productivity with harmony.
Interesting principle here. What a great example, If I’m looking at the second jQuery example, I have to dig into dev tools or make some assumtions that this team uses jQuery, and selects by id, therefore I can grep for $("#d1").
Consider two different implementations of an AJAX request in HTML, the first in htmx:
I was looking to add running kubernetes jobs to a python cli I am creating, and I found this solution, mostly thanks to ollama run mistral:7b-instruct-q4_K_M and my loose understanding of what the yaml syntax is supposed to look like for a kubernetes job. This will let me create a job in the cluster, choose the image that runs, the command that is called, and how long until the job expires and is cleaned up. While the job still exists I can go in and look at the logs, but once its ttl has expired they are gone.
Check out kevinhwang91 and their project nvim-ufo.
Not UFO in the sky, but an ultra fold in Neovim.
Clear out lsp diagnostics in nvim.
I’ve often struggled to find and kill a process using a certain port on archlinux. Mainly becuase most guides use netstat rather than ss.
Here is how I just killed the process using port 5000 using fuser.
sudo fuser -k 5000/tcp
You can also get information about the process by running lsof
This is a sick kubernetes architecture diagran generation tool.
Here is an example
I think just, might just be the thing I have been looking for. I’ve been looking for some ci/cd that I can host myself, but everything looks pretty big, so for now I am going to use just as my task runner.
I installed with installer.
curl https://i.wayl.one/casey/just | bash
I set up my devtainer builds with just. Here is my justfile, yes you just need the cli and a file named justfile.
kompose is a sick cli to convert docker-compose.yml to kubernetes manifest.
Running your own docker registry in one line
Example of how to add a pvc to a deployment.
I was curious to see what was going on inside of my minio object storage. Great technique here by Frank to create an inspector pod, then you can do as you wish with the data.
I created the manifest as pvc-inspector.yml
apiVersion: v1 kind: Pod metadata: name: pvc-inspector spec: containers: - image: busybox name: pvc-inspector command: ["tail"] args: ["-f", "/dev/null"] volumeMounts: - mountPath: /pvc name: pvc-mount volumes: - name: pvc-mount persistentVolumeClaim: claimName: pvc-name
Then used it like this.
In order to use k8s secrets manifest you first need to encode the data values.
Right after installing k3s you are going to need to use sudo to use any kubectl command. The reason for this is that the default config is owned by root. To get around this you will need to make your own config and set the KUBECONFIG environment variable
To do this I used sudo one last time to copy the k3s.yaml file into my own directory and take ownership of it.
I recently spun up k3s in my homelab. I’m trying to offload some work off of my free tier fly.io app in order to keep it free tier without crashing.
# install and start k3s curl -sfL https://get.k3s.io | sh - # check to see if your nodes are started sudo kubectl get nodes
My main hiccup so far was the machine I am running on runs zfs on root, and it would not start the master node. Rather than figuring out how to make zfs play nice I just pointed k3s to a drive that is not zfs.
Check out djmaze and their project docker-caching-proxy.
Caching proxy docker image
Tailwind comes with space that I have never heard of that is made to give margin and padding together in one class. Adam dropped it here in the Tailwind Connect conference.
Litestar is an interesting api framework similar to fastpi, that I am interested to check out to see if it fits into some project scope. It sounds like it comes with a lot more batteries included for things like auth, but does not have hard opinions like django. At this point I’m not jumping off of fastapi, but its something I want to try.
Deleting a fly postgres db cluster was not straightforward to me as the app name is not inferred from the toml like it is for the main app.
![[None]]
Yet again twitter cards were causing me pain. This time it was me not realizing that they require full urls, and not relative or abolute urls.
This was not working
<meta name="twitter:image" content="/shot/?path={{ request.url|quote_plus }}" content-type='image/png'/>
This does work with a full url
Boot.dev is crushing it with these interviews. This one has Wes Bos, includes teaching, webdev, where is webdev headed.
gen.nvim by David-Kunz is a game-changer in its space. Excited to see how it evolves.
Neovim plugin to generate text using LLMs with customizable prompts
This seems like a promising tool to use with ollama.
ollama is the easiest to get going local llm tool that I have tried, and seems to be crazy fast. It feels faster than chat gpt, which has not been the experience I have had previously with running llm’s on my hardware.
Check out Boeing and their project config-file-validator.
Cross Platform tool to validate configuration files
If you’re into interesting projects, don’t miss out on NeoTweet, created by ChristianChiarulli.
No description available.
Controlling overflow with tailwindcss
Default scrollbars on a dark theme website are just the ugliest thing. This page covers all the pseudo selectors needed to style the scrollbar.
Wincent (Greg Hurrel) has a pretty solid and fast zshrc. I recently grabbed his completion section and it seems to be working better than whatever I had.
zsh completion snippet
All the hover, select, autofil, focus combinations have left me confused on how to consistently get my form elements styled in dark mode
This snippet from CSS tricks has fixed all the different states for me to give me full control.
arel is a “Lightweight browser hot reload for Python ASGI web apps”
I just implemented this on my thoughts website using fastapi, and it’s incredibly fast and lightweight. There just two lines of js that make a web socket connection back to the backend that watches for changes.
When in development mode, this snippet gets injected directly on the page and does a refresh when arel detects a change.
import os import arel from fastapi import FastAPI, Request from fastapi.templating import Jinja2Templates app = FastAPI() templates = Jinja2Templates("templates") if _debug := os.getenv("DEBUG"): hot_reload = arel.HotReload(paths=[arel.Path(".")]) app.add_websocket_route("/hot-reload", route=hot_reload, name="hot-reload") app.add_event_handler("startup", hot_reload.startup) app.add_event_handler("shutdown", hot_reload.shutdown) templates.env.globals["DEBUG"] = _debug templates.env.globals["hot_reload"] = hot_reload @app.get("/") def index(request: Request): return templates.TemplateResponse("index.html", context={"request": request}) # run: # DEBUG=true uvicorn main:app --reload
I just discovered arel for hot reloading python applications when content changes from this snippet that implements it for fatapi.
...
I need to learn regex capture groups better. This is so dang powerful. I really like the \v that bob uses here, it really does cut down on the terseness of all the special characters.
I wanted to replace all occurrences of:
name,[email protected],0,171,,2023-09-21
With:
...
HATEOAS gonna hate. More and more htmx seems like the js library for backend devs. So rather than making 55 rest calls here, just make an endpoint that does what you want it to do with one, or a few requests.
Ben Johnson was on the Changelog a few years back covering his work on litestream, and talks about why he chose to go open source, but not open contribution.
You should have a good reason to move off of sqlite.
jpillora/installer is the install script generator I have been looking for. It downloads binaries for your machine from GitHub releases and unzips them for you. It grabs the latest release, so you can easily update them. I have tried scripting these installs in the past and struggled to consistently get the latest version for every package and unpack it correctly.
Also these pre-compiled binaries install rediculously fast compared to building them from source.
Check out some example links.
opening in a browser will show metadata
...
I wanted to host some static files through fastapi. Typical use cases for this might be some static web content like html/css/js. It could also be images or some data that doesn’t need dynamically rendered.
The docs cover how to host static files, and give this solution that is built into fastapi.
https://fastapi.tiangolo.com/tutorial/static-files/
from fastapi import FastAPI from fastapi.staticfiles import StaticFiles app = FastAPI() app.mount("/static",...
...
I just learned that the term PITR means Point In Time Recovery. I have never seen this term, but it is most often referred to in relation to database recoveries.
Very inspiring talk, TLDR, you probably don’t need a database server. sqlite will probably be faster, simpler to maintain, and simpler to test your application.
I recently se tup minio object storage in my homelab for litestream sqlite backups. The litestream quickstart made it easy to get everything up and running on localhost, but I hit a wall when dns was involved to pull it from a different machine.
First I had to configure the Key ID and Secret Access Key generated in the minio ui.
❯ aws configure AWS Access Key ID [****************VZnD]: AWS Secret Access Key [****************xAm8]: Default region name [us-east-1]: Default output format [None]:
Then set the the s3 signature_version to s3v4.
aws configure set default.s3.signature_version s3v4
Now when I have minio running on https://my-minio-endpoint.com I can use the aws cli to access the bucket.
...
`litestream` is a sick cli tool for steaming replicas of sqlite. It automatically does daily snapshots, and streams all of the writes to the replica live.
install #
Install is fast using installer, no compilation, just copy the binary and run.