To install IIS on the windows server:
Open server manager: (Windows → search “Server Manager”)
- Click on Manage
- Select Add Roles and Features
- Click Next
- Select “Role-Based or feature-based installation” and click Next
- Select the server and proceed.
- Select “Web Server (IIS)” in server roles and proceed further.
- Click on “Add Features”
- In Features select “IIS Hostable Web Core”
- Click on Next
- Click on Install.
- After Installation is complete click “Close”.
- Open Powershell as administrator and run the following command
- After following all these steps visit the public DNS or public IP address
IIS is installed successfully on the windows server.
To install Dot net core hosting and runtime and the SDK:
Download and install the following packages:
-
ASP NET CORE 6 SDK:
https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-6.0.402-windows-x64-installer -
ASP NET CORE 6 Hosting Bundler
Once the installation is complete open windows PowerShell and enter the following command:
“dotnet --version”
The output should show a version not an error message. If there’s any error please retry the installation carefully.
Time to set up SQL server in the instance.
Download the SQL server & SSMS from the given links:
- SQL Server
https://www.microsoft.com/en-in/sql-server/sql-server-downloads
- SSMS
Download and install the following software on the server.
To create DB:
Run the following query to create Main DB:
create database Main_DB;
use Main_DB;
create table dbo.Courses(Id int unique not null identity(1,1), COURSE_ID varchar(20) unique, COURSE_TITLE varchar(225));
create table dbo.Learners(Id int unique not null identity(1,1), LEARNER_ID varchar(20) unique, LEARNER_EMAIL varchar(225));
create table dbo.CourseHistory(
Id int unique not null identity(1,1),
LEARNER_ID varchar(20),
COURSE_TITLE varchar(225),
LEARNER_EMAIL varchar(225),
DURATION_HOURS int,
EVL_STATUS varchar(50),
SCORE int,
foreign key(LEARNER_ID) references dbo.Learners(LEARNER_ID),
);
--Run the above command.
--To create dummy Data for testing:
insert into dbo.Courses values
('1', 'ASP.NET CORE Basics'),
('2','React Basics'),
('3','React Native Esentials'),
('4','Rails Starter'),
('5','Javascript from zero to hero'),
('6','Professional communication ethics'),
('7','How to be more professional')
insert into dbo.Learners values('1', '[email protected]'),('2', '[email protected]'),('3', '[email protected]'),('4', '[email protected]'),('5', '[email protected]')
Once the installation of dotnet, SQL server & creation of the database is done and successfully verified Install AWS CLI on the instance to run AWS commands on the server itself
- Open Windows Powershell as administrator and enter the following command:
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
- To verify the installation enter “aws --version” in the PowerShell window.
You can visit the link given below for more information.
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
After the successful installation of AWS CLI, we need to configure the AWS account on the instance.
Before following this step you would need to get the AWS IAM user Access Key ID & Secret Access Key beforehand.
- Open Windows PowerShell as administrator.
- Enter the following command:
aws configure
-
AWS Access Key ID will be prompted, enter your IAM Access Key ID and press ENTER.
-
AWS Secret Access Key will be prompted, enter your IAM Secret Access Key and press ENTER.
-
For the rest of the options just press ENTER.
Here’s an example of how aws credentials will be asked.
After this, we are done with the setup and configurations.
The next steps are to encrypt and store the secrets in a keys.json file.
The following secrets shall be encrypted:
- Main_Db
- DEP_STRING
- public_key
- private_key
- api_key_rsa
- api_key
- Main_Db - You will need to run a query in SSMS and get the MAIN DB Connection string.
- DEP_STRING - You will be given the following DEP string from the DEP team.
- public_key, private_key, api_key_rsa, api_key - You will be given these by mail.
To get the Main DB connection string use the following query in ssms:
use <PUT_YOUR_DATABASE_NAME_HERE>;
select
'Data Source=' + @@servername +
'; Initial Catalog=' + db_name() +
case type_desc
when 'WINDOWS_LOGIN'
then '; Trusted_Connection=true'
else
';User Id=' + suser_name() + '; Password=<<YourPassword>>'
end
as ConnectionString
from sys.server_principals
where name = suser_name()
After you get all the plaintext secrets use the aws kms tool to encrypt all the secrets and store them in the keys.json file.
Command to encrypt:
aws kms encrypt --cli-binary-format raw-in-base64-out --key-id "<KEY_ID>" --plaintext "<SECRET_TO_ENCRYPT>"
SECRET_TO_ENCRYPT - Plain secrets needed to be encrypted.
KEY_ID - Key id present in the aws arn key.
For e.g. arn:aws:kms:eu-west-1:123456789:key/11111111-0000-0000-0000-000000000000 is the arn key
Now “1111111-0000-0000-0000-000000000000” is the key id.
You can refer to the following document for more information.
https://github.com/Flavien/SecretConfiguration
Store the encrypted secrets in the keys.json file now.
After this, you need to store the arn key in the secrets.json file.
Store the arn as follows:
{
“aws_key_id”: “<PUT_YOUR_ARN_HERE>”
}
Deploy the project in the server:
Download the middleware APIs archive file from the GitHub repository.
You can download it from here:
https://github.com/ssingularitytech/deloitte_middleware_api/archive/refs/heads/master.zip
Unzip the archive and paste the unzipped folder into the windows server instance.
Copy keys.json & secrets.json files into the root directory of the project where the .csproj file exists.
Copy the path of the root directory ( where the .csproj file exists).
Open Windows PowerShell and go to the directory using the copied location.
For e.g.
cd C://<The correct location you’ve copied>
Paste the following command:
dotnet publish --configuration Release
You’ll get the result as given below.
Now copy the whole project directory and paste it into the following location:
C:\\inetpub\\wwwroot\
For e.g.
Press the Windows key + R and type inetmgr to open IIS management tools.
Follow the given Images as follows:
Click on Browse Website (http) and see if there are any errors.