Posts

Showing posts with the label DevOps

Turborepo Tutorial: Run Every Package With One Command

Image
Quick answer Turborepo is a build tool for JavaScript and TypeScript monorepos: one command builds every package in the right order and caches the results, so an unchanged package is never rebuilt. This post builds a small shop monorepo with a shared pricing package and a shop app, then shows the second build finishing in 17 milliseconds because the cache hits. A small online shop in Karachi sells kurtas and dupattas. The shop app prices each order, the admin page prices refunds, and a checkout helper prices the cart, and each of the three copies the same discount rule: 10 percent off orders of Rs 10,000 or more, plus 5 percent tax. One day the discount changes to 15 percent, two copies get updated, and the third keeps charging the old price until a customer complains. A monorepo fixes the copying by putting the shared code in one package that every app imports. Turborepo makes that monorepo practical: it runs each package's build in dependency order and remembers the results. W...

OpenTelemetry Python: Trace a Checkout Flow End to End

Image
Quick answer Yes. OpenTelemetry Python adds distributed tracing to a Python service with a few lines of setup: create a tracer provider, attach an exporter, and wrap each step of a request in a span. Each span records a name, timing, and attributes, and spans from one request share a trace id. Start with the console exporter, then switch to a real backend when the traces look right. A customer writes in: checkout took thirty seconds, then failed, and nobody can say where the time went. The order service says the payment call was slow. The payment service says it never saw the request. The logs from both sides exist, but they disagree about what happened first. That is the gap tracing fills. A trace follows one request across every service it touches, giving you one timeline with a name, a duration, and a few facts per step. OpenTelemetry is the shared vocabulary for that timeline, and the Python SDK is the part you wire into your own code. What I would check before using it My firs...

GitHub Actions Explained: Automation That Runs on Every Push

A developer pushes a small change on Friday, the tests are not run, and on Monday the team finds the main branch broken all weekend. Running the tests was a manual step, and manual steps get skipped exactly when people are in a hurry. GitHub Actions removes that step: it runs your checks automatically on every push and pull request, and puts the result on the pull request as a green tick or a red cross. Quick answer GitHub Actions runs your checks automatically on every push and pull request, and puts the result on the pull request as a green tick or a red cross. A workflow is a YAML file in the .github/workflows/ folder, versioned and reviewed like any other code, that runs a set of jobs on fresh machines GitHub provides. Use it when the code already lives on GitHub and the team wants checks that run without being asked. The automation is a YAML file in the .github/workflows/ folder, versioned and reviewed like any other code. A workflow is a set of jobs, each runs on a fresh machi...

Terraform Explained: Infrastructure as Code for Teams

Every application needs something to run on, and for years the way to get it was to click through a cloud console: create a server here, open a port there, attach a disk, write down what you did in a document nobody updates. It works the first time, and it falls apart the second time, because the second person clicks slightly differently and the document is already out of date. That is the problem Terraform exists to solve, by turning infrastructure into files that can be read, reviewed, and rebuilt. Terraform describes infrastructure as code. You write files that declare what should exist, a server, a file, a DNS record, and Terraform creates it, updates it, and tracks it. The files live in version control next to the application code, so a change to infrastructure goes through the same review as a change to the app. Run the same files again and you get the same infrastructure, without relying on anyone remembering which buttons to click. Two ideas make this safe: the state file reco...

Kubernetes Explained: How to Run Containers at Scale

Three containers on one server are easy to manage by hand. Three hundred across ten servers are not. One crashes at 3 a.m., another eats all the memory on its machine, and a traffic spike needs more copies right now. That is the gap Docker alone leaves open: Docker runs containers , and something still has to decide where they run, how many there should be, and what happens when one dies. The core idea is desired state: you write down how many copies should exist, which image they run, and how they can be reached, and Kubernetes works continuously to make that true. If a copy crashes, it starts a replacement. If you ask for five copies instead of three, it starts two more. If you change the image, it replaces the copies one at a time, so the service stays up. A pod is the smallest unit it manages: one or more containers that share networking and storage and are always scheduled together, usually a single app container. Pods are disposable, so you never log in to fix one, because the s...

Docker Explained: Containers Without the Confusion

Your app runs perfectly on your laptop. You hand it to a teammate, and it crashes on their machine. You deploy it to a server, and it crashes differently. The code is identical in all three places, so the difference has to be the surroundings: a newer Node version here, a missing library there, a setting nobody wrote down. That gap between "it works on my machine" and "it works everywhere else" is the problem Docker exists to close. Quick answer Docker is a tool that packages an application and everything it needs into a container. The container runs the same on a laptop, a test server, or a cloud machine, because the code and its dependencies travel together. A container packages your app with its runtime, libraries, and settings, so the same sealed unit runs on your laptop, on a teammate's machine, and on a server. The image is the recipe, a read only template, and the container is one running copy made from it. FROM node:20-alpine WORKDIR /app COPY package....