new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Bun · all subjects

deployment

70 notes in this subject, read out of this brain and free to use. This is page 2 of 2.

Run custom TanStack Start server with Bun

Add a start script to package.json as `bun run server.ts`, then build and start with `bun run build` followed by `bun run start`. The server listens on port 3000 by default; set PORT environment variable to change it.

systemd Type and Restart options for Bun

For Bun services, typically use Type=simple. The Restart policy options are: no, on-success, on-failure, on-abnormal, on-watchdog, on-abort, or always. Use Restart=always for most applications.

Run Bun as non-root user with systemd

To run a Bun application as a non-root user, set User=YOUR_USER in the [Service] section of the systemd service file. For security reasons, running as root is not recommended. Replace YOUR_USER with the actual username and /home/YOUR_USER with the user's home directory.

Allow non-root Bun to listen on ports 80 and 443

Non-root users cannot listen on ports 80 or 443 by default. To allow this, run: setcap CAP_NET_BIND_SERVICE=+eip /home/YOUR_USER/.bun/bin/bun. This requires sudo permissions. The capability is removed when the binary is replaced (e.g., by bun upgrade), so the command must be re-run after upgrades. Alternatively, add AmbientCapabilities=CAP_NET_BIND_SERVICE to the [Service] section of the service file.

Enable and start a systemd service for Bun

To enable a systemd service (allowing auto-start on reboot), run: systemctl enable my-app (requires sudo). To start the service immediately without rebooting, run: systemctl start my-app

systemd service file structure for Bun

A systemd service file for Bun has three sections: [Unit] with Description and After=network.target; [Service] with Type=simple, User, WorkingDirectory, ExecStart (requiring absolute paths like /home/YOUR_USER/.bun/bin/bun run index.ts), and Restart=always; [Install] with WantedBy=multi-user.target

Create a systemd service file for Bun applications

To run a Bun application as a daemon with systemd, create a service file in /etc/systemd/system/. Use the command: cd /etc/systemd/system && touch my-app.service

Check systemd service status

Check the status of a Bun application running as a systemd service with: systemctl status my-app. The output shows the service name, loaded path, active status, main process ID, resource usage, and process details.

Reload systemd daemon after service file changes

After editing a systemd service file, run: systemctl daemon-reload to notify systemd that configuration files have changed.

Common systemd commands for Bun services

Common systemd commands: systemctl daemon-reload (notify systemd of file changes), systemctl enable my-app (enable auto-start), systemctl disable my-app (disable auto-start), systemctl start my-app (start the app), systemctl stop my-app (stop the app), systemctl restart my-app (restart the app).

Give your agent this brain