ADR-0039: Deploy Sourced Component Architecture
Status: Accepted
Date: 2026-06-12
Author: @johalputt
Context
The VayuPress deploy script embeds the full Go main.go source as a heredoc. This creates a single-file deploy artifact: download the script, run it, get a working server. However, as the deploy script grows (now ~4,000 lines), it becomes difficult to read and maintain if all components are interleaved.
Decision
- The deploy script is organized into sourced component sections with clear delimiters:
## === COMPONENT: <name> ===. - Components are:
go-source,nginx-config,systemd-units,cron-jobs,smoke-tests. - Each component section is self-contained: it defines its own variables, creates its own files, and handles its own error conditions.
- The main script body calls component functions in order, with
set -euo pipefailactive throughout. - The
--dry-runflag causes each component to print what it would do without making filesystem changes.
Rationale
Sourced components with clear section boundaries allow a maintainer to find and modify the nginx config without reading the Go source, or update systemd units without touching cron jobs. The --dry-run flag makes the script safe to audit on production servers.
Consequences
- Positive: Each component is independently readable and testable.
- Positive:
--dry-runenables safe pre-deployment validation. - Positive:
shellcheckcan verify each section independently. - Negative: The script remains a single file — very long. Alternative: split into multiple files. This was rejected because it complicates the single-download deploy UX.