Skip to content

Webapp to demonstrate the material of Course MATH2415 - Discrete Mathematics in RMIT Uni

Notifications You must be signed in to change notification settings

tarekmulla/discrete-math

Repository files navigation

Python Check Terraform deployment ECR Image

Logo

Discrete Math repository

Discrete Math demo is a tool built by Tarek Mulla, student number s3992651.

The purpose of this application is to demonstrate the material of Course MATH2415 - Discrete Mathematics in RMIT University | Master of Cyber Security.

Architecture

The project contains 2 parts: Infrastructure, and Web application

Infrastructure

The infrastructure part responsible for provisioning the cloud resources in AWS, this part is built using Terraform.

The RMIT infrastructure should be provisioned before the application infrastructure, this repo is responsable to create all base (e.g. ECR, S3) and shared (e.g. VPC, NAT) resources for RMIT projects; Please check the repository rmit-infrastructure for more details.

The following architecture shows all the components in the cloud infrastructure (both the base and the app resources):

design

Web application

The web application is built using flask framework, and is hosted in Fargate in AWS. The application uses the web template engine Jijna for the python programming language.

The web application can be accessed via the URL: discrete-math.rmit.mulla.au; The application interacts with the backend by sending requests to the API gateway api.discrete-math.rmit.mulla.au.

Note that the api gateway required a token to authorize access to its resources.

The web application provides access to the user after they signing in to the website, all user details are saved securely in Amazon Cognito.

Deployment prerequisites

Before you provision the infrastructure you will need to make sure the following requirements are satisfied:

  1. Make sure the RMIT nfrastructure is provisioned in the same account the web application will deployed to.

DevSecOps practices

The application has couple of check to follow best practices, and make sure the application is secure, please notice that this part still in-progress.

Github actions

The project use github action to check, test, and deploy the application. The followings are the actions it supported now:

  • ecr-image: This action responsable on generating the ECR image and push it to AWS ECR when a new commit pushed to the main branch.
  • check-python: This action is triggered whenever a new pull request opened, it runs couple of tools to check the python linting, format, static code analysis, and run unittests for the python source code.
  • terraform-plan: This action checks the Terraform plan and shows it in the pull request.
  • terraform-deploy: This action deploys the terraform infrastructure when a new commit pushed to the main branch.

Other tools

The repository has integration with other tools to check the security for the source code; Those tools are:

  • gitguardian: To scan the opened pull requests and check if it contains secrets or senstive information in the code changes.
  • Snyk: To scan the source code, and find vulnerabilities in both Terraform and docker images, and suggest security best practices.

How do I get set up?

Terraform

  • Install Terraform
  • Install and configure AWS CLI based on where you want to provision the tool.
  • Create terraform.tfvars file, and customize the terraform variable values.
  • Init, plan and apply terraform. See: Provisioning Infrastructure

Web application

  • Install docker
  • Install docker compose
  • Create .env by copying .env.example and update the values
  • Make sure docker is running
  • Run commands that provided in ./Makefile:
    • make run: run the webapp, can be accessed on localhost:8080
    • make stop: stop the webapp

Who do I talk to?

You can contact me directly using one of the following:

Resources

Resources used to help creating this application:

  1. Logo generated using logo.com
  2. Bootstrap documentation
  3. Terraform documentation
  4. https://www.geeksforgeeks.org/print-all-prime-factors-and-their-powers
  5. https://github.com/BaReinhard/Hacktoberfest-Mathematics/blob/master/algebra/bezout/python/bezout.py
  6. https://github.com/xehoth/TruthTableGenerator