Getting Started - Source Code Installation
This section describes how to set up the Ed-Fi ODS / API v7.1 source code on a development machine. For those interested in getting an Ed-Fi ODS / API instance up and running quickly, but do not have developer tools or experience we recommend you to consult Getting Started - Binary Installation.
The steps can be summarized as:
Detail on each step follows.
Step 1. Install and Configure Windows Components
Ensure that the following components are installed:
PowerShell 5.0,7.2,7.3. PowerShell is used to initialize the development environment.
.NET 8.0 SDK. The .NET 8.0 Software Developer Kit is required for compiling the solution.
Step 2. Install and Configure Required Software
Ensure that the following software is installed and configured:
Visual Studio 2022. Visual Studio 2022 (Community, Professional, or Enterprise edition) or JetBrains Rider version 2021.3+ (an alternative development environment that can be used instead of Visual Studio 2022).
Microsoft SQL Server 2019. Microsoft SQL Server is used to store the data for the Ed-Fi ODS / API. Local installation of Standard, Developer, or Enterprise Editions are supported.
Optional PostgreSQL datastore:
PostgreSQL 13.x. PostgreSQL can be used as the datastore for and Ed-Fi ODS / API instance instead of Microsoft SQL Server.
Step 3. Download the Ed-Fi ODS / API v7.1 Code
The Ed-Fi ODS / API source code is contained in two Ed-Fi repositories hosted by GitHub.
Source Code Links
The Ed-Fi ODS / API can be found in the repository links below:
Use a Git client (such as GitHub Desktop) or a Git command line tool to Git Clone each of the repository links described above. It is important that both repositories are extracted to the same root directory (for example C:\). When both repositories have been cloned, there will be two folders for the ODS / API source code as shown below:
When you clone a repository, ensure that you have the correct tag is checked out in your client before you proceed.
$ git checkout tags/v7.1-patch5 -b <branch>
If you download the code via a ZIP file, ensure that you check Unblock in the file's Properties dialog to allow the contents of the contained scripts to execute properly.
Step 4. Prepare the Development Environment
To prepare the development environment, you'll need to follow the procedures described below.
Configure StandardVersion
ODS/API 7.x supports building and deploying APIs that adhere to either the Ed-Fi Data Standard v4 or Ed-Fi Data Standard v5. By default, Visual Studio is set up to build using Ed-Fi Data Standard v5. However, if you are building for Ed-Fi Data Standard v4, you must ensure that the “StandardVersion” environment variable is properly configured.
To set the "StandardVersion" variable:
Press the Windows key
on your keyboard, type Environment Variables, select Edit the system environment variables, and press Enter. This brings up System Properties. Under Advanced, select Environment Variables. (Alternatively, right-click the Start Menu, select System, and click on the Advanced system settings. Under Advanced, select Environment Variables.)
Under System variables, select New...
For Variable name, enter StandardVersion
For Variable value, enter 4.0.0, and press OK.
Verify PowerShell Script Permissions
When opening PowerShell, ensure that Run as Administrator is selected. You may need to change the execution policy for unsigned PowerShell scripts to run on your machine to run the scripts. This can be done by opening a PowerShell console and typing the following command:
Set-ExecutionPolicy UnrestrictedInitialize PowerShell Scripts for Development
There are several databases that must be successfully deployed. PowerShell scripts that initialize all necessary development databases are included in the Visual Studio solution. These scripts are enabled for use within Visual Studio when the Ed-Fi-ODS solution is opened. They may also be loaded for use within a PowerShell console window by running the initialize PowerShell for development script located at:
C:\Ed-Fi-ODS-Implementation\Initialize-PowershellForDevelopment.ps1When the scripts are loaded, you should see the results shown below:
Initialize the Development Environment
Once the PowerShell scripts for development have been loaded and a development certificate has been installed, the development environment may be initialized by navigating to the Ed-Fi-ODS-Implementation folder.
For a SQL Server backing datastore, type the following into a PowerShell command prompt:
initdevFor a PostgreSQL backing datastore, use the following:
initdev -Engine PostgreSQLFor building Data Standard 4.0, use the following:
initdev -StandardVersion 4.0.0To get full details on initdev parameter options, use the following:
get-help initdev -detailedUse of UnEncryptedConnection parameter
When executing the initdev module, an appsettings.Development.json file is generated, adding Encrypt=false to the connection strings to mitigate a breaking change in Microsoft.Data.SqlClient library. This setting is not recommended for production environments; for production environments, it is recommended to follow the steps to Install a valid certificate on the server.
ODS Connection String Encryption
The appsettings.Development.json file now includes the OdsConnectionStringEncryptionKey setting. If you need to deploy to a production environment or require a specific key, ensure that the OdsConnectionStringEncryptionKey setting in the appsettings.json file is updated with a valid key. This key must be 256 bits in size and encoded in base64. You can execute the New-AESKey command to generate a valid key.
This command creates databases, generates code templates, and compiles projects in the solution. Some considerations while running the script:
The
initdevscript may not finish with a command prompt when it is automatically loaded with the solution in Visual Studio in some circumstances. Simply press Enter, and ignore any messages that appear in the console window.Initializing the development environment will take several minutes to complete. Some developers report encountering an error during the initialization process the first time it is run. This is due to an intermittent timing issue. The issue generally resolves itself when the
initdevprocess is run a second time.
A successful initdev execution will display the tasks executed and their duration as shown below:
Step 5. Build the Visual Studio Solution
To build the solution from within Visual Studio:
Ensure that the MsBuildDisableNodeReuse flag is set (see Configure MSBuild, above).
If the above flag has been set globally, start Visual Studio normally. Otherwise, open Visual Studio from the Visual Studio Developer Command Prompt (where you set the flag value by typing
devenv).Within Visual Studio, open the "Ed-Fi-Ods.sln" solution file from the C:\Ed-Fi-ODS-Implementation\Application directory.
Select Build > Build Solution (or press Ctrl+Shift+B).
Step 6. Set Startup Projects
The Visual Studio Solution for the Ed-Fi ODS / API consists of several "Startup Projects" that work together. Each of these projects needs to be running for the system to be fully functional.
To set the Startup Projects:
Select the Set StartUp Projects… context menu by right-clicking on the solution file in the Solution Explorer.
Within the Startup Project property page, select the Multiple startup projects radio button and enable the following projects:
EdFi.Ods.SandboxAdmin
EdFi.Ods.SwaggerUI
EdFi.Ods.WebApi
3. Click OK to accept the changes to your local development settings.
Step 7. Run the Solution
The projects in the Ed-Fi-ODS-Implementation repository are configured to run the desktop version of Internet Information Server (i.e., IIS Express). This server is installed with Visual Studio and facilitates easy debugging with minimal configuration. After the startup projects are set, you are ready to run or debug the Ed-Fi ODS / API.
Running the solution
To run the Ed-Fi ODS / API without debugging, press Ctrl+F5.
To interactively debug the Ed-Fi ODS / API solution, press F5 (or press Start in the Standard Toolbar).
Notes on Running the Solution
The solution builds and starts each of the projects that were added to the startup projects list. Each web application starts an instance of IIS Express. By default, the websites are configured according to the following table:
Website | Project | URL |
|---|---|---|
Ed-Fi ODS API | EdFi.Ods.WebApi | |
Sandbox Administration | EdFi.Ods.SandboxAdmin | |
Ed-Fi ODS API Documentation | EdFi.Ods.SwaggerUI |
At this point, you're ready to explore the system.
The following link contains sample docker setup files for PostgreSQL