Please refer to manage-courses-frontend
This repo provides a dotnet core solution containing the main client for managing courses.
It should be 12 factor, notably config from environment variables.
- EITHER dotnet core, OR msbuid+Visual studio
- Nodejs https://nodejs.org/ for the asset pipeline - worked with version 8.11.2 LTS
- Access to a running instance of manage-courses-api
- Access to an oauth server. To use the DfE Sign-in sandbox environment, ask the team for the current client secret, or get it from the DfE single sign-in project by emailing DfE.SIGNIN@education.gov.uk
Serilog has been configured to spit logs out to both the console
(for dotnet run
testing & development locally) and Application Insights.
Set the APPINSIGHTS_INSTRUMENTATIONKEY
environment variable to tell Serilog the application insights key.
This app sends exceptions and errors into Sentry. To enable the integration, set the SENTRY_DSN environment variable.
In the repository root, run:
dotnet restore
cd src\ui
dotnet run
Go to https://localhost:44364
in your browser
You will need to have SDK Version 2.1.302 (download) of the dotnet SDK installed in order to build and run this. This is due to a bug in ASP.NET MVC Core which is using inconsistent package versions. The bug has a fix promised in .NET Core 2.1.3
You will need to set the app settings (preferred to be store as user-secrets
):
- SearchAndCompare:UiBaseUrl the location of the search and compare UI, for the purpose of linking, e.g. "https://find-postgraduate-teacher-training.gov.uk". Avoid trailing slash.
- API_URL - the location of your manage-courses-api deployment. Defaults to development copy when in run in development mode.
- DFE_SIGNIN_CLIENT_SECRET - the client secret of your oath server
- auth:oidc:metadataAddress - the .well-known config URL of your oauth server, if you don't want to use the default sandbox one
- auth:oidc:tokenEndpoint - the /token endpoint as specified in the .well-known config URL of your oauth server
You may also set the following optional ones:
- auth:oidc:clientId (optional) - the Client ID to be used with your oauth server, if you don't want to use the default one (
bats
)
- ASPNET_ENVIRONMENT - set to
Development
- MANAGE_COURSES_API_Development_PORT (optional) - the port to run locally on
Development
valid port number betweeen49152 - 65535
otherwise it will use the default port44364
if port is unset or port is invalid/out of bounds
To run the JS unit tests (full suite, with coverage output):
cd src
npm install
npm test
To run in watch mode (which also allows you to specify grep patterns to focus only on certain specs/suites, but without coverage output):
npm run test:watch
- ensure the overriden or default port used (MANAGE_COURSES_API_Development_PORT), is available for use.
- app settings can also be defined as System Enviroment Variables or as
user-secrets
The best way to set and store them is user-secrets, e.g.
cd src\ui
dotnet user-secrets set ASPNET_ENVIRONMENT Development
dotnet user-secrets set DFE_SIGNIN_CLIENT_SECRET <the client secret>
And then just launch the UI (in folder src/ui
)
dotnet run
Once you're up and running, navigate to https://localhost:44364. Your browser will alert you that the certificate has no trusted root, but navigate to the page anyway.
- Add
DFE_SIGNIN_CLIENT_SECRET
to your user secrets for the ManageCoursesUI project (right-click the project in VS, "Manage user secrets". - Run
npm install
insrc\ui\
to get the asset pipeline dependencies (gulp) before opening visual studio. - Must be run with SSL/TLS. The DfE Sign-in service will not allow non-https redirect urls
This repo can be worked on both Visual Studio 2017 see IIS Express (Windows-only & Visual Studio Code.
You may need the following if you have port-clash problems. To be revised as we learn more...
In this file .\manage-courses-ui.vs\config\applicationhost.config
Check that the bindings for https settings are for port 44364 (you may need to run the solution first to have it auto generate it first)
<site name="ManageCoursesUi" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath=".\manage-courses-ui\src" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:5002:localhost" />
<binding protocol="https" bindingInformation="*:44364:localhost" />
</bindings>
</site>
If you want to use a version of ManageCourses.ApiClient/SearchAndCompareUi.Shared that is not (yet) on nuget.org, copy src/ui/dev-mc-api.targets.example
to src/ui/dev-mc-api.targets
and/or src/ui/dev-sc-shared.targets.example
to src/ui/dev-sc-shared.targets
and update the Project path referenced in that file to your local ApiClient project.
- localhost hits login button
- opens up url to external auth
- user logins in on external auth
- user is then redirected back to localhost (redirect url provided from localhost in step 2)
- localhost then extract the user details
-
https://signin-test-sup-as.azurewebsites.net/users/80BA7FAF-D6E1-47B4-9EDD-4539F53C8B9E/audit - The data here is always 15 mins out of date as its on an event stream (its more realtime in prod envs.)
Rename the file "app_offline.htm.example" in the root folder to "app_offline.htm"