User Tools

Site Tools


sis_developer_manual

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sis_developer_manual [2023/07/18 16:16] – [Install Frontend Dependencies] ghacheysis_developer_manual [2024/03/11 01:52] (current) – [Packaging the Frontend] ghachey
Line 136: Line 136:
  
 {{ :sis-developer-manual:database-setup-example-1.png?nolink |}} {{ :sis-developer-manual:database-setup-example-1.png?nolink |}}
 +
 +==== 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. This can be done in a number of ways depending on preference and environment (development vs production). One way is to open the Package Manager Console within Visual Studio and run something like the following.
 +
 +<code>
 +PM> Update-Database -Project opensis.data -Context CRMContextMySQL
 +Build started...
 +Build succeeded.
 +Applying migration '20230216092200_AlterStaffSchoolInfoMembershipId'.
 +Done.
 +</code>
 +
 +A developer also suggested another by "hitting the API from postman or swagger" the URL https://localhost:port/{databaseName}/Common/getAllLanguageForLogin (replace the {databaseName} with the local databaseName) to automatically trigger the migration. 
 +
 +<note important>At the time of this writing I had to enabled (uncomment) the commented lines below in the file **opensis.data/Models/CRMContextMySQL.cs** to run the upgrade.
 +
 +<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? contextOptions;
 +        public CRMContextMySQL() { }
 +        public CRMContextMySQL(DbContextOptions options) : base(options)
 +        {
 +            this.contextOptions = options;
 +        }
 +        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 +        {
 +            if (!optionsBuilder.IsConfigured)
 +            {
 +                //var tenant = "opensisv2_ef6";
 +
 +                //string connectionString = $"server=localhost;database={tenant};user=theuser;password=thepassword";
 +                //optionsBuilder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString));
 +            }
 +
 +        }
 +    }
 +}
 +</code>
 +
 +</note>
  
 ==== Building and Running Backend ==== ==== Building and Running Backend ====
Line 194: Line 243:
  
  
 +===== 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's publish feature. There is a publish "profile" in there that can be use as example. Two  apps need to be deployed on the backend.
 +
 +  * opensisAPI
 +  * opensis.backgroundjob
 +
 +This should look something like this.
 +
 +{{ :sis-developer-manual:pacific-sis-deploy-1.png |}}
 +
 +This will put the packaged files in specific directories on your development computer based on your publish profile.
 +
 +==== Packaging the Frontend ====
 +
 +Navigate to the ''Pacific-SIS/UI'' directory and execute the following command.
 +
 +<code>
 +> ng build
 +</code>
  
 +This should package all the frontend files in ''Pacific-SIS/UI/dist/vex/''
  
 +==== 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.1689696966.txt.gz · Last modified: 2023/07/18 16:16 by ghachey