Running the Console from Its Source
Use this page to run the console on your own computer, against a Tadoru server that runs on the
same computer. The console then reloads as you change its code. A server built with the feature
console serves the console itself on console_listen, so you need these steps only to work on
the console.
What you need
Section titled “What you need”- A Tadoru server that runs on this computer. Its API listens on a Unix socket,
api.sock, in its runtime root, the directory that holds the socket of the server.--runtime-dirnames that directory (The command line). mise, which installs the versions of Node and pnpm that the console needs.socat, which connects a TCP port to the socket of the server. On a Mac, install it with Homebrew:brew install socat.
-
Start the Tadoru server, and name its runtime root. For example, at the root of the repository:
Terminal window cargo run -p tadoru -- --data-dir ./data --runtime-dir ./data/run -
In a terminal, connect the port 8080 to the socket of the server. Use the path of the socket on your computer:
Terminal window socat TCP-LISTEN:8080,bind=127.0.0.1,reuseaddr,fork UNIX-CONNECT:./data/run/api.sockThe path in this example is relative to the root of the repository, so run the command there. Keep this terminal open while you work.
-
In
console/, the folder of the console in the Tadoru repository, copy.env.exampleto.env.local. Make sure that it holds this line:Terminal window TADORU_API_URL=http://127.0.0.1:8080Git ignores
.env.local, so the file stays on your computer. -
Install the tools and the packages once, in
console/. mise readsmise.tomlat the root of the repository, somise installworks there too:Terminal window mise installpnpm install --frozen-lockfile -
Start the console, in
console/:Terminal window pnpm dev -
Open the address that
pnpm devprints, usuallyhttp://localhost:5173/.
The dev server sends each request for /api to the address in TADORU_API_URL. socat passes it
on to the socket, so the console and the server meet as they do in a release.
What to expect
Section titled “What to expect”- A reload keeps your session, because the console reads it back from the server. A server older
than
GET /api/sessioncannot give it back, and then the console asks you to log in again. - If the server has no administrator yet, click “Set up Tadoru” on the login page. Read Setting Up the First Administrator.
- If
socatstops, or the server stops, each read of the console fails with a network error. Start them again, then use “Try again” or “Read again”. - Port 8080 must be free. If another program uses it, choose another port in the
socatcommand and inTADORU_API_URL.