RSSAmplifier

Blog

Luiz Kowalski :: dev blog

Notes and findings from a Ruby developer

luizkowalski.netRSS feed ↗15 posts

Latest posts

Double-click to submit form pattern with Stimulus (revisited)

A follow-up on the double-click-to-confirm button component, now rebuilt as a ViewComponent with a Stimulus sidecar controller. Shows how overlapping text with CSS grid keeps the button width stable during the confirm animation, plus a caveat about long confirmation strings.

"Double-click to submit" pattern with Stimulus

Inspired by a confirm-by-double-clicking pattern seen in CasaOS, this post recreates it with a small Stimulus controller. It swaps the button text on first click and submits on the second, then adds stimulus-use's clickOutside to cancel the pending confirmation.

Traefik with Kamal: Tips and Tricks

Clears up a common Traefik misconception: you don't need new entrypoints to expose extra services like Grafana on a subdomain, just new routers and services. Walks through enabling the internal API dashboard and the routing rules that connect a Host rule to a Docker service.

Production-Grade (ish) Rails deployment on Hetzner with Kamal

A two-server Kamal deployment on Hetzner: one exposed web server, one locked-down accessories server for Postgres, Redis, and backups, reachable only via SSH jump host. Covers the Terraform setup for provisioning, splitting background jobs by priority, and configuring Traefik for automatic SSL.

Taming complex Service Objects with dry-rb

Uses dry-validation to turn a Service Object's loose params hash into an explicit, self-documenting contract with typed, required/optional fields and business rules. Also covers custom dry-types, coercion, and how this compares to Sorbet.

Using concurrent-ruby in a Rails application

Explains how the GVL still allows I/O-bound work to run in parallel via concurrent-ruby's Future, and how to safely combine it with Rails' Executor. Covers wrapping threads in executor.wrap and using permit_concurrent_loads to avoid autoloading deadlocks.

Validating Mandrill webhook signature on Ruby on Rails

How to verify Mandrill's X-Mandrill-Signature header in a Rails controller by HMAC-SHA1 signing the webhook URL and raw POST params. The key gotcha: you must use request.request_parameters, not Rails' parsed params, since Mandrill signs the raw mandrill_events string.

Encapsulation in Ruby on Rails

Argues that ActiveRecord getters/setters aren't real encapsulation, since callers still need to know about an object's internal fields to mutate it. Proposes using DDD's Aggregate pattern so that all state changes happen through the owning model instead of leaking into other classes.

A simple solution to scalability problems: Event Sourcing

Building an Untappd clone in Kotlin and Spring to explore event sourcing and CQRS. Covers organizing code into independent domains connected only through events, dispatching events via AbstractAggregateRoot, and the eventual-consistency trade-offs that come with async listeners.

Deploying Spring Cloud Netflix apps on Kubernetes

A walkthrough of deploying a Eureka server, a Hystrix dashboard with Turbine, and a microservice to a Kubernetes cluster. Covers Dockerizing each Spring Cloud Netflix component, exposing them with kubectl, and verifying the circuit breaker under load with siege.

Refactoring legacy Ruby on Rails apps

Refactoring a bloated login controller in a Rails side project (Chathub) by extracting single-purpose Command classes and a Service object to tie them together. Discusses the resulting testability gains and the coupling issues still left to fix.

Netflix OSS: A beginner's guide [pt4]

Fourth part of the Netflix OSS series, adding Hystrix circuit breakers to a microservice and aggregating their streams with Turbine. Wires up a combined Hystrix Dashboard/Turbine app and watches the circuit state change as instances scale up.

Netflix OSS: A beginner's guide [pt3]

Third part of the Netflix OSS series, adding Zuul as an edge server to route and load-balance requests across microservice instances. Shows the Zuul route configuration and tests it with curl against a scaled-out contacts-service.

Netflix OSS: A beginner's guide [pt2]

Second part of the Netflix OSS series: registering a microservice with the Eureka server built in part one. Covers the @EnableDiscoveryClient annotation, the client-side eureka.client configuration, and confirming the service shows up in Eureka's dashboard.

Netflix OSS: A beginner's guide [pt1]

First part of a series introducing the Netflix OSS microservices stack, starting with Eureka, the service registry. Walks through generating a Spring Boot project, configuring application.yml, and enabling the server with @EnableEurekaServer.