Skip to main content
Documentation

Guide baseline: Aelira Core v0.14.0

Self-Hosting Guide

Run the free Core edition on infrastructure you control. This production stack includes the API, worker and dashboard.

Before you deploy

Use Docker with Compose v2 and capacity for PostgreSQL, Redis, the API, workers, uploads and backups. Model memory and storage depend on the models selected. Measure representative workloads before sizing a production service; the local AI guide describes model requirements.

LaTeX conversion to HTML or PDF, and the LaTeX project ZIP HTML workflow, run LaTeXML, pandoc and TeX under a Linux Landlock ruleset with a minimal environment. They need a Linux kernel with Landlock enabled (5.13 or newer). Where it is unavailable, including running the tools directly on macOS or Windows, conversion fails closed and the tool is reported unavailable; it never runs unconfined. After installing or upgrading, run the functional LaTeX runtime check under the service user.

From v0.10.0 the API image runs ffmpeg and ffprobe from its own FFmpeg 9.0.2 build instead of Debian's ffmpeg package, and launches one browser for its checks: a Chrome for Testing build pinned by version and SHA-256 at the path in AELIRA_CHROMIUM_EXECUTABLE. Its ImageMagick policy denies every format except the PNG, JPEG, EPS and PDF graphics LaTeXML reads and the PAM files Ghostscript produces for CMYK documents. Keep these in place if you build a derived image, and set AELIRA_CHROMIUM_EXECUTABLE yourself only when running outside the published images.

For a disposable API-only trial, use Quick Start. Never promote its known credentials or mock authentication into production. Read the release-pinned deployment guide alongside this summary.

Since v0.12.0, high-risk PDF/Office uploads are rebuilt without macros, scripts, ActiveX controls, embedded objects and external templates before storage and scanning; unrebuildable uploads are refused and the reasons are kept in the security record. Read the v0.12.0 operator notice when upgrading from 0.11.1 or earlier.

1. Get the release and configure it

git clone --branch v0.14.0 --depth 1 https://github.com/Aelira-AI/aelira-core.git
cd aelira-core
cp .env.example .env

Edit .env privately. Replace every placeholder in its required production section, including POSTGRES_PASSWORD, JWT_SECRET and SESSION_REPLAY_ENCRYPTION_KEY. Use distinct random values; the session replay key must be a valid Fernet key and must persist across restarts and replicas. Follow the generation instructions in .env.example.

Set AELIRA_VERSION to 0.14.0. Configure PUBLIC_API_URL, PUBLIC_DASHBOARD_URL and CORS_ORIGINS for your actual HTTPS origins. Leave the direct-host DATABASE_URL and REDIS_URL examples commented when using the bundled database and Redis. Production Compose supplies their container addresses.

Keep ENV=production, mock authentication disabled and public signup closed. Configure SMTP before provisioning accounts. Local document scans do not need TOKEN_ENCRYPTION_KEY in v0.14.0, but jobs that use stored cloud-integration tokens (Google Workspace, Microsoft 365, Canvas OAuth) fail without a valid one. Before enabling an integration, replace its .env.example placeholder with a valid, persistent Fernet key; both the production API and worker load that file. Set a separate BYOK_ENCRYPTION_KEY before enabling stored workspace AI credentials.

2. Choose providers deliberately

# In .env: disable process-default provider selection
LLM_PROVIDER=none
LLM_FALLBACK_PROVIDER=none
EMBEDDING_PROVIDER=none

These environment settings do not disable providers already selected in a workspace. For local AI infrastructure, enable the ollama Compose profile and explicitly pull the models. OLLAMA_HOST sets the server address. Embedding selection is separate; OLLAMA_EMBEDDING_MODEL selects its model. See the local AI infrastructure example.

Cloud providers require an explicit choice and credentials. Self-hosting alone does not mean documents stay local. Check fallback routes, outbound traffic, logs, storage, backups and administrator access. LMS AI processing has an additional authorization and provider-readiness policy; provider credentials alone do not authorize course-content processing.

Workspace AI configuration

After provisioning an administrator, open Settings → AI Provider Settings in the dashboard. Configure the provider and text, code and vision models, test the configuration, and explicitly select the primary provider and optional fallback. A new workspace has no selected provider. For cloud providers, save the workspace credential through this administrator workflow after configuring BYOK_ENCRYPTION_KEY.

Authenticated document, image and web operations resolve the saved workspace provider rows. Workspace model values, or provider defaults when unset, take precedence over process-level model settings. Setting LLM_PROVIDER in .env and restarting containers does not configure that workspace. To disable workspace AI, use Disable workspace AI in Settings → AI Provider Settings. It clears the primary and fallback selections, keeps the saved provider configuration, and does not cancel work already running.

The workspace provider API exposes configuration, testing and selection for authorized administrators. Its updates require the current configuration revision; do not reuse a stale revision or place credentials in URLs. LMS content also needs its separate AI authorization policy.

3. Understand the network boundary

The production file binds the API to 127.0.0.1:8000 and the dashboard to 127.0.0.1:8080 by default. PostgreSQL, Redis and optional Ollama remain on the Compose network. The worker uses the same API image, database, provider configuration and shared upload volume.

The published dashboard uses same-origin /api requests. Its nginx configuration forwards /api/ to the API service and removes that prefix. Direct API clients use /education routes; dashboard-proxied requests therefore use /api/education routes. There is no /api/v1 alias.

4. Configure TLS and access

Compose does not include TLS termination or automatic certificate setup. Configure your existing reverse proxy to serve the dashboard and API over HTTPS, using the origins you set above. Keep database, Redis and model ports private. Configure only the actual proxy network in TRUSTED_PROXY_CIDRS; do not trust arbitrary forwarded headers.

Passkey sign-in derives its relying-party ID and expected origin from your configured public origins; serve the dashboard over the exact HTTPS origin users sign in on and keep an email recovery path, since a passkey stays bound to the device and browser it was enrolled on.

Restrict initial access while bootstrapping: the first verified magic-link login on an empty database becomes the administrator. Configure and test SMTP, claim that account, and invite other staff through administration. Do not leave an unclaimed installation open to the public. The account provisioning section covers department invitations and SSO/LTI provisioning.

5. Start the matched stack and verify readiness

docker compose -f docker-compose.prod.yml config --quiet
docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d
docker compose -f docker-compose.prod.yml ps
curl --fail-with-body http://localhost:8000/live
curl --fail-with-body http://localhost:8000/ready
docker compose -f docker-compose.prod.yml exec worker python -m src.jobs.healthcheck --mode readiness --json

The API entrypoint runs migrations and stops on failure. A responsive API is not a working queue: verify a fresh worker readiness result, then submit a synthetic document and follow it to completion. Check login, review and download from the dashboard before admitting real content. A local dashboard health response alone does not prove that journey.

With local AI selected, add --profile ollama to startup and pull your chosen models before testing AI features. Do not enable a paid provider as an implicit fallback.

Capacity and configuration

JOB_WORKER_MAX_CONCURRENCY controls jobs per worker; the shipped default is one. JOB_WORKER_CPUS and JOB_WORKER_MEMORY_LIMIT bound resource use. Increase limits only after measuring peak usage and API responsiveness. Keep JOB_WORKER_STOP_GRACE_PERIOD longer than JOB_WORKER_MAX_EXECUTION_SECONDS so shutdown can drain work.

Upload limits are format-specific settings in settings.py. Reverse-proxy request limits also apply. Avoid changing only one layer and assuming the end-to-end limit changed.

Backups, upgrades and recovery

Back up PostgreSQL and the shared /app/uploads volume, including REMEDIATION_ARTIFACT_DIR and report artifacts. Retain configuration and encryption keys securely, separately from database dumps. Test a restore into an isolated environment and confirm original files and saved artifacts can be opened; a database dump alone does not preserve file bytes.

From v0.10.0, Aelira Core follows semantic versioning: new features, behaviour changes and database migrations need a minor release, and patch releases carry only backwards-compatible fixes and security updates. Releases 0.9.1 to 0.9.13 were published as patch releases but included new features, database migrations and breaking changes. Read the release notes for each version before you upgrade across them.

  1. Before upgrading, record your Microsoft webhook subscriptions. For each department that connects Microsoft 365, call GET /microsoft/subscriptions with that department's API key and note the resource of each entry. Deployments that never created a Microsoft subscription skip this step and the re-creation step below.
  2. Pause intake and review/remediation writes, drain active jobs, then stop the API and worker. Take a coordinated backup of PostgreSQL, uploads, managed artifacts and the matching private configuration and encryption keys, and verify the restore in separate storage.
  3. Upgrading to v0.13.0 adds two Alembic revisions, 20261031_webauthn_passkeys then 20261031_totp_mfa, which becomes the single head. v0.12.x and v0.14.0 add no revisions; the head stays 20261031_totp_mfa. Upgrading across v0.11.0 adds one Alembic revision, 20261028_webhook_secret, which adds a nullable client_state_hash column to cloud_webhook_subscriptions, and its downgrade drops nothing. Read the v0.13.0 operator notice before migrating, and the v0.11.0 operator notice when upgrading across v0.11.0.
  4. Pull matching v0.14.0 API and dashboard images (or build both from one revision). Run docker compose -f docker-compose.prod.yml run --rm --entrypoint alembic api upgrade head, and confirm it succeeds and the head is 20261031_totp_mfa before accepting traffic. Deploy API, worker and dashboard from the same release.
  5. After the upgrade, make sure PUBLIC_API_URL is the API's public https address that Microsoft Graph can reach, because notifications always go to PUBLIC_API_URL followed by /webhooks/microsoft. Then create each recorded subscription again with POST /microsoft/subscriptions, the department's API key and the body {"resource": "<recorded resource>"}. Old subscriptions are not renewed, and until one is created again its notifications are refused. The dashboard has no control for this. POST /microsoft/subscriptions no longer requires notification_url and refuses any other receiver with 422, and a Microsoft sync folder must be added with its Graph item ID (422 otherwise).
  6. Upgrading from v0.9.12 or earlier also crosses the three Alembic revisions added in v0.9.13: 20261017_canvas_scope, 20261018_media_truth and 20261020_media_captions. v0.10.0 added no revision, and 20261020_media_captions was the head until v0.11.0. Read the v0.9.13 operator notice and the v0.10.0 release notes before migrating across them. From v0.9.11 or earlier, also read the historical confidence correction that the v0.9.12 revisions 20260917_unknown_confidence and 20260928_pdf_edit_pub apply.
  7. Upgrading from v0.9.13 or earlier: printed equation fixes stored by earlier releases carry no second-reading evidence, and handwritten equation evidence was recorded under the earlier canonical MathML form, so v0.10.0 and later read both as invalid contracts: approval is refused and the artifact stays gated. Run remediation again on the affected documents to regenerate them.
  8. Check API readiness, worker readiness, queue progress, the LaTeX runtime check, a completed synthetic scan and dashboard review/download. Reopen intake only after these pass, and recheck affected review decisions before approving any publication.

Do not roll back only an application image or one service. The v0.11.0 migration adds only a nullable column and its downgrade drops nothing, so earlier releases ignore the column. The v0.9.13 migrations refuse a downgrade while Canvas items share a native ID across courses or content types, unassessed scores remain or media caption artifacts exist, and the v0.9.12 confidence migration refuses one while unknown scores remain. To return to an earlier release, stop writers, restore the matching pre-upgrade database, uploads, artifacts, configuration and keys together, then start that release's matched API, worker and dashboard. A restore discards activity after the backup; reconcile external writebacks separately. A restore to a pre-v0.13.0 backup also loses passkey and authenticator-app enrollments made since it; affected users must enroll again. Do not combine an old worker with a newer API or schema. Do not manually delete artifact rows or files to bypass a failed cleanup. See the upgrade and recovery procedures and troubleshooting.