Skip to content

jimdevops19/rlocker-1

 
 

Repository files navigation

Resource Locker project

This project is a Back-end service with API endpoints and web UI, for monitoring the resources created in different cloud providers, define their usage availability by locking/unlocking a resource.

Project Dependencies:

  • rlockerservices - Services repository that the rlocker uses
  • rlockertools - A Python based client interface to interact with the platform

Quick Start Video will be added soon

Project Architecture:

Django website with applications, account, api, dashboard, health, lockable_resource, rqueue

  • account: Designed to add more functionalities to the built-in user app

    • management: Directory that includes other python files that could be used as python manage.py name_of_file
    • __ init __: Packaging this account directory (Django App)
    • apps: Application configurations
    • signals: A signal to create a Token object so each Account will have an associated Token
    • urls: Urls that are related to the Account, like user login
    • views: Views that are related to auth actions like login and logout (We do not enable registration from the WEB UI)
  • admin_tools: Designed to add more administrative actions, such as importing and exporting the current status of lockable resources

    • __ init __: Packaging this account directory (Django App)
    • apps: Application configurations
    • urls: Urls that are related to the Admin tools
    • views: Views in order to display the different administrative tools
  • api: Application Programming Interface in order to automate resource locking releasing via endpoints.

    • __ init __: Packaging this account directory (Django App)
    • apps: Application configurations
    • custom_permissions: For enabling only access for non anonymous users, a permission mechanism should be written in api application
    • serializers: Serializers Object for the api, to prepare JSON responses.
    • urls: Endpoints that are enabled after the api prefix
    • utils: Useful functions for the api application
    • views: Views where we will take actions in each endpoint, depending on the request method.
  • dashboard: Designed to display a read-only dashboard for more centralized view of the lockable resources with more details

    • __ init __: Packaging this account directory (Django App)
    • apps: Application configurations
    • urls: Endpoints that are enabled for this application
    • views: Views where we will manipulate the data we'd like to display in the dashboard
  • health: Designed to have a health check URL that returns a raw string, so it will be easier to check health of the entire platform

    • __ init __: Packaging this account directory (Django App)
    • apps: Application configurations
    • urls: URL endpoints of this specific application
    • views: Views of this specific application
  • lockable_resource: Application Programming Interface in order to automate resource locking releasing via endpoints.

    • __ init __: Packaging this account directory (Django App)
    • management: Directory that includes other python files that could be used as python manage.py name_of_file
    • action_manager: Includes all the classes that are doing some action on the lockable resource
    • admin: Model Registrations to the admin panel of the Django Application
    • apps: Application configurations
    • constants: Constants of the lockable resource app, we define there rules for available status types that a lockable resource object can have
    • exceptions: We define in the exceptions the actions that are not making sense, for i.e locking a resource that is already locked
    • label_manager: Takes responsibility to perform smart retrieving of an available resource by only specifying it's label
    • query_param_manager: Includes functions for handling query params in the lockable resource page (for i.e: ?view_as=yaml)
    • models: Modelize a schema of the table for different Lockable resources we will manage.
    • signals: Signals to be triggered once a specific field of lockable resource object changes
    • urls: Available URL's from the Web UI to manage the lockable resources
    • views: Design of the views and actions to take in GET/POST requests.
  • rqueue: Application for managing the requests that could not be locked immediately, this is a queue management system application

    • __ init __: Packaging this account directory (Django App)
    • admin: Model Registrations to the admin panel of the Django Application
    • apps: Application configurations
    • constants: Constants of the rqueue app, we define there priority enumerations, time intervals for resource availability check
    • context_processors: Since we want some data to be accessible from each HTML template, we have to define it as a global context that is available (from settings.py)
    • models: Modelize a schema of the table for different requests in queue
    • signals: Signals to be triggered once a rqueue object is being created.
    • urls: Available URL's from the Web UI to manage the requests in queue
    • utils: Helper functions for the rqueue applications. for i.e - displaying nicer string for the pended time of a queue
    • views: Design of the views and actions to take in GET/POST requests.

How to use Addons (Plugins) in the Resource Locker Project (To be documented)

Dev mode:

  • The following are commands to run in your terminal, each line represents a pattern of: command to run Explanation
    • git clone https://github.com/red-hat-storage/rlocker.git Clones the project
    • cd rlocker Change directory
    • python --version Python3.8 or above is required, please double-check this with that command
    • python -m venv venv Create a virtual environment for the django app
    • The following command differs from Windows to Linux systems:
      • venv\Scripts\activate Run this to activate the venv on Windows
      • source venv/bin/activate Run this to activate the venv on Linux
    • pip install -r requirements.txt Install the required packages
      • Expected errors on the command above:
    • The following commands are environment variable setups. The command to set an env variable is export (PLEASE USE SET AND NOT EXPORT IN WINDOWS!)
      • Visit the following website in order to generate a secret key for our Django application: link
        • Click the Generate button to generate a DJANGO_SECRET. Now the secret key is copied to your clipboard (Could be pasted the next time you send a Ctrl+V)
        • export DJANGO_SECRET='<YOUR_COPIED_SECRET>' Set this env variable. The wrapping with single quotes is important!
        • export USE_DEV_DB=True Here we specify to use the local db.sqlite3 file and not a PostgreSQL database engine (That is why, we could skip the psycopg2-binary package in previous steps)
        • export DEBUG=True Debug mode on.
    • Launch the website on the desired port (default is 8000)
      • python manage.py runserver <OPTIONAL_PORT> As said above, you do NOT HAVE to mention the <OPTIONAL_PORT>
    • Login Credentials are: admin, Admin-1
  • Next Steps:
    • Visit the rlockerservices project in order to setup the queue_service. The queue service is the component that processes the queues that are coming from rlocker-cli.

Production

  • To be documented

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 51.8%
  • HTML 20.4%
  • CSS 14.1%
  • Python 8.1%
  • CoffeeScript 5.2%
  • Less 0.3%
  • Other 0.1%