Skip to content

Latest commit

 

History

History
113 lines (89 loc) · 5.46 KB

server.md

File metadata and controls

113 lines (89 loc) · 5.46 KB
title Server
nav_order 8
has_children true

Server

The server receives uploads and serves the dashboard. Both are TypeScript: apps/server (Hono, Postgres) and apps/web (React). The same code runs for one team on a machine of its own, as described here, and as a hosted service many organisations sign up to, which infra/ describes.

Run it

From a checkout, with Node 22.18 or later and pnpm:

pnpm install
pnpm build      # builds the dashboard; the server then serves it
SESSIONLY_ADMIN_EMAIL=you@example.com pnpm run server

(pnpm run server, not pnpm server: that is a command of pnpm's own, which starts nothing here.)

That starts it on http://127.0.0.1:8080 with an embedded database in apps/server/data/pglite, which is enough to try it or for a small team. Open that address: the dashboard opens as its admin, SESSIONLY_ADMIN_EMAIL, with no signing in (see below). Set DATABASE_URL=postgres://… to use a Postgres server (16 or later).

Settings can also be kept in a file named .env at the top of the repository, one NAME=value a line; pnpm run server reads it, and git ignores it. All of them are in Configuration.

Then make a token for each machine on the dashboard's Connect page, and on that machine:

sessionly connect http://127.0.0.1:8080 --token sly_…
sessionly upload

With Docker

The server and Postgres together:

docker compose up -d

It listens on port 8080 of the machine; SESSIONLY_PORT names another. The compose file hands the container the admin's address and token, the two page-count settings and the four SESSIONLY_DEMO_* settings (see Server configuration), from the environment or from a .env file beside it. Other settings (SESSIONLY_DB_POOL, SESSIONLY_RATE_PER_MINUTE and so on) have to be added to the file's environment: list to reach the server.

Each release also has an image, ghcr.io/kivanow/sessionly-server:v<version>. It is the ee server, which without a license behaves exactly like the core one. It says which release it is (server_version on figures and the export's first line). A build of a checkout says unreleased, unless it is given the tag it was built from: SESSIONLY_BUILD_VERSION=v0.9.0 docker compose up -d --build (the hosted setup's update.sh --build does it itself, from the checkout's tag, and says unreleased when anything in the checkout differs from it).

Nobody signs in

A server of your own has no sign-in: whoever opens the dashboard is its admin, as SESSIONLY_ADMIN_EMAIL (admin@localhost unless set). Anyone who can reach the server can therefore see every session and make tokens, so keep it where only your team can reach it: on this machine, a private network or a VPN, or behind a proxy that asks who is there.

What is sent to it still takes a token: each machine connects with one made on the Connect or Team page (see People, tokens and sign-in), and its sessions are filed under that token's person. Signing in with Google or GitHub, and a dashboard where each person sees only their own sessions, are the hosted service's.

Before anyone else uses it

  • Put it behind HTTPS. The sessionly binary refuses plain http:// for anything but this machine (localhost, 127.0.0.1, [::1]).
  • Decide who can reach it: anyone who can is its admin (see above).
  • Know what the dashboard sends: it counts which of its pages are opened, and SESSIONLY_TELEMETRY=off stops that. See Dashboard.

Running it

  • Health. GET /healthz answers {"ok":true} while the server runs. GET /readyz asks the database first and answers 503 when it does not reply. Neither needs a token.
  • The database is brought up to date at every start, in one transaction, so a new version needs nothing run by hand. If that fails the server says so and stops.
  • Nothing is deleted by age. Sessions and pull requests stay until someone stops a repository or a session is taken back. On the hosted service (the ee server), an organisation its owner deleted is removed after 7 days, and everything of it with that. That server does this once an hour. pnpm org purge does that pass now, and pnpm org restore <id> clears a deletion that has not been purged. The default organisation is never removed, and a server of your own has no deleting of organisations: drop the database instead.
  • There is no request log. Errors the server did not expect are printed, the first five in any ten seconds and then a count of the rest.
  • A request can be 32 MB at most, which is far more than a session's upload.
  • A limit on requests per token is off on a server of your own unless SESSIONLY_RATE_PER_MINUTE is set, and 600 a minute on the hosted service unless it is. Adding people is the hosted service's, limited to 30 an hour per organisation.
  • Stopping it (SIGINT, SIGTERM) closes the server and its database connections first.

What was checked

Checked with the real binary and one machine's history, against both the embedded database and Postgres in Docker: 100 sessions uploaded in under three seconds, a repeat upload sent nothing, and the server's totals equal the local sessionly summary exactly.