sis_developer_manual
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
sis_developer_manual [2022/09/08 08:03] – [Building and Running the Frontend] ghachey | sis_developer_manual [2024/12/09 08:45] (current) – [Database Upgrades] ghachey | ||
---|---|---|---|
Line 31: | Line 31: | ||
- | ==== Built Tools and Package Manager ==== | + | ==== Build Tools and Package Manager ==== |
A collection of auxiliary tools not part of the actual application but used in automating deployment, frontend package management, etc. are also used: | A collection of auxiliary tools not part of the actual application but used in automating deployment, frontend package management, etc. are also used: | ||
Line 39: | Line 39: | ||
* [[https:// | * [[https:// | ||
+ | <note warning> | ||
===== Setting Up the Development Environment ===== | ===== Setting Up the Development Environment ===== | ||
The easiest way to get a development environment and start developing on the Pacific SIS is on Windows with instructions below. | The easiest way to get a development environment and start developing on the Pacific SIS is on Windows with instructions below. | ||
- | ==== Main Development Tools ==== | + | ==== Download and Install the Main Development Tools ==== |
Most developers currently use Visual Studio, Visual Studio Code, dotnet 6.0, MySQL, NodeJS/NPM. And SourceTree/ | Most developers currently use Visual Studio, Visual Studio Code, dotnet 6.0, MySQL, NodeJS/NPM. And SourceTree/ | ||
+ | |||
+ | |||
+ | <note warning> | ||
- Download and install [[https:// | - Download and install [[https:// | ||
- | - Download and install latest [[https:// | + | - Download and install latest [[https:// |
- Download and install [[https:// | - Download and install [[https:// | ||
- Download and install latest LTS [[https:// | - Download and install latest LTS [[https:// | ||
Line 57: | Line 61: | ||
The best way to start work on the Pacific SIS is to fork it in your own Github account. If new to forking read [[https:// | The best way to start work on the Pacific SIS is to fork it in your own Github account. If new to forking read [[https:// | ||
+ | The Pacific SIS source code can be found at [[https:// | ||
+ | |||
+ | <note tip>When doing a fork, you are prompt by Github whether you only want to include the Master branch. Uncheck that to get all the branches. This way you will have access to the Development branch containing all the latest code for testing.</ | ||
==== Visual Studio Setup ==== | ==== Visual Studio Setup ==== | ||
Line 93: | Line 100: | ||
The backup will need access to the databases and this is done in the '' | The backup will need access to the databases and this is done in the '' | ||
- | |||
<code javascript> | <code javascript> | ||
{ | { | ||
Line 117: | Line 123: | ||
{{ : | {{ : | ||
+ | |||
+ | In production the name of the database should both: | ||
+ | |||
+ | * Be the hostname in the URL (e.g. a system hosted at https:// | ||
+ | * Have the correct tenant_name in the catalogdb database configured as above to pacificsis (to use the same example as above) | ||
+ | |||
+ | In development, | ||
+ | |||
+ | * Have the correct tenant_name in the catalogdb database configured as above to pacificsis (to use the same example as above) | ||
+ | |||
+ | A screenshot of a developer' | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ==== Database Upgrades ==== | ||
+ | |||
+ | Database upgrades are done using the .NET EntityFrameworkCore migrations. When a new migration is made available typically in the source code you'll need to apply the migration. In production this will usually happen automatically when accessing the application after the successful upgrade. In development, | ||
+ | |||
+ | <code csharp> | ||
+ | using System; | ||
+ | using System.Collections.Generic; | ||
+ | using System.Text; | ||
+ | using Microsoft.EntityFrameworkCore; | ||
+ | |||
+ | namespace opensis.data.Models | ||
+ | { | ||
+ | public class CRMContextMySQL : CRMContext | ||
+ | { | ||
+ | private readonly DbContextOptions? | ||
+ | public CRMContextMySQL() { } | ||
+ | public CRMContextMySQL(DbContextOptions options) : base(options) | ||
+ | { | ||
+ | this.contextOptions = options; | ||
+ | } | ||
+ | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
+ | { | ||
+ | if (!optionsBuilder.IsConfigured) | ||
+ | { | ||
+ | //var tenant = " | ||
+ | |||
+ | //string connectionString = $" | ||
+ | // | ||
+ | } | ||
+ | |||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | With the above configured the upgrade will run automatically by loading the application. Another way is to open the Package Manager Console within Visual Studio and run something like the following. | ||
+ | |||
+ | < | ||
+ | PM> Update-Database -Project opensis.data -Context CRMContextMySQL | ||
+ | Build started... | ||
+ | Build succeeded. | ||
+ | Applying migration ' | ||
+ | Done. | ||
+ | </ | ||
+ | |||
+ | A developer also suggested another by " | ||
==== Building and Running Backend ==== | ==== Building and Running Backend ==== | ||
Line 131: | Line 197: | ||
> npm install -g @angular/ | > npm install -g @angular/ | ||
</ | </ | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | < | ||
+ | > npm install -g @angular/ | ||
+ | </ | ||
+ | </ | ||
Browse to the '' | Browse to the '' | ||
Line 168: | Line 241: | ||
+ | ===== Deploying ===== | ||
+ | |||
+ | The deployment can be done in a number of ways. You can use the deployment tools in both the backend and frontend to package the files for the production server. Below explains how. | ||
+ | |||
+ | ==== Packaging the Backend ==== | ||
+ | |||
+ | Simply use the Visual Studio' | ||
+ | |||
+ | * opensisAPI | ||
+ | * opensis.backgroundjob | ||
+ | |||
+ | This should look something like this. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | This will put the packaged files in specific directories on your development computer based on your publish profile. | ||
+ | |||
+ | ==== Packaging the Frontend ==== | ||
+ | |||
+ | Navigate to the '' | ||
+ | |||
+ | < | ||
+ | > ng build | ||
+ | </ | ||
+ | This should package all the frontend files in '' | ||
+ | ==== Deploying to Production Server ==== | ||
+ | Is a matter of preference. You could simply copy the files produced in the two previous steps and configure the Apache Server to server them. The database will need to also be deployed. One of the maintainers of the system uses Ansible to automate all of these final deployment tasks. |
sis_developer_manual.1662624228.txt.gz · Last modified: 2022/09/08 08:03 by ghachey