Setup & Deployment
Installing, configuring, and upgrading Orion
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
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.
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
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.
Run the setup wizard
The setup wizard will guide you through:
- Database schema creation — Creates all required tables via EF Core migrations
- Create organisation — Your first tenant organisation
- Create admin user — The initial administrator account with email/password
- Create system account — An initial system account for API access
- Seed data — Creates the default Orion application and permission requirements
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.
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
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.
Navigate to /setup
The setup page will show any pending database migrations that need to be applied.
Apply pending migrations
Click the "Apply" button to run pending EF Core migrations. The page will show progress and any errors.
Disable setup mode
Once all migrations are applied, disable setup mode and restart.
/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
/setupendpoint 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. |