A small print server for an Ender 3 V2, running on a Raspberry Pi. It's a lightweight alternative to OctoPrint: one Go binary with no dependencies that switches the printer's plug, heats, checks the bed's tram and prints. tramline gui does all of that from a browser on your computer, the Pi can serve the same GUI itself behind a sign-in with your OpenID Connect provider, and a read-only web page on the Pi shows the print in 3D.
The name joins bed tramming with the serial line to the printer.
- Power: switches the printer through a Hue smart plug, on by itself for a print, and off once the nozzle is below 50 °C after any print it started.
- Heating: preheats to bed 80 °C and nozzle 150 °C by default, or any temperatures, and turns the heaters off.
- Tram checks: probes the four corners, with an inset and repeats if wanted, and says which knob to turn and which way. Every print and scheduled print checks first and won't start out of tram.
- Bed mesh: reads the mesh the printer holds, with no movement, reads each print's fresh mesh before the plug is cut, and keeps a history of them.
- Files: uploads G-code to the Pi, lists and deletes files, and copies files to the printer's SD card at about 14 KB/s, with cancel and retry.
- Checksums:
filesshows each file's SHA-256, its first 12 digits assha256sumstarts, or whole with--full, on the Pi and on the card. The Pi's files are read from its disk again when listed, at most every 10 minutes, and a file that no longer matches its upload is shown as damaged, and isn't copied or streamed. The card can't be read back over USB, so a card file's sum is what the Pi sent in a copy whose size then checked out.status,schedule listand both web pages show the sum of the file being printed, copied or scheduled, the web pages behind an "i" to hover or tap. - Printing two ways: streams the file from the Pi line by line, or prints from the SD card, which carries on if the Pi goes down.
- Scheduling: checks tram now, powers off, then at the set time powers on, checks again and prints unattended. It cancels itself if the check fails or another print has started since.
- Stopping: cancels a print with the heaters off, or an emergency stop with
M112and the plug cut. - Notifications: the Pi sends them to a Switchboard server when a print finishes, fails or is cancelled, when a tram check needs the knobs turned, when a scheduled print doesn't start, and when the heaters or power have a problem. Each event can be switched on or off, from
tramline notifyor the GUI, and the token stays on the Pi. - Status: power, temperatures, the current job, progress and how recent scheduled prints ended, also as JSON.
- Desktop GUI:
tramline guidoes everything the commands do in a browser on your computer, with drag-and-drop uploads, a 3D print view, a live tram check and the mesh as a coloured surface. - Web GUI with sign-in: optionally, the Pi serves the same full GUI itself, for a reverse proxy such as nginx with HTTPS, signed in with OpenID Connect, such as Pocket ID, instead of a client key. Off unless configured.
- Web page: a read-only status page with a 3D view of the print, served by the Pi to any browser or phone, with no login.
- Security: mutual TLS with a key per client, allowed and revoked by fingerprint on the Pi, listening only on the LAN and Tailscale. The web GUI uses the code flow with PKCE, checked ID tokens, server-side sessions and CSRF tokens.
- Simulator:
serve --simruns a simulated printer and plug, so prints and the GUI can be tried on your computer without the Pi. - One binary: server and client in one Go binary, standard library only, with no dependencies. The client runs on Linux and macOS, and the server on Linux, which can open the printer's serial port.
your computer ── HTTPS, client certificates ──┐ ┌── USB ──▶ printer
any browser ──── HTTP, read-only ─────────────┼─▶ Pi ┤
any browser ── HTTPS ─▶ nginx ── HTTP, signed ┘ └── LAN ──▶ Hue plug
in with OpenID Connect
The same binary is both server and client. Only the server touches the printer and the plug. The web GUI, the last line, is optional, with nginx on the Pi and the sign-in at your OpenID Connect provider.
From a printer that's off to a finished print with the printer off again:
tramline status # is anything running?
tramline upload part_PETG.gcode # save it on the Pi
tramline print part_PETG.gcode --from pi --bed-clear # the rest happens by itself
tramline web # watch it in the browser
tramline gui # or do all of it in the browserprint then does all of this, carrying on if your computer goes away:
- Turns the printer on if it's off.
- Heats the bed to 80 °C and the nozzle to 150 °C, the temperatures the PETG start G-code probes at, and checks tram. If the check fails, nothing has started:
statussays which knob to turn and which way, thentramline print --continuechecks again. - Prints.
- When the print ends, however it ended, turns the heaters off, waits for the nozzle to drop below 50 °C, and turns the printer off.
If you do something else with the printer during that wait, such as preheat, tram or power on, it stays on. Prints started from the printer's own screen leave it on too.
print always needs one of these. <file> in any command is the file's name on the Pi, which is the name it had when you uploaded it.
| How it prints | What it needs | |
|---|---|---|
--from pi |
The Pi sends the file line by line | Only upload. Don't restart the server during it, as it can't carry on afterwards |
--from sd |
The printer reads its own card, and carries on if the Pi goes down | upload, then copy. Copying takes about 1 minute per 800 KB, so large files are better from the Pi |
upload only ever saves on the Pi, and copy is the only thing that writes to the card, with the printer on:
tramline upload part_PETG.gcode
tramline power on
tramline copy part_PETG.gcode
tramline print part_PETG.gcode --from sd --bed-cleartramline schedule part_PETG.gcode --from pi --at "2026-11-06 06:00" --bed-clear
tramline schedule list
tramline schedule cancel 3schedule does this, with the time in your computer's timezone:
- Straight away, it turns the printer on if it's off, heats the bed to 80 °C and the nozzle to 150 °C, and checks tram. If the check fails,
statussays which knob to turn, andtramline print --continuechecks again, as often as needed. - On a pass, it turns the heaters off, waits for the nozzle to drop below 50 °C, and turns the printer off until the scheduled time.
- At the scheduled time, it turns the printer on, heats to 80 °C and 150 °C again, and checks tram again.
- A pass starts the print, which ends like any other, with the printer turned off. A fail cancels the print, with no second try, and turns the printer off, and
schedule listsays why. Nothing tells you when that happens, so check in the morning.
Keep the bed clear until it prints. If any print has started since you scheduled this one, it cancels itself without moving, as a part may be on the bed.
| Command | What it does |
|---|---|
status |
Power, temperatures and the current job |
gui [--no-open] [--port <n>] |
Open the full GUI in a browser, see below. Ctrl-C stops it |
web [--url] |
Open the web page, or just show its address |
power on|off |
Switch the plug. Off is refused while hot or printing |
preheat [bed] [nozzle], cool |
Heat, by default bed 80 °C and nozzle 150 °C, or turn the heaters off |
tram --bed-clear |
Probe the corners and report |
upload <path> |
Save a file on the Pi, nothing else |
copy <file>, copy --cancel |
Copy a file on the Pi to the card, or stop a copy |
files [--full], files rm <file> |
List files with their SHA-256 sums, or delete one from both the Pi and the card |
print <file> --from pi|sd --bed-clear |
Turn on if needed, heat, check tram, print, then turn off once cool |
print --continue |
Check tram again, after turning a knob |
cancel |
Cancel the print and turn the heaters off |
estop |
Emergency stop: M112, then cut the plug |
schedule <file> --from pi|sd --at "YYYY-MM-DD HH:MM" --bed-clear |
Check tram now, power off, then print at that time if tram still passes |
schedule list [--json], schedule cancel <id> |
List scheduled prints and how recent ones ended, or cancel one that hasn't started printing |
notify, notify set [--url <url>] [--link <url>] [--events <list>] |
Show or change the notifications the Pi sends to Switchboard, see below |
notify token [--clear], notify on|off, notify test |
Save Switchboard's token on the Pi, read from stdin and never shown, start or stop sending, or send a test |
Run tramline help for everything, including the options and the commands used on the Pi.
tramline gui opens a browser with everything the commands above do: files, with uploads by dragging them onto the window, printing and scheduling, cancelling, copying to the card, the plug, preheat and cool, tram checks, the Hue plug, notifications and an emergency stop. The print is drawn in 3D, as on the web page.
- It runs on your computer, not the Pi, on
127.0.0.1only, and talks to the Pi with this computer's key, the same way the commands do. The browser never gets the key. Ctrl-C stops it, and anything already sent to the Pi carries on. - It signs the browser in once, with a link that only works one time. To open it in another browser or after closing it, run
tramline guiagain. - The Pi still decides: printing, scheduling and tram checks need the "bed is clear" box ticked each time, and the Pi's own rules apply as they do to the commands.
- The emergency stop is held for just over half a second, so a stray click can't set it off.
The Pi can also serve the full GUI itself, the same page as tramline gui, to any browser that signs in with your OpenID Connect provider, such as Pocket ID. It's off unless web_gui is in /etc/tramline/config.json, and tramline gui keeps working as before either way.
- It listens on its own port, over plain HTTP, for a reverse proxy on the Pi that serves it over HTTPS, such as nginx in Docker reaching it at
host.docker.internal, which is thedocker0bridge. Never on the API's port, which still needs a client key. - Signing in: the authorization code flow with PKCE, as a confidential client, and the ID token's signature and claims checked. The session lasts 12 hours at most, or 1 hour unused, and Sign out, under the GUI's title, ends it.
- Who gets in: anyone your provider signs in for Tramline's client, so its access settings there are the gate.
allowed_groupslimits it further, by thegroupsclaim. - The Pi still decides, as with the commands and
tramline gui, and logs each sign-in and each command by user.
"web_gui": {
"listen_interfaces": ["docker0"],
"port": 8727,
"public_url": "https://print.devops.lan",
"oidc": {
"issuer": "https://auth.devops.lan",
"client_id": "<client ID>",
"client_secret_file": "/etc/tramline/oidc-client-secret",
"allowed_groups": []
}
}port defaults to 8727, and listen, one address:port, can replace listen_interfaces and port. public_url is the proxy's https:// address, from which the callback address and the allowed origin are made. The secret is only in client_secret_file, readable by the tramline group, such as root:tramline mode 640, and never in the config. In the provider, register Tramline as a confidential client with PKCE on and the callback URL <public_url>/auth/callback, such as https://print.devops.lan/auth/callback. It asks for the scopes openid profile, and groups when allowed_groups is set.
For the proxy: no WebSocket, and no headers needed. The status streams, /v1/events and /pi/events, say X-Accel-Buffering: no, which nginx follows, and uploads need client_max_body_size 256m. See the web GUI notes for the details and the security design.
The Pi can send a notification to a Switchboard server, which passes it on to wherever that's set up to send them: Discord, a phone and so on. To set it up, get Switchboard's address and a token for a source, then:
tramline notify set --url https://notify.example.lan
tramline notify token # asks for the token without showing it, or reads it from stdin
tramline notify test # sends one now, even while they're off
tramline notify ontramline notify shows the settings, which events send, and how the last send went. The GUI's More tab does the same. The events are print_finished, print_failed, print_cancelled, needs_adjusting, schedule_ended and problem, all on by default. Choose them with notify set --events print_finished,problem, or all. --link adds a link to each notification, such as the web page's address.
The token is kept on the Pi, readable by the server only, and nothing gives it back: the commands and the GUI only say whether one is saved. Sending never holds up a print. See notes/notifications.md for what each event says.
tramline web opens the page at http://raspberrypi:8726/, which also works on a phone. It shows status, temperatures and progress, with the file drawn in 3D as it prints. With nothing printing, it shows the last job. It also lists scheduled prints: all that are to come, and the last five that ended, with why.
- It's read-only and has no login, so anyone on the network or the tailnet can see the status, the current file's shape, and the names and times of scheduled prints.
- It can't affect a print, as it never talks to the printer.
- The head's position is worked out, not measured. It comes from how far through the file the print has got, about every second when streaming and every 30 seconds or so from the card.
Only Docker is needed, and the build uses the standard library alone. The macOS builds are for the client and the simulator: only Linux can open a real serial port, so the server stays on the Pi.
The justfile wraps the scripts. Run just in this folder to list its recipes:
just build # ./build.sh: check, test and build for Linux and macOS into dist/
just test # ./build.sh test: check and test only
just install # build, then install this machine's client as tramline in ~/.local/bin
just uninstall # remove it again
just deb # build the Pi's package, dist/tramline_<version>_arm64.deb (needs dpkg-deb)
just arch-pkg # build the Arch package in packaging/arch/ (makepkg -si there installs it)The packages use the version in VERSION. The Pi's .deb installs the server, its unit (enabled), its user, its data folder and a default config, and arch-config installs it from this repository's releases, which is how the Pi gets a new version. See Packages in the install notes.
just install takes TRAMLINE_BINDIR for another folder, which has to be on your PATH.
Prebuilt binaries are on the latest release. The Pi runs the server from the same program that other computers use as the client:
- Linux arm64, for the Raspberry Pi
- Linux x86_64
- macOS arm64
- SHA256SUMS
tramline_<version>_arm64.deb, the Pi's server package
Check the download and make it executable before installing it as tramline on your PATH, for example on a Mac:
shasum -a 256 -c --ignore-missing SHA256SUMS
chmod +x tramline-darwin-arm64
mv tramline-darwin-arm64 ~/.local/bin/tramlineOn Linux, use sha256sum instead of shasum -a 256. The binaries aren't signed, so on a Mac, a copy downloaded in a browser also needs xattr -d com.apple.quarantine ~/.local/bin/tramline before it will run.
The server is already on the Pi, so a new computer only needs a client. It must be on the same network as the Pi, or on its tailnet.
-
Install
tramline: download it as above, build it withjust install(Docker and just, no Go), or on Arch build the package inpackaging/arch/.~/.local/binhas to be on your PATH. Ubuntu and Fedora add it by default, but macOS and Arch don't, so addexport PATH="$HOME/.local/bin:$PATH"to~/.zshrcor~/.bashrcthere. -
Create this computer's key, in
~/.config/tramline/on Linux and macOS alike. It stays on this computer, and the command prints only the public fingerprint:tramline keygen
-
On the Pi, get the server's fingerprint and allow the new client:
sudo -u tramline tramline fingerprint sudo -u tramline tramline allow <client-fingerprint> --name <computer-name>
-
Back on the new computer, log in and check it works:
tramline login https://raspberrypi:8726 <server-fingerprint> tramline status
-
Add an SSH host called
raspberrypito~/.ssh/config, using userpi. Saving logs uses it. The client itself doesn't need SSH.
This is only needed if the Pi itself is replaced. See Security, Install and updates, Config and the test plan in the engineering notes. In short: install the .deb from a release with sudo apt install ./tramline_<version>_arm64.deb, then sudo -u tramline tramline init --ip <address>, sudo systemctl start tramline and tramline hue pair on the Pi, then fill in /etc/tramline/config.json with the plug's UUID from tramline hue plugs. The printer needs the USB cable with its +5V wire cut, see The USB cable in the notes.
This runs a print on a simulated printer on this machine, with a throwaway login, and doesn't touch the Pi or the printer. Ctrl-C ends it.
./sim-web.sh [--sd] [--minutes <n>] [--schedule <minutes>] [--lan] [--no-open] <file.gcode>
./sim-gui.sh [--minutes <n>] [--fail-tram] [--web] [--no-open] [--port <n>] [file.gcode ...] # the GUI, with these files uploaded--web tries the web GUI instead, served by the simulated Pi at http://127.0.0.1:18727/, with a made-up sign-in provider that signs anyone in as sim.
The API uses mutual TLS: each client has its own key, and the Pi keeps a list of those allowed, by fingerprint. It listens on the LAN and on Tailscale, set by listen_interfaces in the Pi's config, and nowhere else. The web page is the one exception to needing a key, and can't reach the API. The web GUI, if configured, has its own port and needs a sign-in with your OpenID Connect provider instead, see above and notes/security.md.
notes/, the engineering notes, have the design, firmware findings, test results and open issues, including what has only run on the simulator.