Welcome to my blog
golang enterprise, part 1, using a modules monorepo
Leveraging go workspaces Since go 1.18, we have a nice features, which is go workspaces. One thing that this brings is allowing to work nicely with multiple modules within one single workspace. Guess what it brings you? having multiple modules in one single monorepo! Take a look at this example Benefits Have all the important reusable company modules at the same place. Bringin a better collaboration, and easier discovery. Mutualize the CI (which is pretty easy) Have good folder structure, allowing the grouping of modules in topics Drawback ( The only drawback I could see until now it the coverage during the CI....
deploying rust in containers
The goal I am pretty familiar with containers and multi stage deployment have been my go to since quite a while now, for my golang codebases. Now that I have been picking up rust, deploying my first rust service in production did bring me back to my usual habits of containerization. We’ll be trying to optimize for speed of build and container size. The cargo.toml [...] [lib] name = "vs" path = "src/lib....
golang errors (after 1.13)
Since go 1.13, go has gone one step further in terms of error handling. Errors can be wrapped, bubbled up and act upon. We will here take a step back on error handling in go, from the perspective of a library. What data could we have in the error? Inspired by a rust talk from Jan Lusby about errors, here are a few things that error could contain: The reason of the error Context of the error: struct field, struct surrounding values… Stack trace: which part of the code triggered this error How to fix the error: suggest a way to fix it Where are errors displayed?...
The stable coins
In today’s crypto world, a few tokens are said stable. that means stable regarding a specific asset, like fiat or even BTC. Here is a compiled list of a few, with information on the way they are backed and audited. sources: https://en.wikipedia.org/wiki/Stablecoin Types of stable coins 💵 fiat based 🪙 crypto curr based 👑 Seigniorage Style Stablecoins (also called algorithmic or synthetic) List name symbol backed how? audit USD Coin USDC 💵 Grant Thornton, LLP 2021 Tether USDT 💵 FSS 2018 2021 Binance dollar BUSD 💵 Withum 2021 Gemini dollar GUSD 💵 bpmca 2021 Maker DAO dai DAI 🪙 300% smart contracts True USD TUSD 💵 armanino 2021 StableUnit SU 🪙 smart contracts Paxos standard PAX 💵 Withum 2021 Terra UST 👑 smart contracts Ampleforth AMPL 👑 smart contracts Augmint A-EUR 👑 smart contracts Frax FRAX 🪙 👑 smart contracts sUSD sUSD 🪙 👑 smart contracts mStable mUSD 🪙 👑 smart contracts Fei FEI 🪙 👑 smart contracts Stability and risk The criterias to evaluate the different platforms and protocols would be among the following:...
golang 1.16 new feature: embed
What is it about In previous versions of go, you needed to reach out for an external package in order to embed static content inside your binary. My go to one was shurcool/vfsgen, but there were many others worth using. Go 1.16 brings a new package, “embed”, which allows to do that with just the standard library. How to do that The best part of this, it’s extremely simple, just see for yourself....
Wasm Prez
I presented at voxxed days last week. Here is the talk I gave, video coming when it’s published.
testing mozilla iot gateway
Mozilla iot gateway Here is what I am going to setup. I am obviously not going to rewrite one more time the tutorial and docs from mozilla. I will simply describe the specific setup I used, and the little things I setup to make it work. Prerequisites Raspberry pi 3b Zigbee dongle, zwave dongle list of compatible hardware - I used Digi XStick (ZB mesh version) and Aeotec Z-Stick (Gen5) Zigbee Smart bulb (i used a philips hue), zigbee motion detector (I used philips motion sensor) Linux I used my favorite lean alpine linux, with the setup as I explained in this post minus the complexity brought up by the rpi0....
cross compiling rust from linux to rpi0/alpine
If you read my previous posts, you should now have a raspberry-pi running alpine and docker. Resources are pretty limited on rpi0, so we are going to deploy programs using rust. Note: golang could have fit in there as well (and ofc all C and close to machine languages). Compiling from NOT a rpi0 Obviously, you don’t want to compile from a raspberry pi zero, unless you have all the time in the world and love waiting....
installing docker on alpine linux
Prerequisites One raspberry pi zero W One sd card Enable all cgroups On you local linux, mount the partition containing alpine files. In the cmdline.txt, add the following: echo -ne " cgroup_enable=memory cgroup_enable=cpuset swapaccount=1" >> /run/media/youruser/xxx/cmdline.txt Docker needs all cgroups enabled, so this will do the trick On you rpi0 As simple as: sudo apk add docker sudo rc-update add docker boot sudo rc-service docker start To make sure your docker env doesn’t go in memory (512MB RAM won’t bring you far…), set it on mmcblk0p3 by editing /etc/docker/daemon....
installing alpine linux on rpi0
Prerequisites One raspberry pi zero W One sd card Download Alpine linux We’ll use the almost latest version: 3.9.2 (3.9.3 would not work for some reason) The one to use for RPI is the raspberry pi (surprising :P) armhf. On your local computer (assuming you re using linux) Mount the sdcard (should be automated, if not, you probably know how to do that and you probably don’t need that tutorial)...