# in `in` is the family's file drive. It keeps folders and files, resumable uploads, previews and thumbnails, a trash, sharing with people and by link, and per-person quotas. It also stores bytes for the other family apps through a machine API. It is one binary, `in`, with the web UI, the API, the background workers and the operator commands. Files are plain files in a blob tree, and `in export` writes them out as an ordinary folder tree that needs no `in` to read. `in` depends on `im` for sign-in (OpenID Connect) and the people directory. Once a person is signed in, their files keep working while `im` is down. The shared contracts are in `docs/contracts.md`; the design is in `docs/architecture.md`; the code rules are in `docs/conventions.md`. ## Build You need Rust stable (edition 2024). The stylesheet is compiled from `style/` at build time, so there is no Node step. ```sh cargo build --release -p in-web # binary: target/release/in cargo test --workspace ``` Install the binary and the unit: ```sh sudo install -m 0755 target/release/in /usr/local/bin/in sudo useradd --system --home-dir /var/lib/in --shell /usr/sbin/nologin in sudo install -d -o in -g in -m 0700 /var/lib/in sudo install -d -m 0755 /etc/in sudo install -m 0644 deploy/in.service /etc/systemd/system/in.service ``` Do not enable the unit until the configuration and the `im` client below are in place. ## Configuration `in` reads `--config `, then `IN_CONFIG`, then `config/in.toml`. A missing file is created from `config/in.example.toml` on first run. Unknown keys are an error, so a typo fails at start-up. The file holds no secrets. The OIDC client secret and the S3 keys are read from files that only the service user can read; `in` refuses a secret file that group or world can read: | Key | Meaning | |---|---| | `database`, `data_dir` | Database file and data directory (blobs, staging, `in.key`, `in.lock`). The data directory is created with mode 0700, and the database file and its `-wal` and `-shm` files with mode 0600. | | `listen` | Address to bind. Keep it on loopback and put the reverse proxy in front. | | `base_url` | Public origin with no trailing slash. An `https` origin turns on `Secure` cookies and HSTS. Plain `http` is accepted only for a loopback host (`localhost`, `127.0.0.0/8`, `::1`), and never with userinfo. | | `trusted_proxies` | Proxies whose `X-Forwarded-For` is believed. Behind Ferron on the same host, `["127.0.0.1/32"]`; left empty there, every visitor counts as the proxy. | | `[oidc]` | `issuer` (the `im` origin), `client_id` (the id `im` printed for this client), `client_secret_file`. | | `[storage]` | `backend = "local"` (default) or `"s3"` with `[storage.s3]`. | | `[backup]` | Optional. `dir`, `interval_hours`, `keep`, `healthcheck_url`. See *Backups*. | | `[limits]` | Optional defaults the admin page may override: quotas, purge days, upload size, link length. | At start-up `in` logs a warning when `listen` is a loopback address with no `trusted_proxies`, when `[backup]` or `[oidc]` is not configured, and when `database` is outside `data_dir`. None of them stops the server. The admin page at `/admin` shows, next to each runtime value, whether it was set there, comes from the file, or is the built-in default. A blank field on that page removes the page's value again. ## First run 1. Start the server once to create the configuration and the instance key, then stop it: ```sh IN_CONFIG=/etc/in/in.toml in serve ``` 2. Register `in` as a client of `im` (run on the `im` host, where its data directory is). Replace `` with the value of `base_url`: ```sh im client add --name in \ --redirect-uri "/auth/callback" \ --post-logout-uri "/" \ --backchannel-uri "/auth/backchannel-logout" \ --family-key in --public-url "" \ --scopes "openid profile email directory.read" ``` `im` prints the client id and its secret once. Save the secret to the file named by `client_secret_file` (`/var/lib/in/oidc_client_secret`, mode 0600, owned by `in`), and copy the printed client id into `client_id`. The scopes must include `directory.read`, which `in` uses to read the people directory; `im` does not grant it unless it is listed. 3. Put the reverse proxy in front (see `deploy/ferron.conf`, an example for Ferron that proxies `https://in.example.com` to `127.0.0.1:7655`). Ferron must not buffer responses: the live update stream depends on it. Set `trusted_proxies = ["127.0.0.1/32"]`, so the share-password throttle sees each visitor's address, and keep `/s/` paths out of the access log: a share link's token is in its path. 4. Start the service: ```sh sudo systemctl enable --now in curl -s http://127.0.0.1:7655/healthz # ok ``` The first person who signs in becomes a member. Administrators are the people `im` marks as admins. The service unit runs `in serve` as the `in` user with systemd hardening (read-only system, no capabilities, a system-call filter). Its writable paths are the state directory and, when `[backup]` is set, the backup directory, which you add to `ReadWritePaths`. ## Backups With `[backup]` set, `in serve` writes a backup set every `interval_hours`, keeps the newest `keep` sets, and pings `healthcheck_url` after each good run (a failed ping is logged and nothing else). The server checks once a minute and runs when no attempt is recorded or the last attempt is at least `interval_hours` old. The attempt time is stored in the database before each run, so restarting the server does not start a run or move the schedule. A failing run is retried at the interval, not every minute. While the server runs, the *Backups* section of `/admin` has a *Back up now* button that starts a run at once. It is for administrators only and needs the form's CSRF token. At most one run is pending or running: a press made meanwhile starts nothing. The press is written to the audit log (`backup.requested`). Without `[backup]` the button is refused. A set is a directory `set-