GithubHelp home page GithubHelp logo

denektenina / fusion-bmt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from equinor/fusion-bmt

0.0 0.0 0.0 3.41 MB

Barrier Management Tool

Home Page: https://fusion-bmt.app.radix.equinor.com

License: MIT License

C# 41.73% Dockerfile 0.15% TypeScript 57.54% JavaScript 0.39% Python 0.17% CSS 0.02%

fusion-bmt's Introduction

Barrier Management Tool

Build Status Codacy Badge

To run the project with docker-compose use:

  • docker-compose up --build

Prerequisites

Frontend

The frontend is built using TypeScript and components from the Equinor Design System (EDS).

Run frontend

cd frontend
npm install
npm start

Formatting

We use Prettier. Remember to set this up.

VSCode settings:

"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true

Page to edit Codacy settings

Backend

The backend is build using .NET 5.0. We use GraphQL to handle requests to the backend, and Hot Chocolate is used as the implementation in .NET.

We are using a Entity Framework SQL database for storing our data. The environment variable Database__ConnectionString can be a ADO.NET connection string to an existing database. If empty we use an InMemory database which is initialized with dummy data.

GraphQL schema

When running locally, a playground server for trying out GraphQL queries will be available at localhost:5000/graphql. This will not work properly in production, since the playground server will not provide a bearer token for authentication. For generating a bearer token and try out the API, the Swagger URL localhost:5000/swagger can be used.

The Schema used for the models in the backend can be found here.

Update frontend schema

When the data models in the backend changes, the corresponding models in frontend has to be updated as well. This is done by executing the command npm run schema in the fronend directory while the backend server is also running. Then there will be created an updated models.ts in the src/api folder which contains the updated models.

Run backend

cd backend/api
dotnet run

Configuration

Database configuration

Make sure you have dotnet-ef installed: dotnet tool install --global dotnet-ef and that you have set your Database__ConnectionString.

Check migrations existing in DB: dotnet ef migrations list

  • Create initial migration: dotnet ef migrations add InitialCreate
  • Delete database: dotnet ef database drop
  • Apply migrations: dotnet ef database update
  • Remove migrations: dotnet ef migrations remove
  • Roll back to earlier migration: dotnet ef database update {migragtion-name}

For populating SQL database with question templates go to backend/scripts make sure your Database__ConnectionString is set and run dotnet run -t PATH-TO-FILE. An example file of question templates: backend/api/Context/InitQuestions.json

Environment variables

Frontend Backend
Required AzureAd__ClientSecret
Optional API_URL
AD_APP_ID
ASPNETCORE_ENVIRONMENT
HTTPONLY
Database__ConnectionString

Deploy

We have 3 different environments in use; dev, test and prod. Dev is the environment that runs when pushing to master. Test and prod will run when pushing to the specific branches. Dev will only deploy to Radix environment, but Test and Prod will deploy the frontend to both Radix and Fusion.

Deploy to a specific environment is done by pushing a branch to the following branch:

git push upstream master:prod -f

This deploys the local master to prod environment. Remember to pull from upstream before performing this.

Dev

Test

Prod

Model overview

alt text

Etc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.