Skip to content

About

StartOS 0.4.x service package for CryptPad — end-to-end encrypted collaboration suite

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

cryptpad-startos

StartOS 0.4.x service package for CryptPad — an end-to-end encrypted, open-source collaboration suite.

Built on @start9labs/start-sdk 2.0.9. This is a ground-up rewrite, not a port: the previous community package targeted embassyOS 0.3.x and CryptPad 5.2.1, and shares no code with this one.

Architecture

The two-origin requirement

This is the single constraint that shapes the package. CryptPad renders document content inside an iframe served from a separate "safe" origin. Upstream is explicit that httpSafeOrigin must be a different domain from httpUnsafeOrigin — if they are the same, the sandbox stops isolating and the security model that makes the encryption meaningful is weakened.

So the package exports two hosts, not one:

Host id Port Interface Purpose
main 3000 ui The interface users load
sandbox 3000 sandbox Isolated origin for rendering document content

Each MultiHost gets its own hostnames from StartOS, which is what makes the two origins genuinely distinct. Both bind port 3000 on purpose. CryptPad only opens a second listener (httpSafePort) when httpSafeOrigin is unset — that is its local-development fallback. Once a real sandbox origin is configured it serves both origins from one port and tells them apart by Host header, exactly as its production nginx example does. The isolation comes from the differing hostnames, not the ports. The operator pairs them with the Set Addresses action; both must be reachable from the browser, so they have to be the same kind of address (both .local, or both .onion).

websocketPort (3003) is not exported — the browser reaches it through the main origin.

Configuration is native

There is no shell-based config munging. The flow is:

Actions ──► fileModels/config.json  (StartOS-owned settings, zod + .catch() defaults)
                     │
                     └──► fileModels/cryptpadConfig.js  (renders CryptPad's config.js)
                                     │
                                     └──► CRYPTPAD_CONFIG env var points CryptPad at it

main.ts reads config.json with .const(effects), so changing a setting re-renders config.js and restarts the daemon automatically.

CryptPad resolves its config from CRYPTPAD_CONFIG when set (lib/load-config.js), which lets us generate the file onto the persistent volume rather than patching the one baked into the image.

Decrees

Some settings are not config.js keys. CryptPad initialises restrictRegistration to false and then lets admin decrees override it, so writing it into config.js would be silently ignored. fileModels/decree.ndjson appends to CryptPad's own append-only decree log — the same thing the admin panel writes. The log is appended to, never rewritten, so settings applied through CryptPad's UI survive.

Storage

Everything persistent lives on the main volume, mounted at /cryptpad-data. CryptPad's default storage paths are relative to its working directory, which would put user data in the container's ephemeral layer — so the generated config sets them to absolute paths on the volume:

Path Contents
datastore/ Documents (channel data)
blob/ Uploaded files
block/ Account/login blocks
data/pins Which documents each account keeps
data/archive Deleted-but-recoverable content
data/decrees Admin decree log
data/logs, data/tasks Server logs and scheduled tasks

Backups cover the whole volume, so all of the above plus instance customization are captured.

OnlyOffice

The spreadsheet/document/presentation editors are installed at image build time (install-onlyoffice.sh --accept-license --trust-repository). StartOS services do not have the outbound network access that a runtime install would need, so baking them in is the only way they work. rdfind hard-links the assets duplicated across the bundled editor versions to keep the image smaller.

Layout

startos/
  manifest/       package id, images, description (5 languages)
  interfaces.ts   the two-host main/sandbox split
  main.ts         daemon + health check
  fileModels/     config.json, cryptpadConfig.js, decree.ndjson
  actions/        set addresses, admin keys, admin email, upload size, signups
  init/           install seeding + reactive origin watcher
  versions/       version graph
  i18n/           typed string dictionaries

Building

Requires start-cli, npm, git, jq.

npm install
make x86        # or: make arm

The version that ships is whatever startos/versions/index.ts exports as current — not package.json. Bump the :N revision suffix on every rebuild you intend to install, because installing a version that is not strictly newer is silently ignored.

start-cli s9pk inspect cryptpad_x86_64.s9pk manifest | jq '{version, osVersion, sdkVersion}'
start-cli package install -s cryptpad_x86_64.s9pk

A zero exit code from install is not proof the service is running — verify with package list, then package stats (expect a non-null container id), then package logs cryptpad.

Updating CryptPad

See UPDATING.md.

License

Package: AGPL-3.0-or-later, matching upstream CryptPad.

About

StartOS 0.4.x service package for CryptPad — end-to-end encrypted collaboration suite

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages