The First Shovelful: On the Ground You Break Before the First Brick

A reader asked me recently, with a tone of sincere ambition, how they should build their first small service. They’d sketched the logic, chosen a language, and were ready to 'start coding.' My answer surprised them. I told them the most important line of code they would write that day wouldn’t be in their main application file. It would be in a file most users would never see, for a process that would, in the best-case scenario, run flawlessly in silence forever. I told them to start with the init script.

The instinct to dive into the core problem is a good one, a fire that should be nurtured. But reliability isn't born from a brilliant algorithm alone; it's forged in the mundane rituals of process control. An application, especially a small service, is a living thing you release into the wild of your server. How does it start? More crucially, how does it stop? How does it restart when it stumbles? These are the questions an init system answers, and deciding on this before you write your business logic is like surveying the land and laying a foundation before you build the house.

It’s a form of operational empathy for your future self. At 3 a.m., when a memory leak finally topples your service, you won’t want to be SSH’d into a box, frantically grepping for process IDs. You’ll want a configured systemd service or a Supervisor recipe that you built on day one, which knows how to respawn the process, capture its panicked last words to a log file, and send you a tidy notification. This initial choreography of birth, death, and rebirth turns a fragile script into a resilient service. It elevates your creation from a 'program that runs' to a 'system that operates.'

The Humble Bedrock of Operation

This preparation extends beyond just the init script. It’s about the entire pre-production ceremony. Where will the logs go? Not just to stdout, but to a file with rotation policies, so a month from now you can trace an intermittent fault. What user will the service run as? Pinning this down early avoids the classic 'it worked on my machine as root' calamity. These are the first shovelfuls of earth you turn, the unglamorous work that defines the boundaries and rules of existence for everything you build on top.

Skipping this step is tempting. It feels like bureaucracy when you’re burning to create. But I’ve found that the act of defining these operational parameters first subtly and positively influences the code itself. Knowing your service must start cleanly makes you think about configuration parsing more carefully. Knowing it must stop gracefully encourages proper handling of SIGTERM signals, ensuring in-flight operations complete rather than being severed mid-action. You are, in effect, building the fences that keep your code from wandering into a messy demise.

So, to that curious reader, and to anyone else standing at the beginning of a new project: your first task is not to build the thing. Your first task is to build the world the thing will live in. Define its sun and its seasons—its cron jobs and its log rotations. Decide the laws of its physics—its resource limits and health checks. This upfront investment in the boring, reliable technology of operation is what separates a weekend experiment from a service you can forget about, confident that it will simply, quietly, and reliably do its job.

Notes & further reading

A few pages I came back to while writing this: