Not today...

Filed under cli...

comments

Snippet

Viper Multi Config

This post will explain how to overload configurations in Golang using viper and cobra libraries. The use case may be a niche one, but I find this to be an easy to understand and pretty clear way to do configuration merge. The problem and the expectation I am deploying most of my application on Kubernetes nowadays (I also moved my personal infrastructure to it a few weeks ago). This solution come with a big tooling ecosystem and a really opiniated way to deploy. Read More...

Tagged golang , dev , cli

comments

Snippet

KVM with Docker bridge

This post will explain how to use the docker bridge as a KVM bridge. In this post I will use the Qemu command line to manage my VMs. There is a lot of ways to connect a VM to the internet. The most common one is via network address translation (NAT). This method has a few down side, the main one being that you need to explicitely configure port forwarding for your VM services to be reachable from the host. Read More...

Tagged admin , cli

comments

Tuto

Kvm Hello World

Let’s start a small serie of post on KVM. It is a tool I sometime need to use when Docker is too simple for the problem at hand, or if I really need virtualization (to emulate another arch or a totally different system). I will start by giving a series of snippets to quick start your KVM usage. I am doing this because I often struggle to retrieve simple information when I want to come back on this kind of technology. Read More...

Tagged kvm , cli

comments

Snippet

Socat, Telnet and Unix sockets

Once in a while I use telnet, mostly to check if a port is open (the infamous telnet localhost 22) and sometimes to send a random http request. However, telnet has a few caveats which are: not able to read from stdin not able to deal with https not able to handle unix sockets Those limitations are pushing me towards the use of the socat utility. Here I will show a few situations in which I am now using socat. Read More...

Tagged cli , admin , bash

comments

Snippet

Terraform retrieve sensible data

Another post on Terraform. Here to share a little snippet to retrieve some data from your Terraform state. When you are dealing with some Terraform resources or writing modules you may encounter the sensitive keyword/value (here is a bit of doc). This is handy to avoid leaking some data, but from time to time you may want to extract one of those. Code For this article let’s imagine I am creating an aws_iam_user for another team to access some specific resources. Read More...

Tagged cli , terraform

comments

Tuto

Debug Terraform

How to easily debug Terraform? This was one of my biggest problem when dealing with the tool. I followed instructions to use some output ressources or browse the “debug” logs. Disclaimer: none of it was working properly. So here is what I am actually doing and I am perfectly happy with. Oh! And just before starting to enable debug logs you have to pass the environment variable TF_LOG=debug (because there is no man page and it is not written in the --help content). Read More...

Tagged cli , terraform

comments

Snippet

The wild kubectl logs issue

A quick post to present one of my finding during my Kubernetes journey. It may help people since it took me some time to find this out. I am currently using Kubernetes a lot for my job. I am part of the infrastructure team and need to debug some setups. I am using kubectl logs extensively and I found a few interesting options I’d like to share. Most of the time you will have multiple containers handling requests and you want to see what is happening in all of them. Read More...

Tagged kubernetes , admin , cli

comments

Tuto

Gopass

A pretty good security advice would be to never write down a password unencrypted on disk. This can be pretty tricky to achieve, especially on personal and development environments. So let me introduce gopass which is a tool aiming to help with this problem. First of all, let me say it right away, the CLI interface is not that good. Took me a lot of time to set things properly as options may be cryptic and behavior is not obvious as first sight. Read More...

Tagged admin , cli

comments

Snippet

Git amend history

This post is a simple copy of this answer, go there to see the original. As I am using git extensively in my day to day life/job, I encountered the issue to simply amend a commit which is already two or three commits before the current one. I could use git rebase -i with some stashing to apply the changes at the proper moment. This is most of the time a viable solution, however, it may be complicated because I have too much new code and stashing would be complicated. Read More...

Tagged cli , git

comments

Snippet

Simple HTTPs server

Sometimes we need to create a simple server saying hello through https. Here is a simple snippet to achieve this in a shell. # first we generate a self signed certificate for domain foo openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes \ -out foo.crt -keyout foo.key -subj "/CN=foo.com" # then we start a server using socat sudo socat "ssl-l:443,cert=foo.crt,key=foo.key,verify=0,fork,reuseaddr" \ SYSTEM:"echo HTTP/1.0 200; echo Content-Type\: text/plain; echo; echo Hello World\! Read More...

Tagged cli , admin