jcardena.com Blog The deploy script that saved my weekends
145 posts
EN ES

The deploy script that saved my weekends

Web

Explore how foundational principles of deterministic deployment automation, from simple scripts to GitOps, are critical for managing modern hybrid AI and data systems.

There was a pattern I saw early in my career, long before we called it DevOps. It was the slow decay of a process from a clean idea into tribal knowledge, captured in a wiki page full of outdated commands and warnings like, "Ask the team lead to restart the legacy service." This manual, high-stakes ritual was a source of constant production anxiety and lost weekends.

The first durable solution wasn't a complex platform, but a humble, version-controlled shell script. It was a simple idea: treat the deployment process itself as a piece of software. That lesson in deterministic automation—making a complex operation explicit, repeatable, and idempotent—has become the bedrock of how I think about system architecture. Today, with AI introducing a new class of non-determinism, that bedrock is more critical than ever.

Manual ChecklistProcedural ScriptDeclarative State
Evolution from Manual to Automated

From Procedural Steps to Declarative State

That first script was procedural. It was a list of commands to be executed in sequence: pull from git, run a migration, clear a cache, restart a service. It was a massive improvement over a manual checklist, turning fear into a predictable, if rigid, process. We codified the institutional knowledge, and any changes required a pull request, not just a whispered conversation.

The industry, thankfully, didn't stop there. We evolved from procedural automation towards declarative systems. This is the core idea behind tools like Terraform and Kubernetes, and the patterns defined in books like Jez Humble and David Farley’s classic, Continuous Delivery. Instead of providing a script of *how* to achieve a state, we provide a manifest that *declares* the desired end state. A reconciliation loop then does the hard work of making reality match the declaration. This shift from imperative commands to declarative goals was a profound leap in building resilient, self-healing systems.

The New Frontier: Deploying Hybrid Intelligence

For years, these patterns were perfected on largely stateless applications. Deploying the next version of a web service is a solved problem. But the real architectural challenge now lies in hybrid systems where deterministic data pipelines and non-deterministic AI agents must cooperate. The 'code' we ship is no longer just a container; it's a vector index, a fine-tuned model, or a registry of structured prompts that guide an agent.

How do you apply these deployment principles here? The classic blue-green deployment, which Martin Fowler describes so clearly, works beautifully when you can just flip a symbolic link or update a load balancer. It gets complicated when a "deployment" means migrating a 10TB vector database schema without downtime. You can't just swap it out. Instead, the principles must be adapted: migrations must be idempotent and backward-compatible, agents must be versioned with their specific toolsets, and prompt changes must be rolled out progressively behind feature flags, just like any other code.

Making All Deployments Boring, Even AI

The goal remains the same: to make deployments boring. The fear of shipping on a Friday that once plagued operations teams is now re-emerging as "AI Ops" anxiety. The failure modes are just different. A bad web deploy might 500-error; a bad agent deploy might quietly start giving subtly wrong, but confident-sounding, answers that corrupt downstream data for days.

This is why the culture of automation is so vital. As Charity Majors argues, the ban on Friday deploys is a symptom of a deeper problem of confidence. In a system with strong observability and reliable, automated deployment, you should be able to ship anytime. For hybrid AI systems, this means applying deterministic guardrails to our non-deterministic components. The deployment script that builds the data pipeline is just as important as the one that registers and validates the prompts for the LLM agent. They are two halves of the same reliable whole.

DATA & EVENT SOURCESUser ApplicationsEvent StreamsVector DBsObject StorageDETERMINISTIC PROCESSINGData Pipelines(dbt)Schema MigrationsFeature StoresValidation &GuardrailsAGENTIC PROCESSINGLLM Agent FleetPrompt RegistryReasoning LoopsTool InvocationSERVING & OUTPUTSAPI EndpointsMonitoringDashboardsAutomated ActionsInsights Engine
Architecture for a Hybrid AI/Data System

Concrete Takeaways for Modern Architectures

Investing in operational discipline for these new hybrid systems isn't a luxury; it's a prerequisite for building anything that lasts. The patterns have evolved, but the core truth holds.

  • Codify everything. Your data transformation logic (dbt), your infrastructure manifest (Terraform), and your LLM agent's prompt templates should all live in version control. If it affects production behavior, it's code.
  • Pursue idempotent operations relentlessly. When deploying a data schema migration or updating an ML model, design the process so it can be run multiple times without causing harm. A failure halfway through should be recoverable by simply running it again.
  • Separate deterministic and agentic concerns. Build and deploy your reliable data pipelines with rigid, predictable automation. Deploy your AI agents with the same rigor, but add layers of validation, canaries, and observability to manage their inherent non-determinism.
  • Make the automated path the only path. The real value comes from discipline. Once a process is automated, the social contract must be that no one circumvents it. This is how you build a culture of confidence, not a culture of fear.
JC
Juan Cardena
Enterprise Architect, Data & AI

Enterprise architect with 25 years across web, software, data, and AI. MIT CDAO ’25. Writing on agentic AI in production.