This is a project that provides applicants with an opportunity to get acquainted with the list of educational institutions that provide education in our region. Applicants can get detailed information about the available specialties that are required for admission, training materials etc.
This project contains 3 main parts: client frontend, backend and database. Frontend part of the project is at https://github.com/ita-social-projects/YIF_Frontend
Let's take a closer look at the technologies of each part.
Client Frontend - some kind of unicorn magic is used here
Backend - ASP.NET Core 3.1, Doker, FluentValidation, Swagger, Automaper, Identity Server, Azure, Jenkins.
Database - MS SQL SERVER, Microsoft Azure.
Code quality - SonarCloud.
Testing - XUnit
SDLC - Scrum/Kanban
Clone or download the project from https://github.com/ita-social-projects/YIF_Backend
-
Install ASP.NET Core 3.1
-
Install Entity Framework
-
Create local database from https://github.com/ita-social-projects/YIF_Backend
-
Open project in Visual Studio or enter command "dotnet run [-c|--configuration ] [-f|--framework ] [--force] [--interactive] [--launch-profile ] [--no-build] [--no-dependencies] [--no-launch-profile] [--no-restore] [-p|--project ] [-r|--runtime <RUNTIME_IDENTIFIER>] [-v|--verbosity ] [[--] [application arguments]]"
Git Docker for Mac, Docker for Windows, or Docker Engine
To run this application, first git clone the project.
- Clone repository from GitHub with: command: git clone https://github.com/ita-social-projects/YIF_Backend.git
You should add appsettings.json to project (folder YIF_Backend/YIF_Backend). Check: 1)the connection string in appsettings.json "ConnectionStrings": { "DefaultConnection": "Server=yifsql,1433;Database=master;User Id=SA;Password=YIF_Backend_DB_MyKeyOnlyInMyHeart;" }
- Seeder in Startup.cs #region Seeder SeederDB.SeedData(app.ApplicationServices); #endregion
Then run these commands to start the containers: cd YIF_Backend docker-compose up --build
Then you can access the web api at http://localhost:5000/swagger/index.html
Run command to stop the containers: docker-compose stop
Run command to delete the containers: docker-compose down
Note that there are two images - one for the web api (yifbackend) and one for SQL Server (yifsql). The yifsql image uses mcr.microsoft.com/mssql/server:2017-latest as the base. It is the SQL Server image for running on Linux. Whenever you start a mcr.microsoft.com/mssql/server:2017-latest container, you need to pass in some environment variables:
ACCEPT_EULA: "Y" SA_PASSWORD: "YIF_Backend_DB_MyKeyOnlyInMyHeart"
For this demo the password is set to 'YIF_Backend_DB_MyKeyOnlyInMyHeart' but you can change it if you want. Make sure you also change it in appsettings.json configuration if you do though!
Note that the server name is 'yifsql'. This is the name that the SQL Server container is known by the web container as on the container network. Note the name of the DB is 'master'. You can change this to whatever you want. Entity Framework will attempt to create the DB if it doesnt already exist.
Clone
YIF_Frontend
andYIF_Backend
in the same folder.
git clone https://github.com/ita-social-projects/YIF_Backend.git
git clone https://github.com/ita-social-projects/YIF_Frontend.git
Configure as per instructions in the YIF_Frontend and YIF_Backend repositories:
Uncomment:
- File
YIF.Core.Data/Seaders/SeederDB.cs
, linecontext.Database.Migrate();
- File
YIF.Backend/Startup.cs
, lineSeederDB.SeedData(app.ApplicationServices)
Add files appsettings.json
and appsettings.Testing.json
to YIF_Backend/YIF_Backend. Ensure that the following Code is uncommented.
"DefaultConnection":"Server=yifsql, 1433;Database=YITF;User Id=SA;Password=YIF_Backend_DB_MyKeyOnlyInMyHeart;"
Add
.env
file to theYIF_Frontend
(.env
is not presented in the github repository, you need to ask one of the developer for it)
Create
docker-compose.yml
file on the same folder level asYIF_Backend
andYIF_Frontend
.
.
├── YIF_Backend ← cloned YIF_Backend repository
├── YIF_Frontend ← cloned YIF_Frontend repository
├── docker-compose.yml
Paste below code in the
docker-compose.yml
file.
version: "3.8"
services:
yif_frontend:
build:
dockerfile: Dockerfile.development
context: ./YIF_Frontend
ports:
- "3000:3000"
container_name: yif_frontend
restart: always
yif_backend:
build:
dockerfile: Dockerfile.VM
context: ./YIF_Backend
container_name: yif_backend
image: smethan/yifbackend:latest
networks:
- yif
ports:
- "5000:3000"
depends_on:
- yif_sql
restart: always
yif_sql:
image: mcr.microsoft.com/mssql/server:2017-latest
container_name: yif_sql
networks:
- yif
ports:
- "1433:1433"
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: "YIF_Backend_DB_MyKeyOnlyInMyHeart"
MSSQL_PID: "Express"
restart: always
volumes:
- yifsqldata:/var/opt/mssql/data
networks:
yif:
name: yif
driver: bridge
volumes:
yifsqldata:
Run the following command on the same level:
docker-compose up --build
If the project doesn't open automatically, open your browser and type:
http://localhost:3000
Azure account Virtual machine Ubuntu18.04 Allow port: 5000 on Virtual machine Git (https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) Docker Engine on Ubuntu (https://docs.docker.com/engine/install/ubuntu/) Docker-compose (https://docs.docker.com/compose/install/)
Look above ## How to run the project with docker-compose locally
Then you can access the web api at http://ip:5000/swagger/index.html
- Copyright 2020 © SoftServe IT Academy.