Compliance as a Code
Recently, I stumbled upon a concept that sounded new to me: Compliance as a Code.
The core idea is to “embed compliance policies into the code that can be repeated and tested automatically.” But what does it mean in practice?
For example, consider PCI DSS, which requires measures to secure credit card information to ensure compliance. Tools like Terraform, Ansible, and others should contain the code for encryption, access control, and data obfuscation. Additionally, before deployment, automated tests in the CI/CD pipeline should validate that the application meets PCI DSS requirements.
Palettro - VSCode like command palette in any macOS application
Short video with overview of Palettro, small utility that brings VSCode like navigation to any macOS application to boost your productivity.
SRE Simplified - Error Budget
SRE Simplified : Error Budget concept.
The concept of Error Budget is useful for setting up alerts of different severity. This video explains in extremely simplified manner how it works.
SRE Simplified - Service Level Agreement
The next issue of SRE Simplified is about Service Level Agreement.
Service Level Agreement is an agreement between service supplier and a customer about what the target quality of the service is and what are the consequences if the promise is broken.
But the challenge here is to eastablish monitoring and alerting.
This video provides very simplified example of an SLA for the company that produces apples.
Document Title
SRE Simplified - Introduction
What are the SRE concepts, like Service Level Agreement and Reliability?
The challenge is to explain it in simplified manner, without deep discussions on different monitoring strategies.
In this first video I tried to just to scratch the surface.
Wireguard VPN Overview
WireGuard is a relatively new protocol. It claims to be greatly simplified and faster comparing to alternatives, it uses UDP as primary transport and encapsulates encrypted traffic from IP layer. Let's investigate if it's true!
Some differences help to stand out of other VPN solutions:
- Routing as a part of Peer configuration
- QR code for simplified configuration using camera on mobile devices. iPhone, iPad and other things, you'll love it!
- Site-to-site or client-to-server connections are not very different from the configuration perspective
- Supports DNS as part of configuration for Peer
- Easy to implement routing for all traffic or for only for selected networks
I was able to connect Mikrotik, FrtizBox 6690, macos, iPad and iPhone using WireGuard with little efforts.
How to suppress alerts in Prometheus for non-working hours
When it comes to the topic how Prometheus and Alertmanager work together and how to restrict alert notification to fire only on working hours, typicall solution is to apply workaround to avaluated alert rule expession like this
and ON() (hour() < 19 and hour() > 8) and ON() (day_of_week() > 0 and day_of_week() < 6)
The full example of such rule is the following
- alert: DummyWorkhoursAlert
expr: 1 and ON() (hour() < 19 and hour() > 8) and ON() (day_of_week() > 0 and day_of_week() < 6)
for: 5m
annotations:
identifier: "{{ $labels.exporter }}/{{ $labels.queue }}"
summary: "Buyerportal: Dummy alert for working hours {{ $labels.queue }}"
description: "* don't do anything, dummy alert *"But the proper solution is to apply mute_time_intervals, as per example below
Blogging using Emacs with org-mode and Hugo
I use org-mode extensively with org-roam for keeping my knowledge and journals together and working as my brain dump destination. This blog serves kinda the same purpose, so why not to combine these things under Emacs umbrella?
Blogging from Emacs boils down to two options.
TLDR; Hugo can render org file natively, but support of features is quite limited, or use org as source that rendered to markdown. The latter brings issues of content syncing from origin to end result.
Install Ruby 3.1.4 on macOS
In case ruby can’t find OpenSSL 3 headers, use this way.
brew install ruby-install
ruby-install ruby 3.1.4 -- --with-openssl-dir=$(brew --prefix openssl)
CloudFlare Tunnel Terraform
How to provision CloudFlare tunnel using Terraform
CloudFlare Tunnel can be useful to use reliable alternative to ngrok when you need to expose your application running locally to the outside world.
The following example exposes my application locally running on port 3000 to the Internet on the hostname https://app.prokopov.me
Prerequisites
- Terraform CloudFlare module v4
- CloudFlare API key with Account:Tunnel permissions.
- Locally installed CloudFlare CLI utility cloudflared https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/
- Application running locally on port 3000
How does it work?
- cloudflared CLI is an agent running locally and connected to CloudFlare cloud.
- DNS record of type CNAME is created, pointing to the CloudFlare cloud.
- CloudFlare does the routing magic!
Terraform part
resource "cloudflare_tunnel" "main" {
account_id = "777414c2d4e87234087ebac4685e7df6"
name = "tunnel-to-app"
secret = random_id.main.b64_std
}
resource "cloudflare_tunnel_config" "main" {
account_id = "777414c2d4e87234087ebac4685e7df6"
tunnel_id = cloudflare_tunnel.main.id
config {
warp_routing {
enabled = true
}
ingress_rule {
hostname = "app.prokopov.me"
service = "http://localhost:3000"
}
ingress_rule {
service = "http_status:404"
}
}
}
resource "cloudflare_record" "main" {
value = "${cloudflare_tunnel.main.id}.cfargotunnel.com"
proxied = true
name = "app"
type = "CNAME"
zone_id = cloudflare_zone.main.id
}
Local tunnel part
- Find generated token for resource cloudflare_tunnel.main
TOKEN=$(terraform show -json | jq -r '.values.root_module.resources[] | select(.address=="cloudflare_tunnel.main").values.tunnel_token')
- Use token
cloudflared tunnel run --token=${TOKEN} tunnel-to-app