Lightweight Deployment Automation with an Idle Server and an AI Coding Assistant
A spare ARM server can provide a lightweight, self-hosted deployment pipeline without running builds on production infrastructure. This article explains the architecture, repository mirroring, build isolation, deployment and rollback workflow, and the role of an AI coding assistant in implementation—while keeping security boundaries and architectural decisions under human control.
1. The Deployment Problem Behind a Small Project
I recently built a documentation website for a new product. It is a typical static site: the source lives in a public code repository, and routine updates involve editing documentation locally, checking the changes, and pushing them upstream.
Deployment was the awkward part. I had been publishing manually, not because I wanted to avoid automation, but because of two practical constraints:
- Limited production resources. The production server already runs business services. Its capacity is too limited to comfortably handle dependency installation, static-site builds, and release packaging alongside those workloads. Competition for CPU and memory could affect service stability.
- No existing CI infrastructure. I had neither a dedicated build server nor a maintained pipeline platform.
Meanwhile, a cloud-hosted ARM server with four cores and 24 GB of memory had been sitting idle. That suggested a straightforward question: Could this machine serve as the automation control plane, leaving production responsible only for receiving and serving the final files?
For this setup, I also changed how I worked. Instead of configuring everything manually, I delegated much of the architecture exploration, scaffolding, script writing, and debugging to an LLM-powered coding assistant.
Through several rounds of conversation, the assistant interpreted requirements, proposed designs, generated configuration and scripts, and revised them after my review. The process helped narrow down the design quickly and reduced the cost of experimentation. Architectural decisions, however, still required human judgment.
2. Why Hosted CI Was Not the Right Fit
For a public repository, hosted continuous integration is an obvious option. In this case, three considerations led me toward a self-hosted approach.
Security Boundaries
The documentation site deploys to a production server with strict access controls. Giving an external CI service production credentials would extend the deployment trust boundary to a third-party platform.
For this environment, that was not a boundary I wanted to open casually.
Resource Constraints
Dependency installation, frontend bundling, and artifact generation can consume substantial CPU and memory. Running those jobs on the production server would compete with live business services.
The preferred division of responsibilities was clear: build and orchestration tasks belong on the idle, higher-capacity server; production receives only the finished artifacts.
Reusability
I wanted the infrastructure to support future small projects, not just this documentation site. A reusable, self-hosted pipeline would provide a shared foundation rather than requiring separate external CI configurations for every project.
These considerations became the design constraints:
- Keep the existing public repository platform as the collaboration entry point.
- Run no build tasks on the production server.
- Use the idle ARM server for repository mirroring, task execution, and build caching.
- Deploy through a dedicated, low-privilege account.
3. The Final Deployment Workflow
After several design iterations, the event-driven workflow looked like this:
Edit documentation locally│ git push▼Public code repository│ Repository mirroring / synchronization▼Self-hosted internal Git service│ Trigger pipeline▼Self-hosted runner│ Install dependencies, build site, generate artifacts▼Deployment script (scp/rsync + atomic switch)▼Update the production nginx site directory
Repository Synchronization
The public repository remains the only write entry point. The internal Git service keeps a synchronized mirror.
This preserves the convenience of public collaboration while placing the pipeline’s immediate trigger source inside infrastructure I control.
Pipeline Triggers
The internal Git service has lightweight pipeline rules: a new commit on the main branch schedules a build.
The runner resides on the ARM server and starts the build environment as needed.
Build Isolation
Each build runs in a separate working directory. A cache directory accelerates Node dependency installation, avoiding a full installation from scratch every time.
The output consists entirely of static files. Scripts check artifact integrity before the deployment stage begins.
Deployment and Rollback
A dedicated, low-privilege account uses SSH key authentication to transfer artifacts to production.
The deployment follows a staging directory plus atomic switch pattern: upload the complete new release, validate it, and then switch the active version using a symbolic-link-based release layout or an atomic mv operation. If a problem appears, switching back to the previous release link provides a quick rollback.
The following script illustrates the release-directory layout, transfer, link update, and cleanup steps. It is a skeleton rather than a complete implementation of validation and atomic switching:
#!/usr/bin/env bashset -euo pipefailDEPLOY_DIR=/var/www/docsRELEASE_DIR="${DEPLOY_DIR}/releases/$(date +%Y%m%d%H%M%S)"# 1. Upload artifacts to the staging release directoryrsync -az dist/ deploy@prod:"${RELEASE_DIR}/"# 2. Update the active release link after validationssh deploy@prod "ln -sfn ${RELEASE_DIR} ${DEPLOY_DIR}/current && \find ${DEPLOY_DIR}/releases -maxdepth 1 -type d \-mtime +7 -exec rm -rf {} +"
Recent releases are retained for rollback, while older releases are removed automatically to prevent unbounded disk usage. In this example, cleanup uses an age-based retention rule.
4. What the AI Coding Assistant Actually Did
The agent-style coding tool contributed in three main areas.
Refining the Architecture
I first described the requirements and constraints. The assistant outlined several options—including direct rsync deployment, an internal Git service, and hosted CI—and compared their trade-offs.
The final architecture emerged through multiple rounds of discussion, but I made the decisions about which trade-offs to accept.
Generating Configuration and Scripts
The assistant produced most of the initial pipeline configuration, deployment scripts, and server-side configuration for restricting permissions. I then reviewed and modified those drafts.
This substantially reduced the time spent writing boilerplate compared with starting from scratch.
Accelerating Troubleshooting
The first deployment encountered problems with credential propagation to the runner and directory permissions. Providing the assistant with the error context helped identify the root causes within a few iterations.
The important distinction is that a coding assistant is useful for implementing a defined design, while deciding which design should be implemented still requires human ownership.
Security boundaries and the scope of a deployment account’s permissions are examples of decisions that should not be delegated blindly to a tool.
5. Lessons and Best Practices
1. Start with Least Privilege
The deployment account should be able to write only to the site directory and should not have system-level privileges. Restrict the commands available through SSH.
2. Keep Credentials Out of the Repository
Inject credentials through the runner’s secret-management mechanism as environment variables. They must not appear in source control or build logs.
3. Separate Building from Serving
The pipeline produces deployable artifacts. The production server serves them reliably.
Keeping these responsibilities separate protects production resources and makes failures easier to diagnose.
4. Preserve a One-Step Rollback
Every automated deployment workflow needs a fast way back to the previous release. Rollback speed matters more than deployment speed.
5. Require Human Review
An assistant can generate configuration and scripts, but every file entering the production deployment workflow should receive human review and approval.
6. Conclusion
The biggest benefit of this project was not simply eliminating repetitive deployment work. It demonstrated a practical engineering workflow: turn idle computing resources into useful infrastructure, delegate repetitive implementation tasks to an AI coding assistant, and keep architecture and security decisions in human hands.
By reusing an existing server, this setup added no infrastructure cost. It also kept the deployment workflow under my control and provided a foundation that could extend to other small projects.
For a small team with spare server capacity, it offers a cost-effective path to deployment automation—without placing build workloads on production or outsourcing critical decisions to an AI tool.
