Skip to main content
CRUCIBLE
Legacy Reference Archive: This 44-chapter book reference has been distilled into Academy A01 (8 Executable Modules) with Tier-Adaptive Productive Failure, Kore/Puck voice, and live Firecracker labs.
Open Academy A01 →
COURSE 0 · SERVER BUILDING & LIFECYCLE MASTERY

Zero-to-Production Linux, Containers, Networking & Recovery

PROGRESS: 0 / 72 (0%)0/44L · 0Q · 0VM
TUT 00 · WORKED TUTORIALS (START HERE) · 1,310 WORDS (7 MIN)

Before the continuous walkthrough

A terminal is an interface to a shell process. A shell interprets commands and launches other programs. An SSH session changes where your subsequent commands execute: a remote prompt can resemble your laptop's prompt.

FULL WAR-ROOM →
INTERACTIVE ARCHITECTURE · CLICK ANY LAYER TO INSPECT & RUN

Inside Your Private Linux Server (Shell -> Process -> Socket -> Disk)

Click any box below to see what lives at that layer, what fails in production, and the exact command to inspect it live.

spawnsbindspersistsBash ShellPTY · /home/operatorProcesses & PIDsFastAPI · Postgres · RedisTCP Sockets127.0.0.1 :8000 / :6432Filesystem & Logsconfig/ · logs/ · PGDATA
SELECTED LAYER · BASH SHELL
Interprets your commands, expands quotes/variables, and returns exit codes ($?).
Common failure: Running admin commands on the wrong host or directory when SSH prompts look identical.
$ hostname && whoami && pwd

Audience: a beginner who can open a terminal but has not operated a server. Environment: Bash inside your private Crucible Firecracker Linux VM (or any Ubuntu/Linux shell). Outcome: recognize paths, processes, configuration, credentials, commands and evidence before beginning the canonical deployment. Cost: no paid infrastructure is needed for these lessons.

Know which machine and directory you are using

A terminal is an interface to a shell process. A shell interprets commands and launches other programs. An SSH session changes where your subsequent commands execute: a remote prompt can resemble your laptop's prompt. Before an administrative change, inspect hostname, whoami and pwd, then compare them with the intended target. The current directory affects every relative file path.

Your private Crucible Firecracker Linux VM starts in your home workspace (~/playground) with pre-seeded lab files, scripts, and services. Use cd to enter a project folder and ls to inspect it. An absolute path starts at the filesystem root (/), while automation-service is relative to your current directory. Spaces in a path require quoting, such as cd "/path/with spaces/project". Do not copy an illustrative path without replacing it with the actual location.

A command block's $ or descriptive prompt is not part of the command unless explicitly shown as shell syntax. This guide's executable blocks omit prompt characters. Run a block in the environment named immediately above it. Always verify your target host with hostname before running system-level changes — never assume a local shell command belongs on a production host.

Understand arguments, output and errors

Run this from your Crucible VM workspace (~/playground) after installing the documented Python prerequisite:

bash
python3 labs/foundations.py --text 'hello useful servers'
python3 labs/foundations.py --text '   '
echo $?

The first command returns JSON with 3 words and 20 characters. The second rejects meaningless input. echo $? immediately after that command prints its exit status; a nonzero status indicates failure. Do not run another command first, because it replaces the status you intended to inspect.

Standard output normally carries a result; standard error normally carries diagnostics. A script can redirect them to different destinations. A final line saying something reassuring does not override an earlier failed operation. Read the first relevant error and the command's exit status before continuing.

Quotes preserve spaces within one argument. Single quotes preserve literal text; double quotes allow shell variable expansion. For example, "$LAB_TOKEN" expands an already loaded variable. An unset variable is not a valid credential merely because the command runs. Avoid command tracing while handling secrets, because it can expose expanded values.

Files, editors and configuration

Source files describe program behavior; configuration selects behavior for one environment; secrets authorize access. Keep those categories distinct. A .env file is normally hidden by simple directory listings; use ls -a when inspecting a directory's names, and avoid printing the file's secret contents into a shared terminal recording.

Use a text editor that preserves plain text. An editor may display a saved file while a running process continues using its old configuration. Read the service's reload/restart instructions and verify the active result after a change. A saved file is not proof that a process accepted it.

The supplied setup_lab.py generates random disposable credentials and exclusively creates .env; it refuses an existing file. That refusal protects earlier configuration. Reuse the current lab's file or create a new owned working copy. Do not delete an unknown file simply to get past the refusal.

The tutorial may load the generated local file with:

bash
set -a
. ./.env
set +a

This exports assignments to child processes. Sourcing is shell execution, so do this only with the locally generated file you trust. A second terminal does not automatically inherit the first terminal's loaded variables. Enter the same example directory and load the intended configuration in each terminal that needs it.

Programs, processes and services

A program is stored code. A process is a running instance with memory, an environment and a working directory. Starting two processes from the same source does not guarantee that they share configuration or a database. A relative sqlite:///jobs.db URL in two different directories can point to different files.

A foreground server occupies its terminal until it stops. Open another terminal for the worker or client instead of assuming the first command finished. Ctrl-C normally requests the foreground process to stop. A process supervised by Docker or systemd may restart according to its policy, so use that supervisor's documented stop command for the owned service.

A port identifies a network listener. Binding 127.0.0.1 limits it to that machine's loopback interface; binding 0.0.0.0 listens on available IPv4 interfaces and needs the intended network/firewall controls. A port number in a tutorial is not proof that the corresponding process is listening. Verify it on the correct machine.

Read the application contract

The API accepts bounded JSON text and returns 202 with a durable job ID. The worker later processes committed jobs. The client polls the ID for the final result. This separation means a quick successful submission does not prove that the worker is healthy.

Learn these response meanings before troubleshooting:

StatusWhat to investigate
200/202Read the body: success may mean retrieval or acceptance, not completed work
401Missing, invalid, expired or revoked credentials
403Recognized identity lacks the required permission
404Route/object unavailable; another tenant's object is intentionally hidden
409The requested state or idempotency key conflicts with existing work
422Input shape/content failed validation
429Rate/admission limit rejected the operation
503A required dependency or readiness condition is unavailable

JSON is a data format, not permission. A user-supplied tenant field cannot authorize access to that tenant. An idempotency key lets retries refer to the same intended operation; changing the key to escape a failure may create extra work. A transaction groups changes that must commit together, and a unique database constraint resolves simultaneous duplicate submissions.

Dependencies, versions and change history

Python imports libraries from its selected environment. The example's virtual environment keeps its dependencies separate from unrelated projects. pyproject.toml declares requirements; uv.lock records exact resolution. uv sync --frozen installs that resolution without silently redefining the release. If it fails, investigate the runtime, lock consistency and network instead of immediately deleting the lock.

Git records versioned source changes. Before editing a supplied repository, inspect git status and preserve unrelated changes. A Git revision does not include ignored secrets or a database automatically. A container image packages a runtime filesystem; a container is a process instance; a volume is state whose lifecycle can outlast that process. Rebuilding an image does not restore lost data.

Your first diagnostic exercise

Predict the successful foundations output before running it. Run the blank-input case and explain the nonzero status. Then read the reference API/worker architecture and answer: which component accepts work, which persists it and which completes it? Use the canonical walkthrough to stop only the lab worker, submit a synthetic job, observe it queued, restart that worker and verify the same ID completes.

Expected reasoning: the API can commit a job while the worker is stopped; data remains in the database; restarting the correct worker recovers processing. If the job never appears to the worker, compare the exact database URL and working directory in both processes. A DNS change cannot repair a worker reading a different local database.

Recovery: return to the documented working directory and known configuration, stop only the identified lab process and repeat the original job observation. Cleanup: stop owned foreground processes with their normal control path; retain the lab database and private configuration for the next lesson. Pass: you can identify the machine/directory/identity for each command, explain its output and diagnose one introduced fault without guessing or deleting unrelated state.

ACTIVE-RECALL MASTERY CHECKPOINT · TUT 00

Lock in what you just learned (3 quick questions)

PASS 2/3 FOR +30 XP
Q1.Before making an administrative change in a shell, which three commands confirm you are on the right host, user, and directory?
Q2.You run python3 labs/foundations.py --text " " and immediately run echo $?. What does a non-zero exit code mean?
Q3.Why should you avoid enabling shell command tracing (set -x) while exporting API keys or database passwords?
Answered 0 / 3