Field study 003 / Developer tooling
A branch of its own
An isolated microservice, database, and domain for each branch.
FIG. 03 / Branch environments SK / ENGINEERING STUDIES
BB Finance · 2018 · Senior Software Developer & Architect · Tallinn Field notes
Pushing a branch created a running service, database, and subdomain. Deleting the branch removed its environment. Developers could try changes without borrowing somebody else’s test system.
Docker Swarm and automated pipelines handled provisioning. Taking a brand-new API service from repository creation to live deployment took about 15 minutes.
View React component source
import { useEffect, useState } from "react";
export default function Demo({ timeline = false }: { timeline?: boolean }) {
const [live, setLive] = useState(false),
[day, setDay] = useState(0);
// Keep server-rendered controls inert until React has attached its handlers.
const [ready, setReady] = useState(false);
useEffect(() => setReady(true), []);
return (
<fieldset className="demo-frame" disabled={!ready}>
{content()}
</fieldset>
);
function content() {
if (timeline)
return (
<section className="demo">
<small>INTERACTIVE STUDY / SAMPLE ACCOUNT</small>
<h2>Move through time</h2>
<label htmlFor="day">Day {day} of 30</label>
<input
id="day"
type="range"
min="0"
max="30"
value={day}
onChange={(e) => setDay(Number(e.target.value))}
/>
<p aria-live="polite">
{day < 15
? "Loan issued · Balance £100"
: day < 30
? "First repayment · Balance £50"
: "Account settled · Balance £0"}
</p>
</section>
);
return (
<section className="demo">
<small>INTERACTIVE STUDY / LOCAL SIMULATION</small>
<h2>A branch of its own</h2>
<p>
Push a feature branch to provision its environment. Delete it to
release the resources.
</p>
<button
className="button"
aria-pressed={live}
onClick={() => setLive(!live)}
>
{live ? "Delete branch" : "Create branch"} ↗
</button>
<div className="resources" aria-live="polite">
{["API service", "Database", "Subdomain"].map((r, i) => (
<div key={r}>
<b>{r}</b>
<code>
{live
? [
"feature-42/api",
"db_feature_42",
"feature-42.example.test",
][i]
: "Not provisioned"}
</code>
</div>
))}
</div>
</section>
);
}
}
Next field study Osavus →