Installation — Prerequisites¶
What must be in place before the NKO ERP will build and run. This section covers a fresh installation from the source repository; for deploying a build to a server see Deployment.
Read this before you start
Two things in the repository will stop a fresh installation, and neither is obvious:
- There is no way to create the first user. No seed data, no SQL script, no
self-registration. A freshly migrated database has an empty
ApplicationUserstable and every screen behind a permission check. See First Run — R5-1. - PDF export will not work.
wwwroot/Rotativa/and thewkhtmltopdfbinaries it needs are not in the repository — R5-3.
Software¶
| Requirement | Version | Notes |
|---|---|---|
| .NET SDK | 6.0 | All five projects target net6.. Note that .NET 6 left support in November 2024 — see R1-7 in Recommendations. |
| SQL Server | 2016 or later | Any edition, including Express for a development box |
| Windows | — | System. 6.0.0 is Windows-only from .NET 6 onward, so the application is effectively Windows-bound |
| wkhtmltopdf | matching Rotativa 1.2.0 | Required for every PDF export; not supplied in the repository |
Visual Studio 2022 or dotnet CLI |
— | Runtime view compilation is enabled, so views can be edited without a rebuild |
Databases¶
Three databases are needed. They may live on the same SQL Server instance.
| Database | Connection string | Created by |
|---|---|---|
NKO_DB |
Hr |
EF migrations (18) |
NKO_DB_Warehouse |
Ware |
EF migrations (5) |
| Hangfire store | Hangfire |
Hangfire itself — Prepare creates the schema, but the database must already exist |
See Database Setup.
External accounts¶
| Service | Needed for | Where it is configured |
|---|---|---|
| AWS S3 | All document storage — attachments, contracts, e-signatures. The application will start without it but every upload and download fails. | appsettings. → Storage |
| SMTP mailbox | Approval notifications, security alerts, birthday mail | Hard-coded in Site — see the warning below |
| data.fixer.io | Not needed. The client exists but is never called (R7-17). Its absence has a consequence, though: the global exchange rate has no update path in the application, so it must be inserted into the Exchange table directly — purchase requests use it (R7-1) |
— |
Two settings files, and secrets in the wrong one — R1-9
Configuration is split in a way that is easy to get wrong:
appsettings.jsonholds the connection strings,StorageConfigs,SysUrl,JwtConfig:Secretand the scheduled-job settings. It is not committed;appsettings.example.jsonshows the shape.NKO.Lib/NKO.Shared/Helpers/SiteSettings.csholds the rest — site name, all URLs, the HR mailbox, the template path, and both mailbox passwords — aspublic static stringliterals compiled into the assembly. Changing any of them requires a rebuild and redeploy, and the passwords are in source control.
When installing a new environment you must edit both.
Configuration file¶
Copy appsettings.example.json to appsettings.json and fill in:
{
"ConnectionStrings": {
"HrConnection": "Server=…;Database=NKO_DB;…",
"WareConnection": "Server=…;Database=NKO_DB_Warehouse;…",
"HangfireConnection": "Server=…;Database=NKO_Hangfire;…"
},
"StorageConfigs": {
"region": "…",
"clientId": "…",
"clientSecret": "…"
},
"SysUrl": "https://your-host/",
"EPPlus": { "ExcelPackage": { "LicenseContext": "NonCommercial" } },
"ScheduledJobsSettings": {
"BirthdayGreetingsIsActive": true,
"BirthdayGreetingsCronExpression": "…"
}
}
JwtConfig:Secret is not needed. Startup reads it only inside the AddJwtBearer(...) options
callback, which ASP.NET Core runs only if the JWT scheme is ever used — and it never is, because
AddIdentity makes the Identity cookie the default scheme (R6-4). Neither
appsettings.example.json nor a working configuration defines it. See
Deployment — Configuration for every key the application reads.
Add the NKODestruction storage entry
appsettings.example.json lists 18 StorageConfigs:Systems entries, but the code uses 19. Without
a NKODestruction entry, every attachment upload on an asset-disposal request throws — see
R4-1 and Deployment — Configuration.
Check the EPPlus licence
LicenseContext is set to NonCommercial. EPPlus has been dual-licensed since version 5 —
confirm the terms cover an ERP running an organisation's payroll and procurement (R1-8).
Values that require a code change¶
These are compiled in, so a new environment means editing source and rebuilding:
| Setting | File |
|---|---|
Site name, System, Site, Job, Job, Site |
NKO. |
HREmail, System, Auto and both passwords |
NKO. |
Template — where the e-signature PDF template lives |
NKO. |
| SMTP host and port | NKO. |
data. access key (unused) |
NKO. |
Restore and build¶
dotnet restore pulls about 44 packages including the AWS SDK, Hangfire, Quartz, EPPlus, Rotativa
and — unnecessarily — Refit, Twilio and MailKit, none of which the code uses (R1-4).
wkhtmltopdf¶
Startup.Configure runs RotativaConfiguration.Setup(env.WebRootPath, "Rotativa"), which expects
the wkhtmltopdf executable under NKO.Main/NKO.Main/wwwroot/Rotativa/. That folder is not in the
repository. Obtain the binaries matching Rotativa.AspNetCore 1.2.0, create the folder and place
them there before expecting any PDF to render (R5-3).
Next¶
- Database Setup — creating and migrating both contexts
- First Run — starting the application and getting the first account in