Setup & Deployment

Installing, configuring, and upgrading Orion

Back to Documentation

Prerequisites

  • PostgreSQL 14+ — A running PostgreSQL instance with a dedicated database
  • .NET 10 Runtime — Or the .NET 10 SDK for building from source
  • RSA Key Pair — For JWT signing (can be generated during setup)
  • Environment Variables — See Configuration Reference

Minimum Environment Variables

# Required for any deployment
CUSTOMCONNSTR_OrionRestAPIContextV2="Host=localhost;Database=orion;Username=orion;Password=yourpassword"
ORION_BASE_URL="https://login.yourdomain.com"

# For JWT signing (EnvironmentVariable provider)
ORION_SIGNING_KEY_PRIVATE="<base64-encoded RSA private key>"

Fresh Installation

1

Set environment variables

Configure the minimum required environment variables listed above. No setup flag is needed for a first install: /setup opens automatically while the server has no administrator, and closes itself once the install is complete.

2

Deploy the application

Deploy the compiled Orion application (or run via dotnet run for development).

# Run directly
dotnet OrionRestAPI.dll

# Or via Docker
docker run -e CUSTOMCONNSTR_OrionRestAPIContextV2="..." \
           -e ORION_BASE_URL="..." \
           -p 8080:8080 orion:latest
3

Navigate to /setup

Open https://login.shanecraven.com/setup in your browser. If ORION_SETUP_KEY is set, append ?key=yourkey to the URL.

Tip: You can restrict access to the setup page by IP address or hostname using ORION_SETUP_ALLOWED_HOSTS. Example: ORION_SETUP_ALLOWED_HOSTS=192.168.1.10,admin.internal.example.com. Hostnames are resolved via DNS on each request. If not set, no IP restriction is applied. Blocked requests receive a 404 as if setup mode is disabled.

4

Run the setup wizard

The setup wizard will guide you through:

  1. Database schema creation — Creates all required tables via EF Core migrations
  2. Create organisation — Your first tenant organisation
  3. Create admin user — The initial administrator account with email/password
  4. Create system account — An initial system account for API access
  5. Seed data — Creates the default Orion application and permission requirements
5

Disable setup mode

Nothing to remove and no restart required — the setup window closes on its own once the install is complete, and from the moment an administrator exists the remaining steps already require signing in as that administrator.

Security: Only set ORION_SETUP_MODE=true to deliberately RE-OPEN setup on an already-provisioned server (recovery). It overrides the automatic window, so never leave it set. Pair it with ORION_SETUP_ALLOWED_HOSTS. The setup endpoints allow creating admin accounts and modifying the database schema. If you must enable setup temporarily (e.g. for upgrades), use ORION_SETUP_KEY and ORION_SETUP_ALLOWED_HOSTS to restrict access by password and source IP.

Upgrading

1

Deploy the new version

Replace the application binaries with the new version. Set ORION_AUTO_MIGRATE=true so pending migrations apply at startup; /health returns 503 until the schema matches the code, so a bad rollout fails at the load balancer instead of serving errors.

2

Navigate to /setup

The setup page will show any pending database migrations that need to be applied.

3

Apply pending migrations

Click the "Apply" button to run pending EF Core migrations. The page will show progress and any errors.

4

Disable setup mode

Once all migrations are applied, disable setup mode and restart.

Tip: You can check for pending migrations programmatically via the /setup/status endpoint (returns JSON with migration status).

Schema Migrations

Orion uses Entity Framework Core code-first migrations. When the data model changes between versions, new migrations are included in the build.

  • Automatic detection: The /setup endpoint detects pending migrations by comparing the database's migration history with the compiled migration assembly.
  • Non-destructive: Migrations are additive — they add columns, tables, or indices. Existing data is preserved.
  • Rollback: EF Core migrations can be rolled back, but this requires manual intervention. Always take a database backup before upgrading.
  • Diagnostics: Use /setup/diagnostics?key=... to inspect federation configuration state.

Troubleshooting

Problem Solution
/setup returns 404 Setup closes automatically once the install is complete. To re-open it deliberately, set ORION_SETUP_MODE=true and restart.
Database connection failure Verify CUSTOMCONNSTR_OrionRestAPIContextV2 is correct. Ensure PostgreSQL is reachable from the server.
JWT signing fails Check that ORION_SIGNING_KEY_PRIVATE is a valid Base64-encoded RSA key. Use openssl genrsa 2048 | base64 -w0 to generate one.
FIDO2 registration fails Ensure ORION_FIDO2_DOMAIN matches the domain users access and ORION_FIDO2_ORIGINS contains the full origin URI.
OAuth redirect rejected Check that the redirect_uri is listed in the application's Redirect URIs (exact match) or matches a wildcard in ORION_ALLOWED_REDIRECT_DOMAINS.
Emails not sending Verify all orion_smtp_* variables are set. Test SMTP connectivity from the server.
Migration fails mid-way Restore from database backup, fix the issue, and retry. Check /setup/diagnostics for configuration state details.
← Applications Next: Security →