/boardingpass

Boarding Pass

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Boarding Pass

Boarding Pass

Dependencies

Make sure you have docker installed and running Docker: https://www.docker.com/

Technology Stack

  • React
  • Python
  • Django
  • PostgreSQL

Entities

  • User - a person in the system who can view or manage keys within an organization depending on their role
  • Organization - Many to many relationship with users. A user can belong to many organizations, and an organization can have many users. Organization is the entity that owns device keys.
  • Device Key - a key consisting of three parts dev_eui, app_eui, and app_key (app_key is encrypted at rest in database)

User Roles

  • General User - Has view access to keys in an organization
  • Organization Staff - Can view & transfer keys within an organization
  • Super User - Can view and manage all keys within all organizations

Getting Started

In the project directory, you can run:

Local Set Up

  1. Create environment variable config file
touch ./backend/.env
  1. Set Up your environment variables in ./backend/.env
DB_NAME=
DB_USER=
DB_PASSWORD=
DB_HOST=
DB_SCHEMA=
DB_PORT=
FIELD_ENCRYPTION_KEY=

You can either point to the container credentials in docker-compose.yml or a remote database

  1. Build the contianers with docker-compose build

  2. Run the contianers with docker-compose up

  3. Apply migrations to database make migrate

  4. Create a super User in django make createsuperuser

  5. Go to http://127.0.0.1:8000/admin Login with super user credentials

  6. Create a user with username and password

  7. Review Swagger Documentation http://127.0.0.1:8000/swagger/

  8. Go to http://127.0.0.1:3000/ and sign in with your credentials

AWS Set Up

  1. Create EC2 Instance Ubuntu
  2. SSH into EC2 Instance https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html
  3. Git clone repository
  4. Run the following commands
sudo apt update & sudo apt upgrade    
sudo apt install python3-pip
python3 -m pip install --upgrade pip
  1. cd into boardingpass/backend
  2. Run touch .env Add credentials for
DB_NAME=
DB_USER=
DB_PASSWORD=
DB_HOST=
DB_SCHEMA=
DB_PORT=
FIELD_ENCRYPTION_KEY=

Note: You may need to spin up an RDS instance or point to remote database

  1. Run pip install -r requirements.txt
  2. Run manage.py collectstatic
  3. Run gunicorn --workers 3 --bind 0.0.0.0:8000 api.wsgi:application
  4. Update AWS Security group to allow anywhere access to port 8000
  5. View site at http://<ip_address>:8000/swagger/