Set up the database
Provision a database engine for Erde and point the server at it. Erde supports two engines — PostgreSQL with the PostGIS extension, or Microsoft SQL Server — and you supply the connection during the first-run setup wizard, not by hand-editing config files.
- Prerequisites: Erde must be installed, and a database server must be reachable from the Erde host. You provide the connection in the setup wizard, so have the host, port, and credentials ready.
- Database names are fixed: Erde uses two databases,
erde_app(domain data) anderde_platform(identity, settings, and tenancy). The setup wizard does not let you change these names.
Choose a provider
Pick one engine per deployment and set the config key Database:Provider to its value. The setup wizard writes this key for you when you choose the provider.
| Engine | Database:Provider value | Extra requirement |
|---|---|---|
| PostgreSQL | postgresql | The PostGIS extension (Erde creates it) |
| Microsoft SQL Server | sqlserver | A case-insensitive database collation |
postgresql and sqlserver are the only accepted values, compared case-insensitively. Any other value stops the server at startup.
Erde's development environment is tested against PostgreSQL 17 with PostGIS and SQL Server 2022. No specific engine version is enforced by the server; use a version your organization supports.
Steps
Follow the section for the engine you chose. In both cases you finish by entering the connection in the first-run setup wizard, which tests it, creates the two databases, runs the migrations, and seeds the initial data.
PostgreSQL
-
Install and start PostgreSQL on a host the Erde server can reach.
-
Ensure the PostGIS extension is available to the server (install the PostGIS package for your PostgreSQL build). Erde stores spatial data — locations, site boundaries — and PostGIS is required.
-
Create a login role Erde can connect with. The role must be able to create databases and create extensions, because Erde creates
erde_appanderde_platformand enables thepostgisandcitextextensions on first run. -
In the setup wizard, select the PostgreSQL provider and enter the host, port, and credentials.
Field What to enter Provider Select PostgreSQL (Erde records postgresql)Server The PostgreSQL host name or address Port The PostgreSQL port Username The login role's username Password The login role's password -
Select Test Connection, then complete the wizard. On apply, Erde runs
CREATE EXTENSION IF NOT EXISTS citext;andCREATE EXTENSION IF NOT EXISTS postgis;, then migrates and seeds both databases.
SQL Server
-
Install and start SQL Server on a host the Erde server can reach.
-
Make sure the database's collation is case-insensitive. Erde sets no collation of its own and relies on a case-insensitive database collation so that codes and names compare and stay unique regardless of case. Confirm the database has not been set to a case-sensitive (
CS) collation. -
Provide a login Erde can connect with. The login must be able to create databases, because Erde creates
erde_appanderde_platformon first run. Erde connects with either SQL authentication (username and password) or Windows Integrated Security. -
In the setup wizard, select the SQL Server provider and enter the connection details.
Field What to enter Provider Select SQL Server (Erde records sqlserver)Server The SQL Server host name or instance Port The SQL Server port Authentication Select SQL Authentication or Windows Authentication Username For SQL authentication, the login username Password For SQL authentication, the login password -
Select Test Connection, then complete the wizard. Erde sets
TrustServerCertificateon the connection, so a self-signed server certificate does not block setup. On apply, Erde migrates and seeds both databases.
When you pick Windows Authentication above, Erde connects to SQL Server as the identity its host process runs as — LocalSystem in both the Windows Service and IIS hosting shapes, which on a domain presents as the server's machine account (DOMAIN\SERVER$). Create a SQL Server login for that machine account and grant it permission to create databases. SQL Authentication instead uses the username and password you enter in the wizard.
Result
Erde holds the connection in the production configuration and resolves the active application database per request. After setup completes, both databases exist and are migrated:
erde_platform— identity, system settings, and tenancy.erde_app— your domain data (sites, samples, lab results, and so on).
On PostgreSQL, both the citext and postgis extensions are created in each database (erde_app and erde_platform) on first run. On both engines, text columns compare case-insensitively: PostgreSQL maps text columns to citext, and SQL Server relies on its case-insensitive collation.
Troubleshooting
| Symptom | Cause | Resolution |
|---|---|---|
Server stops at startup: Database:Provider not configured. | The provider key is missing from configuration | Re-run the setup wizard, or confirm Database:Provider is set to postgresql or sqlserver. |
Server stops at startup: Unsupported database provider: <value> | Database:Provider is set to a value other than postgresql or sqlserver | Use one of the two accepted values exactly; nothing else is valid. |
Setup fails with a PostGIS or postgis extension error | PostGIS is not installed on the PostgreSQL server, or the login role cannot create extensions | Install the PostGIS package on the database host and grant the role permission to create extensions, then re-run setup. |
| Connection test fails | Wrong host, port, or credentials; the database server is unreachable | Re-check the values against your database server, and confirm the Erde host can reach it over the network. |
| Codes or names that differ only by case are treated as duplicates or as distinct unexpectedly (SQL Server) | The SQL Server database is using a case-sensitive (CS) collation | Use a database with a case-insensitive default collation. |