Defensible belief records with provenance. Self-hosted. Install guide inside.
10K+
Foundation keeps a defensible record of what your organization believed about real-world entities, such as properties and their owners, and why. Every fact it stores carries its source document, confidence and the time it became known, so you can answer "what did we believe then, and on what evidence?" years later.
This page is the complete install guide. The compose file and Caddyfile are on it; the settings file ships in the image.
mongod --replSet rs0, run rs.initiate({ _id: 'rs0', members: [{ _id: 0, host: '<host>:27017' }] }) once in mongosh with the host name this server reaches it by, and add replicaSet=rs0 to MONGODB_URI. Create a database for Foundation and a user with the dbOwner role on it (or readWrite plus dbAdmin). readWrite alone is not enough: startup migrations manage collection validators.EXTRACTION_PROVIDER=anthropic and ANTHROPIC_API_KEY. Without them, documents upload and store but extraction returns "not configured".foundation.example.com. Foundation obtains and renews its HTTPS certificate automatically.Create a directory for the install and work from it:
sudo mkdir -p /opt/foundation && sudo chown "$USER" /opt/foundation
cd /opt/foundation
Save the compose file below as docker-compose.yml and the Caddyfile below as Caddyfile in that directory.
Pick the newest release on the Tags tab, for example v1.0.0. Copy that release's settings file out of the image as .env and keep it private:
docker run --rm jalantechnologies/foundation:v1.0.0 cat .env.example > .env
chmod 600 .env
openssl rand -hex 32 # use the output as ACCOUNTS_TOKEN_SIGNING_KEY
Fill in every value marked REQUIRED; they are listed under Required settings below. Set FOUNDATION_VERSION to the same tag, so a restart never changes your version. Every other setting in the file is optional and describes its allowed values and default.
Start Foundation:
docker compose up -d
docker compose ps # wait until app shows "healthy"
Open https://<APP_DOMAIN> right away and complete first-run setup, which creates your organization and its first admin. That organization becomes the host of the instance: its members upload and ingest documents, and partners you let sign up can only read them. Sign-up stays closed until setup is done.
Do not leave this step for later. Every HTTPS certificate is published in public certificate transparency logs, so your hostname becomes discoverable within minutes of the first start, and until setup is done anyone who finds it can complete it.
If the app does not become healthy, docker compose logs app names the problem, for example a missing setting or a MongoDB user without enough privileges.
The containers hold no state. You can delete them, upgrade the image or move to a new server, and nothing is lost as long as you keep these three things:
| What | What happens if it is lost |
|---|---|
| The MongoDB database | Every account, organization, entity, fact and audit record is gone. |
| The document bucket | Facts still exist but no longer point to readable source documents. The provenance chain cannot be rebuilt. |
The .env file | Foundation cannot reach the database or bucket, and a new ACCOUNTS_TOKEN_SIGNING_KEY signs every user out. |
Back up the database and the bucket together, on the same schedule: a database restored without the matching documents leaves facts whose source cannot be shown. Keep a copy of .env somewhere other than the server, such as a password manager.
To move to a new server, install Docker, copy docker-compose.yml, Caddyfile and .env, point DNS at the new server and run docker compose up -d with the same FOUNDATION_VERSION.
Admins see the running version in the sidebar, and an "Update to" link there when a newer release is published (turn this off with UPDATE_CHECK_ENABLED=false). Skipping versions is supported.
Read the release notes for every version between yours and the target.
Back up the database and the bucket.
Replace docker-compose.yml with the compose file on this page. A release can change the commands the containers run, and the new image does not start under an older compose file.
Set FOUNDATION_VERSION in .env to the new tag. If the release notes mention a new setting, read its description in the new release's settings file (docker run --rm jalantechnologies/foundation:<tag> cat .env.example). Then:
docker compose pull
docker compose up -d
Sign in as an admin and confirm the running version in the sidebar.
On start, before serving requests, Foundation applies any data migrations the database has not seen yet and records each one in the schema_migrations collection.
Rolling back. Set FOUNDATION_VERSION back to the previous tag and run docker compose up -d. Every migration is required to stay compatible with the previous release, so the previous version runs against the upgraded database and logs a warning naming the newer version. To go back more than one release, restore the backup taken before the upgrade.
Foundation writes its logs to stdout. Read them with:
docker compose logs -f app # or worker, beat, redis, caddy
docker compose logs --since 1h app
Docker keeps them on the server, rotated at 10 MB x 5 files per container. LOG_LEVEL in .env controls how much is written. To send logs to your own system, change the x-logging block in docker-compose.yml to another Docker logging driver such as syslog, fluentd, gelf or awslogs. Foundation never ships logs anywhere itself.
Foundation makes three kinds of outbound requests. Ingesting a document sends it to your extraction provider (Anthropic, with your key). For deeds recorded in Maricopa County, Arizona, ingestion also asks the county recorder's public index for the official recording date, sending only the recording number. The only scheduled request is the version check against Docker Hub's public tags API, which sends nothing about your install.
Foundation is proprietary software from Jalan Technologies. In short:
Questions, bug reports and upgrade help: [email protected]. For commercial terms: [email protected].
The full license is in the image at /app/LICENSE:
docker run --rm jalantechnologies/foundation:latest cat /app/LICENSE
# Foundation on a single server: app, worker and beat (one image), Redis as the
# job queue, and Caddy for HTTPS. MongoDB and the document bucket are outside
# this file and are reached through the settings in .env.
#
# Put this file, the Caddyfile and a filled-in .env in one directory, then run
# `docker compose up -d`. Compose reads .env twice: to fill in ${...} below,
# and as the environment of app, worker and beat. Keep .env readable only by
# you (chmod 600).
#
# Upgrade by replacing this file with the one published for the new release,
# setting FOUNDATION_VERSION in .env to its tag and running
# `docker compose up -d` again.
name: foundation
x-logging: &logging
driver: json-file
options:
max-size: '10m'
max-file: '5'
x-app-base: &app-base
# Pin FOUNDATION_VERSION in .env to a release tag such as v1.0.0 so a restart
# never changes the version you run. FOUNDATION_IMAGE, when set, replaces the
# whole reference, for example to pull from your own registry mirror.
image: ${FOUNDATION_IMAGE:-jalantechnologies/foundation:${FOUNDATION_VERSION:-latest}}
restart: unless-stopped
logging: *logging
init: true
working_dir: /app/src/apps/backend
env_file:
# Standard compose .env syntax: wrap a value containing `$` in single
# quotes, or compose treats it as a variable reference.
- path: ./.env
required: true
environment:
APP_ENV: production
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
depends_on:
redis:
condition: service_healthy
services:
app:
<<: *app-base
# Same as `npm start` (make run-engine) minus `--reload`, which is only
# useful for local development.
command:
['pipenv', 'run', 'gunicorn', '-c', 'gunicorn_config.py', 'web_app:app']
healthcheck:
test:
- CMD
- python3
- -c
- "import urllib.request; urllib.request.urlopen('http://localhost:8080/api/health', timeout=3)"
interval: 15s
timeout: 5s
retries: 3
start_period: 60s
worker:
<<: *app-base
# Same flags as `make run-worker`, plus --quiet (no banner, so lines stay
# JSON). Invoked without make so SIGTERM reaches celery and in-flight
# tasks get a warm shutdown.
command:
- pipenv
- run
- celery
- -A
- worker_app
- --quiet
- worker
- --loglevel=${LOG_LEVEL:-info}
- --concurrency=4
- --queues=critical,default,low
- -E
stop_grace_period: 60s
beat:
<<: *app-base
# Jobs that declare cron_schedule only fire while beat is running.
command:
[
'pipenv',
'run',
'celery',
'-A',
'worker_app',
'--quiet',
'beat',
'--loglevel=${LOG_LEVEL:-info}',
]
redis:
image: redis:7-alpine@sha256:02f2cc4882f8bf87c79a220ac958f58c700bdec0dfb9b9ea61b62fb0e8f1bfcf
restart: unless-stopped
logging: *logging
# Redis is the Celery broker, not a cache. noeviction makes writes fail
# loudly at the memory cap instead of silently dropping queued jobs.
command:
- redis-server
- --appendonly
- 'yes'
- --maxmemory
- '512mb'
- --maxmemory-policy
- 'noeviction'
volumes:
- redis-data:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 10s
timeout: 3s
retries: 5
caddy:
image: caddy:2.11.7-alpine@sha256:e70b164da81ef698b3ad19af799ea6086ce6d9e48ed4079eb9fe26f6fbf14ee5
restart: unless-stopped
logging: *logging
environment:
APP_DOMAIN: ${APP_DOMAIN:?set APP_DOMAIN in .env}
ports:
- '80:80'
- '443:443'
- '443:443/udp'
volumes:
# After editing the Caddyfile, apply it with
# `docker compose up -d --force-recreate caddy`: a plain restart can keep
# serving the old file if your editor replaced it rather than edited it.
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy-data:/data
- caddy-config:/config
depends_on:
app:
condition: service_started
volumes:
redis-data:
caddy-data:
caddy-config:
# Caddy obtains and renews the TLS certificate for APP_DOMAIN automatically
# (Let's Encrypt). Certificates live in the caddy-data volume. Deleting that
# volume forces re-issuance and can hit Let's Encrypt rate limits.
#
# Request access logs come from gunicorn, so Caddy only logs its own events
# (certificate issuance, upstream errors) to stdout.
#
# Security headers (CSP, HSTS and the rest) come from the app, so they are the
# same behind any proxy. Do not add a `header` block here that sets them too.
{$APP_DOMAIN} {
encode zstd gzip
reverse_proxy app:8080
}
Foundation does not start until these are set in .env. They are copied from the settings file in the image, which also describes every optional setting (allowed origins, logging, AI extraction, update checks and more) with its allowed values and default. To read the whole file without saving it:
docker run --rm jalantechnologies/foundation:latest cat .env.example
# REQUIRED. Public hostname users open in the browser, without https://.
# Caddy requests a TLS certificate for it, so DNS must already point here.
APP_DOMAIN=foundation.example.com
# REQUIRED. MongoDB connection string, including the database name. MongoDB
# must run as a replica set (Atlas and DigitalOcean managed MongoDB are); for
# one you run yourself, name the set with replicaSet=<name>.
MONGODB_URI=mongodb://user:[email protected]:27017/foundation?replicaSet=rs0
# REQUIRED. Secret used to sign access tokens. At least 32 characters and
# unique to this install; the app refuses to start otherwise. Generate one with
# `openssl rand -hex 32`. Changing it signs every user out.
ACCOUNTS_TOKEN_SIGNING_KEY=
# REQUIRED. Bucket name. Create it first; Foundation does not create buckets.
STORAGE_S3_BUCKET=
# REQUIRED. Bucket region, for example us-east-1 or nyc3. Services without
# regions accept any value.
STORAGE_S3_REGION=
# REQUIRED. Access key with read and write access to the bucket.
STORAGE_S3_ACCESS_KEY=
# REQUIRED. Secret key for the access key above.
STORAGE_S3_SECRET_KEY=
Changes in the most recent releases. Every release stays available on the Tags tab; when upgrading across more versions than are listed here, read the notes below and test the upgrade against a copy of your database first.
Content type
Image
Digest
sha256:391099159…
Size
456.9 MB
Last updated
3 days ago
docker pull jalantechnologies/foundation