Basic

Running the server is a choice

The built in server is a development tool. The choice of what runs it is the difference between a program that answers and a program that is served.

What you will see

One line. The runner owns the restart, which is the claim.

About 1 min of reading

Try It

Write the runner contract

1

Write the runner file

printf 'app=make_app workers=4 limits=limits.txt\n' > /tmp/r.txt; cat /tmp/r.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One line with three names. Three names is the contract of the runner.
2

Check the factory exists

printf 'make_app\n' > /tmp/f.txt; grep -c -f - /tmp/f.txt /tmp/r.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
1. The name the runner uses exists in the code, which is the check.
3

Write the restart claim

printf 'restart=runner owns=process,logs\n' > /tmp/o.txt; cat /tmp/o.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One line. The runner owns the restart, which is the claim.

Data Flow

An app to a runner
1 The app is created by a factory
↓
2 The runner imports the factory
↓
3 The runner sets the limits
↓
4 The runner owns the restart
Why this works
Why the choice is made early

The runner decides the limits. Limits decided late are limits that the first request already passed.

The observable difference

A restart after a change. The built in server does not restart, and the difference is the whole test.

Examples

The built in server is single user

It has no limits and no restart. Both are features of a tool, not of a component.

The runner is a component

It owns the process, the restart, and the logs. Owning three things is owning a contract.

The choice is written

The runner names the app and the limits. A runner that is remembered is a runner that will drift.

← The debugger is a switch
Previous Lesson
The debugger is a switch
Next Lesson
Layers between the app and the client
Layers between the app and the client →