Skip to content

linux-training-group-1/asset-registry

Repository files navigation

The CI/CD pipeline

CI Pipeline CodeQL

cicd-full

Asset Registry Application

High level architecture

finalarch

Developer Guide

Create a virtual environment and activate it. Install the dependencies:
pip install -r requirements.txt -r requirements-dev.txt
Create a .env file on the project root. Add the following:

MYSQL_HOST=localhost
MYSQL_USER=asset-app
MYSQL_PASSWORD=password
MYSQL_DATABASE=asset_db
MYSQL_PORT=3306
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
SECRET_KEY=bff4eb94deb028b293786461

Run tests:
pytest --verbose --failed-first
Install MySQL and Redis if running locally

Run locally

Used for check the code while developing
Install requirements:
pip install -r requirements.txt
Start the application:
This will reload the app on file changes.
python3 run_locally.py

Run the complete setup locally

Start the setup
docker-compose up

We need to create the database tables and insert dummy data (Only needed the first time runing this setup)
Login to mysql
mysql -h localhost -P 3306 --protocol=tcp -u root -p
Create mysql database and tables
source scripts/table.sql
Add dummy data
source scripts/inserts.sql
If you want to start the mysql container only, use:
docker-compose up mysql

Build the docker image

To check if the docker image is working after changing the Dockerfile
Build the docker image
docker build -t asset-app .
Start the docker image
docker run --env-file=.env -itp 5000:5000 asset-app

The final presentation
https://docs.google.com/presentation/d/1K4E41Gm-nl5o9gfC0TgtCNCr_J8cKpusqlOGqORnu1c/edit?usp=sharing
Final report:
https://docs.google.com/document/d/1bQaODhZRSY3XHysZhLApM2hHU1YCk5TDrCV-tauAlbw/edit?usp=sharing