Skip to content

gagan144/peopleportal

Repository files navigation

PeoplePortal

This project is a playground for developing django web application and deploying it on cloud using Heroku, AWS, GCP, Docker, Kubernetes, etc.

Earlier, this project was submitted as an assignment for the BlueStacks position Senior Member of Technical Staff (SMTS). Now, this project is used for experimenting with new technologies.

Technology Stack

  • Web Framework: Python-Django
  • Backend: PostgreSQL
  • Frontend: Bootstrap, AngularJs, JQuery
  • DevOps: AWS/Heroku/Docker/Kubernetes

Application

RBAC(Role Based access control system) implementation

RBAC usage

Installation

1. Manual Installation Instructions

  • Create virtual environment

  • Activate virtual environment

  • Clone project

  • Install project dependencies (requirements.txt)

    pip install -r requirements.txt
  • Create settings.py in peopleportal directory using the template settings__template__.py. Edit all database and other settings variable.

  • Apply database migrations:

    python manage.py migrate
  • Create superuser

    python manage.py createsuperuser
  • Initialize System (Important)

    python manage.py initialize_system
  • Run server:

    python manage.py runserver
  • Open any browser and go to http://127.0.0.1:8000/ or open http://127.0.0.1:8000/admin/ to configure system.

2. Docker

2.1 Manually build docker images:

  • Django application:
    docker build -t gagan144/peopleportal-djangoapp .
    docker push gagan144/peopleportal-djangoapp
  • File server for kubernetes deployment:
    This container image is used to deploy static file behind ingress-nginx in a kubernetes cluster. This is not used in docker-compose setup.
    docker build -t gagan144/peopleportal-fileserver ./dockers/fileserver-k8s
    docker push gagan144/peopleportal-fileserver

Docker Hub Link: https://hub.docker.com/r/gagan144/peopleportal-djangoapp

2.2 Run containers using 'docker-compose':

  • Refer docker-compose.yml, Dockerfile, directory dockers/, peopleportal/_settings_docker.py file for better understanding.

  • Build images and run containers:
    Inside the project directory, run the following command

    docker-compose up --build
  • Default django admin credentials:
    URL: http://localhost:9000/admin
    Username: admin
    Password: admin

3. Kubernetes

All kubernetes yaml files are place inside k8s directory. The architecture is as follows:

  • Setup:

    • (IF USING MINIKUBE) Enable minikube ingress add-on:

      minikube addons enable ingress
    • (OPTIONAL) Create namespace ns-peopleportal:

      kubectl create namespace ns-peopleportal
      
      # Switch to namespace
      kubectl config set-context --current --namespace=ns-peopleportal
    • Create a k8s Secret:

      kubectl create secret generic secret-peopleportal --from-literal PG_PASSWORD=pgrootpass
  • Deploy: To deploy the project inside kubernetes cluster, use the following command:

    kubectl apply -f k8s

Screenshots

Change Logs

  • 2021-05-31
    • peopleportal/passwords.json deprecated.
    • Created peopleportal/settings_common.py to store all common configurations.
    • peopleportal/setting.py now contains only deployment specific configurations like db credentials, etc.
    • Removed peopleportal/settings.py. This should be manually created using peopleportal/settings__template__.py.
    • Docker deployment

Submitted By

About

BlueStacks PeoplePortal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published