Skip to content

Commit

Permalink
Update master branch (#466)
Browse files Browse the repository at this point in the history
* add update cotroller fnction

* getting new changes from this branch

* Able to update App information

* Able to update  services and env variables

* Finish all project update fields

* Remove project_id field from api docs

* Remove duplicate user project app route

* Increase token expiry time

* Backend resource cleanup for removing organisations, orgnisation_members and organisation_admins

* Add github authentication route

* change route from github_auth to oauth

* remove linter changes

* Fix dependency issue

* remove pycrypt dependency

* Add linting

* handle null email

* fix null git name issue

* feat: add db stats

* refactor: improve effeciency by reducing loops

* feat: add cluster count stats metadata

* feat: add summary status stats to deployments

* Add env variables and command to app detail info

* Add new user graph data

* feat: create graph data for apps

* refactor graph method implementation

* change graph method to class method

* Remove old configs (#261)

* Add organisation and project_type to project

* Enhancements (#263)

* edit config to source db variables from env

* add small nits to README file

* add updates to README, source variables in config file

* revert and only keep READme changes

* env alternative from .env in config

* edit READMe

* small nit

* feat: tag beta users (#265)

* feat: tag beta users

* correct typo

* Update app creation controllers (#266)

* update app schema fields

* update app creation controller, appschema

* update api docs

* update documentation

* Fix circleci build (#268)

* fix database password creation error

* edit circleci config

* small nit for perm

* update app update ingress rules (#269)

* add custom domain field to app model (#270)

* Let Apps and projects get deleted if the cluster doesnot exist (#271)

* Revert from custom domain to cc domain (#272)

* add revert custom domain endpoint

* Add revert url route

* remove redundant print statement

* remove duplication

Co-authored-by: mubangizi <mubangizia22@gmail.com>

* update app has custom domain status, update api docs, routes (#273)

* Add Authorization to roles endpoints (#277)

* Setup Pytest (#278)

* add pytest fixtures

* clean up test and report job

* add database fixture, functional tests

* Fix app update bug (#279)

* Add custom domain validation

* Add functionality to retrieve evn failed apps

* Remove custom domain commented code

* Add beta user check on app creation and up update

* Fix celery version issue (#283)

* bump celery requirement

* celery version

* GitHub workflow run tests and linter (#280)

* run tests and linter before pushing changes to repository

* skip linting

* clean versions

* remove redundant flake 8 requirement

* add warnings flag to workflow

* modify pytest run command

* delete redundant file

* define env in workflow

* edit app config name

* Add admin custom db route

* Extend database models(Billing) (#285)

* - add billing invoice model

* - add billing metrics model

* - add user payment details model

* - billing invoice schema

* - add models to manager module

* - update migrations with chnages

* CI/CD Revamp (#286)

* Test workflow should run on all pushes and PRs.

* Add staging workflow

* Add staging values file.

* Fix action reference.

* Remove not yet defined action.

* Specify namespace on rollout status.

* Remove circleci config.

* Restrict branch

* refactor: remove db status check on admin endpoint for retrieving all dbs

* Store transaction record on success (#287)

* - create transaction model and register in manage
module

* add transaction record schema

* add migrations

* - add transaction record endpoint

* - update api docs

* - register controller

* - register transaction route

* - small shema refactor

* add date created field

* - add date created field

* Add production workflows. (#289)

* Show user transactions and transaction detail (#291)

* - add user transactions view

* - add user transaction api docs

* - add transaction record detail

* - add route

* - add docs

* - update api docs

* - modify routes

* - refactor transactions endpoint

* - extend project model

* - extend model

* - update schema

* - update migrations

* fix failing post transcation route (#293)

* update transaction status (#294)

* Add billing cost endpoint (#292)

* Fix Migrations. (#295)

* Remove problematic migration(08246b2fe16f)

* Remove problematic migration(f4f92e)

* Update down_revision

* Create 011c3345849a_.py

* Add the prometheus url to a cluster (#296)

* Attach prometheus to cluster model

* Remove unused import

* Update kubernetes version and fix Ingress (#297)

* Update kubernetes version

* Remove unwanted migrations

* Add Celery to requirements.txt

* Fix app update route (#300)

* Client Invoice Integration (#298)

* - billing invoice endpoint pseudocode

* ft: create send invoice email functionality

* refactor invoice email

* - add live data integration for invoice

* - small nits

* - model change

* auto date cashed

* migrations

* Fix failing import and migration

* update html

* migration update

* schema and project model update

* - generate receipts and new invoices

Co-authored-by: MutegekiHenry <henrymutegeki117@gmail.com>
Co-authored-by: mubangizi <mubangizia22@gmail.com>

* Add string checker for app url on revert app url route (#301)

* refactor:add date to transcation payload (#303)

* Ft invoice details (#302)

* small nit

* get billing invoices list

* document endpoint

* add invoice detail view

* document invoice detail view

* - handle edge cases

* Added content to invoice email and gave the table more padding to give items more space for readability (#304)

* update staging variables, circleci migration (#307)

* update staging variables, circleci migration

* - delete circleci directory

* Get Receipt details (#306)

* small nit

* get billing invoices list

* document endpoint

* add invoice detail view

* document invoice detail view

* - handle edge cases

* - add receipts schema

* - receipts detail api

* - add routes and api docs

* - clean up

* small refactor

* add date field

* Ft add monitoring modules (#305)

* Add clusters statuses

* Add clusters statuses

* Add prometheus status

* Add database statuses

* Add cranecloud apps status

* Add mira status

* Remove auth

* On the invoice, formatted date for more readability and also added currency symbol to the amount. (#308)

* Change invoice email to include invoice id, remove project id and add change name label to user name (#311)

* Add cost modal url to cluster (#309)

* Add cost modal url to cluster

* Remove commented urls

* add credits models (#312)

* add credits models

* update model rlshp

* Fix failed test

Co-authored-by: Henry Mutegeki <hmutegeki@Henrys-MacBook-Pro.local>

* ft: add credits to user object on fetch all users (#313)

Co-authored-by: Henry Mutegeki <hmutegeki@Henrys-MacBook-Pro.local>

* created controllers and endpoints for credits (#314)

* retrieve user credit record (#315)

Co-authored-by: Henry Mutegeki <hmutegeki@Henrys-MacBook-Pro.local>

* added endpoint to get a users credit records (#316)

* Add trailing Invoice notifications (#317)

* Add user notification

* Fix invoice quering logic

* Remove comments

* Remmove unnecessary characters from db password (#318)

* Project cost values(Kubecost) (#319)

* - use kubecost data on billing invoice

* better edge case handling

* refactor

* add payments with credits (#321)

* add name to the user object on login (#322)

Co-authored-by: Henry Mutegeki <hmutegeki@Henrys-MacBook-Pro.local>

* Add ugx value to billing info (#324)

* Add Celery task for sending user invoices

* added feature to send email to user on assignment (#326)

* Ft refactor friendly invoice (#323)

* Made invoice id readable and in the format CCYY-a1b2c3d4e

* Made requested changes

* Delete 4bd21f73a577_.py

Was not supposed to be pushed

* added changes to email notification (#328)

* Added feater for credits expiration with celery (#331)

* Added feater for credits expiration with celery

* added change from pull request

* added change from pull request

* Added scheduler for notification of credits expiration (#333)

* Added feature where credits now expire based on usage as well (#334)

* Add project collaboration (#339)

* Create project users CRUD

* Change to use user emails instead of user ids

* Add Permissions to Projects, Apps and databases

* Add user project transfer

* Fix permissions checker function

* add owner role at project creation

* Separated promotional credits from purchased credits (#337)

* Separated promotional credits from purchased credits

* update celery scheduler to midnight

* Fix staging build (#340)

* add a celery version

* alter celery version

* fix conflicting ranges

* specify celery version

* refactor celery instance name

* introduce absolute imports

* absolute import at celery init

* move future import to file beginning

* remove future imports

* add importlib-metadata

* cleanup

* Fix migrations (#345)

* fix db uri

* edit down revision to avoid conflict

* Refactor promotional and purchased credits (#346)

* fix db uri

* edit down revision to avoid conflict

* new migration for purchased and promotion credit name change

* refactor purchase, promotion credit names

* Fix migrations (#347)

* fix db uri

* edit down revision to avoid conflict

* new migration for purchased and promotion credit name change

* refactor purchase, promotion credit names

* makes fields nullable

* small refactor db name

* migration revision for nullable field

* make fields nullable

* delete redundant migration

* add branch deployment

* revert changes

* make columns nullable

* remove temporary deplyment branch

* Ft update links (#348)

* Updated links to dashboard for credit expiry and credit assignment email notifications

* updated link in credit_expiration

* Ft notify user to project (#349)

* notifications to users for role on projects

* revert change

* changed spelling email notification

* Add user login and creation tests (#350)

* Add user login and creation tests

* add postgres db service to github actions

* revert to investigate test run

* test run with db service

* test db uri variable

* db url parsing

* formatting

* configure jwt secret

* remove jwt secret config

* comment out failing tests to test work flow

* add test db env variables

* test deployment after tests

* remove test deployment branch

Co-authored-by: e-ian <ianemma70@gmail.com>

* credit purchase transaction (#351)

* Setup logging (#354)

* add pymongo requirement

* add mongo connection client and document helper function

* time helper function

* apply to project function

* add requirements

* test deploy

* fix pymongo version

* downgrade zipp requirement

* back roll deployment from pull request

* test to deploy

* roll back staging deployment test

* Remove azure/helm-setup action.

* test staging deployment

* roll back test staging deployment

Co-authored-by: Innocent Asiimwe <asiimwe@outlook.com>

* Add user tests (#353)

* Add user login and creation tests

* add postgres db service to github actions

* revert to investigate test run

* test run with db service

* test db uri variable

* db url parsing

* formatting

* configure jwt secret

* remove jwt secret config

* comment out failing tests to test work flow

* add test db env variables

* test deployment after tests

* remove test deployment branch

* Add user tests

* add secrets to conftest

* small refactor

* test deployment on staging

* abstract test secret

* set app test secret in config

* revert testing config changes

* hard code testing secret

* roll back staging deploy on branch

Co-authored-by: e-ian <ianemma70@gmail.com>

* Adding tests for credit assignments endpoint (#356)

* Adding tests for credit assignments endpoint

* remove unused init file

* added more tests

* Configure test report (#359)

* add coverage requirement

* add test report generation to pipeline

* update test coverage badge

* integrate pull request report

* test staging deploy

* test build badge

* adding staging build badge

* roll back staging test deploy

* Create logger function (#355)

* Add logger function

* Add default value for MONGO_URL

* Remove action calls from project controller

Co-authored-by: mubangizi <mubangizi22@gmail.com>

* Fix build workflow (#364)

* fix build version and test deploy

* revert staging test build

* ft user collaboration: handle anonymous users invitations (#357)

* ft user collaboration: handle anonymous users invitations

* Adding tests for credit assignments endpoint (#356)

* Adding tests for credit assignments endpoint

* remove unused init file

* added more tests

* work on pr feedback: reformat email

* Configure test report (#359)

* add coverage requirement

* add test report generation to pipeline

* update test coverage badge

* integrate pull request report

* test staging deploy

* test build badge

* adding staging build badge

* roll back staging test deploy

* ft user collaboration: handle anonymous users invitations

* work on pr feedback: reformat email

* Create logger function (#355)

* Add logger function

* Add default value for MONGO_URL

* Remove action calls from project controller

Co-authored-by: mubangizi <mubangizi22@gmail.com>

* add extra checks on transitioning anonymous user to real user

* fix failing tests: add missing package

* Fix build workflow (#364)

* fix build version and test deploy

* revert staging test build

* ft user collaboration: handle anonymous users invitations

* work on pr feedback: reformat email

* ft user collaboration: handle anonymous users invitations

* rebase develop-new

* add extra checks on transitioning anonymous user to real user

Co-authored-by: Henry Mutegeki <hmutegeki@Henrys-MacBook-Pro.local>
Co-authored-by: bashaashma <bashaashma@gmail.com>
Co-authored-by: e-ian <36891299+e-ian@users.noreply.github.com>
Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>
Co-authored-by: mubangizi <mubangizi22@gmail.com>

* implemented user activities logs (#362)

* implemented user activities logs

* Fix build workflow (#364) (#366)

* fix build version and test deploy

* revert staging test build

Co-authored-by: e-ian <36891299+e-ian@users.noreply.github.com>

* fix merge conflict

* fix conflict

Co-authored-by: e-ian <36891299+e-ian@users.noreply.github.com>

* Check and validate flutter-wave payment status (#358)

* document endpoint using swagger

* add python flutterwave requirement

* implement payment verification logic

* register route

* downgrade python flutterwave version

* add python 3.8 to test pipeline

* test staging deployment

* update api docs with query params

* remove build check

* remove python flutterwave requirement add rave python

* check for build versions in matrix

* Add rave python logic

* edit route

* handle exception

* test staging build

* revert test deploy

* - add stable python build version

* update image runner version

* test deploy

* revert changes

* remove redundant pymongo

* feat: add accept or decline collaboration invite (#367)

Co-authored-by: Mutegeki Henry <hmutegeki@Henrys-MacBook-Pro.local>

* Add App Revision feature (#368)

* Add App revision list

* Able to revert apps

* Add update replicas for app revisions

* Add admin authorisation to revise app (#370)

* Add mongo to Docker Compose (#375)

* Add mongo service to dockercompose

* Add mongo db to docker compose

* Fix deployment workflows. (#376)

* Update staging workflow

* Update prod workflow

* Fix deploy workflow (For real 😄 ) (#377)

* specify zone

* Fix typo

* Use zone for location.

* fix deploy workflow

* fix user activity logs (#374)

* fix user activity logs

* fix actvity logs mongodb uri

* changes to yml

* Add Mongo URI to staging and prod configs (#380)

* Ft remove anonymoususers &  multi-project invites for anonymous user (#373)

* add delete for anonymous users

* allow for multiple project invites of anonymous user

* Add mongo to Docker Compose (#375)

* Add mongo service to dockercompose

* Add mongo db to docker compose

* Fix deployment workflows. (#376)

* Update staging workflow

* Update prod workflow

* Fix deploy workflow (For real 😄 ) (#377)

* specify zone

* Fix typo

* Use zone for location.

* fix deploy workflow

* fix user activity logs (#374)

* fix user activity logs

* fix actvity logs mongodb uri

* changes to yml

* add delete for anonymous users

* allow for multiple project invites of anonymous user

Co-authored-by: Mutegeki Henry <hmutegeki@Henrys-MacBook-Pro.local>
Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>
Co-authored-by: Innocent Asiimwe <asiimwe@outlook.com>
Co-authored-by: bashaashma <bashaashma@gmail.com>

* Upgrade Backend packages (#379)

* upgrade packages

* revert pyjwt requirement

* test build deploy

* revert test deploy

* increase rollout timeout

* test and deploy

* revert timeout time

* revert build deploy

* Ft increase logger coverage (#381)

* Add activity logger to App CRUD operations

* Add activity logger to database C.U.D operations

* Make log activity asynchronous

* Add test database uri

* Add default database to mongo client

* Ready for Production (#290) (#385)

* add update cotroller fnction

* getting new changes from this branch

* Able to update App information

* Able to update  services and env variables

* Finish all project update fields

* Remove project_id field from api docs

* Remove duplicate user project app route

* Increase token expiry time

* Backend resource cleanup for removing organisations, orgnisation_members and organisation_admins

* Add github authentication route

* change route from github_auth to oauth

* remove linter changes

* Fix dependency issue

* remove pycrypt dependency

* Add linting

* handle null email

* fix null git name issue

* feat: add db stats

* refactor: improve effeciency by reducing loops

* feat: add cluster count stats metadata

* feat: add summary status stats to deployments

* Add env variables and command to app detail info

* Add new user graph data

* feat: create graph data for apps

* refactor graph method implementation

* change graph method to class method

* Remove old configs (#261)

* Add organisation and project_type to project

* Enhancements (#263)

* edit config to source db variables from env

* add small nits to README file

* add updates to README, source variables in config file

* revert and only keep READme changes

* env alternative from .env in config

* edit READMe

* small nit

* feat: tag beta users (#265)

* feat: tag beta users

* correct typo

* Update app creation controllers (#266)

* update app schema fields

* update app creation controller, appschema

* update api docs

* update documentation

* Fix circleci build (#268)

* fix database password creation error

* edit circleci config

* small nit for perm

* update app update ingress rules (#269)

* add custom domain field to app model (#270)

* Let Apps and projects get deleted if the cluster doesnot exist (#271)

* Revert from custom domain to cc domain (#272)

* add revert custom domain endpoint

* Add revert url route

* remove redundant print statement

* remove duplication



* update app has custom domain status, update api docs, routes (#273)

* Add Authorization to roles endpoints (#277)

* Setup Pytest (#278)

* add pytest fixtures

* clean up test and report job

* add database fixture, functional tests

* Fix app update bug (#279)

* Add custom domain validation

* Add functionality to retrieve evn failed apps

* Remove custom domain commented code

* Add beta user check on app creation and up update

* Fix celery version issue (#283)

* bump celery requirement

* celery version

* GitHub workflow run tests and linter (#280)

* run tests and linter before pushing changes to repository

* skip linting

* clean versions

* remove redundant flake 8 requirement

* add warnings flag to workflow

* modify pytest run command

* delete redundant file

* define env in workflow

* edit app config name

* Add admin custom db route

* Extend database models(Billing) (#285)

* - add billing invoice model

* - add billing metrics model

* - add user payment details model

* - billing invoice schema

* - add models to manager module

* - update migrations with chnages

* CI/CD Revamp (#286)

* Test workflow should run on all pushes and PRs.

* Add staging workflow

* Add staging values file.

* Fix action reference.

* Remove not yet defined action.

* Specify namespace on rollout status.

* Remove circleci config.

* Restrict branch

* refactor: remove db status check on admin endpoint for retrieving all dbs

* Store transaction record on success (#287)

* - create transaction model and register in manage
module

* add transaction record schema

* add migrations

* - add transaction record endpoint

* - update api docs

* - register controller

* - register transaction route

* - small shema refactor

* add date created field

* - add date created field

* Add production workflows. (#289)

* Show user transactions and transaction detail (#291)

* - add user transactions view

* - add user transaction api docs

* - add transaction record detail

* - add route

* - add docs

* - update api docs

* - modify routes

* - refactor transactions endpoint

* - extend project model

* - extend model

* - update schema

* - update migrations

* fix failing post transcation route (#293)

* update transaction status (#294)

* Add billing cost endpoint (#292)

* Fix Migrations. (#295)

* Remove problematic migration(08246b2fe16f)

* Remove problematic migration(f4f92e)

* Update down_revision

* Create 011c3345849a_.py

* Add the prometheus url to a cluster (#296)

* Attach prometheus to cluster model

* Remove unused import

* Update kubernetes version and fix Ingress (#297)

* Update kubernetes version

* Remove unwanted migrations

* Add Celery to requirements.txt

* Fix app update route (#300)

* Client Invoice Integration (#298)

* - billing invoice endpoint pseudocode

* ft: create send invoice email functionality

* refactor invoice email

* - add live data integration for invoice

* - small nits

* - model change

* auto date cashed

* migrations

* Fix failing import and migration

* update html

* migration update

* schema and project model update

* - generate receipts and new invoices




* Add string checker for app url on revert app url route (#301)

* refactor:add date to transcation payload (#303)

* Ft invoice details (#302)

* small nit

* get billing invoices list

* document endpoint

* add invoice detail view

* document invoice detail view

* - handle edge cases

* Added content to invoice email and gave the table more padding to give items more space for readability (#304)

* update staging variables, circleci migration (#307)

* update staging variables, circleci migration

* - delete circleci directory

* Get Receipt details (#306)

* small nit

* get billing invoices list

* document endpoint

* add invoice detail view

* document invoice detail view

* - handle edge cases

* - add receipts schema

* - receipts detail api

* - add routes and api docs

* - clean up

* small refactor

* add date field

* Ft add monitoring modules (#305)

* Add clusters statuses

* Add clusters statuses

* Add prometheus status

* Add database statuses

* Add cranecloud apps status

* Add mira status

* Remove auth

* On the invoice, formatted date for more readability and also added currency symbol to the amount. (#308)

* Change invoice email to include invoice id, remove project id and add change name label to user name (#311)

* Add cost modal url to cluster (#309)

* Add cost modal url to cluster

* Remove commented urls

* add credits models (#312)

* add credits models

* update model rlshp

* Fix failed test



* ft: add credits to user object on fetch all users (#313)



* created controllers and endpoints for credits (#314)

* retrieve user credit record (#315)



* added endpoint to get a users credit records (#316)

* Add trailing Invoice notifications (#317)

* Add user notification

* Fix invoice quering logic

* Remove comments

* Remmove unnecessary characters from db password (#318)

* Project cost values(Kubecost) (#319)

* - use kubecost data on billing invoice

* better edge case handling

* refactor

* add payments with credits (#321)

* add name to the user object on login (#322)



* Add ugx value to billing info (#324)

Co-authored-by: Innocent Asiimwe <asiimwe@outlook.com>
Co-authored-by: mubangizi <mubangizia22@gmail.com>
Co-authored-by: “ttcollins” <“ttamalecollins@gmail.com”>
Co-authored-by: Tamale Talemwa Collins <51233620+ttcollins@users.noreply.github.com>
Co-authored-by: MutegekiHenry <henrymutegeki117@gmail.com>
Co-authored-by: Henry Mutegeki <36065782+MutegekiHenry@users.noreply.github.com>
Co-authored-by: Henry Mutegeki <hmutegeki@Henrys-MacBook-Pro.local>
Co-authored-by: Awath Javar Abdat <awath.abdat7@gmail.com>
Co-authored-by: bashaashma <bashaashma@gmail.com>

* fic workflow error on staging

* fix test run workflow

* implement activity logs changes (#372)

* implement activity logs fixes

* resolve conflict between developnew

* Add workflow to handle user ids if given or not a project_id

---------

Co-authored-by: Mubangizi <mubangizia22@gmail.com>

* Implementing last seen (#386)

* Implementing last seen

* Migrations for the last_seen field

* Add soft delete to Apps and Databases Models (#389)

* Add App soft delete

* Add soft delete to database model

* Implement project soft delete (#391)

* Add App soft delete

* Add soft delete to database model

* Implement project deletion

* Add pagination option (#392)

* Fix migration  (#394)

* edit migration head and test deploy

* remove test deploy

* Adding pagination to some GET endpoints (#393)

* Implementing pagination on critical get endpoints

* Additional pagination

* Update billing_invoice.py

* Update project_database.py

* Update app/controllers/receipts.py

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* Update app/controllers/transactions.py

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* Update app/controllers/users.py

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

---------

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* fix datetime issue with user activities (#395)

* Add Redis URL for staging and prod.  (#398)

* Add Redis URL variable

* Add redis URL variable

* Add more information to admin project details route (#397)

* Fix get all projects for admin

* Able to see project overview information as an admin

* Add project users to return info

* Add route to get cluster projects  (#396)

* Add get projects route

* Add route to api docs

* Ft admin disable projects (#400)

* implement project disable/enable

* merge develop-new changes

* show project and database disabled for UI (#402)

* Adding pagination to kube routes (#403)

* Adding number of pages to the pagination information returned (#404)

* Ft enable disable admin only (#408)

* add admin enable/disable feature

* removed commented code

* codecov 2.1.12 is deprecated upgraded to 2.1.13

* Upgrade select packages (#407)

* - upgrade cryptograpy, redis and werkzeug packages

* - test deploy upgrade branch

* - upgrade codecov to version 2.1.13

* - remove test deploy branch

* clean up for merge

* getting projects now return admin_disabled field (#410)

* Implemented search feature for projects in the backend (#411)

* resolve app status check (#413)

Co-authored-by: Mutegeki Henry <hmutegeki@Henrys-MacBook-Pro.local>

* Fix codecov support issue(Deprecated) (#415)

* - purge codecov requirement

* - test deploy pipeline

* - test and deploy

* - remove codecov upload

* Adding search functionality to users and apps (#412)

* Adding search functionality to users and apps

* resolve app status check (#413)

Co-authored-by: Mutegeki Henry <hmutegeki@Henrys-MacBook-Pro.local>

* Fix codecov support issue(Deprecated) (#415)

* - purge codecov requirement

* - test deploy pipeline

* - test and deploy

* - remove codecov upload

* Adding search functionality to users and apps

---------

Co-authored-by: Henry Mutegeki <36065782+MutegekiHenry@users.noreply.github.com>
Co-authored-by: Mutegeki Henry <hmutegeki@Henrys-MacBook-Pro.local>
Co-authored-by: e-ian <36891299+e-ian@users.noreply.github.com>
Co-authored-by: e-ian <ianemma70@gmail.com>

* Fixing app search functionality returning all apps (#416)

* Adding the organisation field to users object (#420)

* Adding the organisation field to users object

* Fixing tests

* Clock_settime

* User collaboration url (#421)

* user collaboration

* collaboration URL

* client URL

* feat: Add support for viewing inactive users per specific date. (#418)

* feat: Add support for viewing inactive users per specific date.

* allow user to spacify either date or the day, weeks, months or years

* compute day difference from entered date

* create a threshold of a month

* fix tests

* limit end-point for admins only

* add support for to and from date

* clean code

* update query parameters for inactive user's endpoint (#422)

added the start and date query parameter for `"/users/inactive_users":`

* Adding order_by parameter to queries (#424)

* refactor: inactive user cache, parameter handling and update API documentation (#423)

admin can get inactive users using start and end date like `users/inactive_users?start=2023-06-16&end=2023-06-12` or the days range like `users/inactive_users?range=30` for past 30 days

* Fixing reordering issues with projects (#425)

* refactor: allow search by  email (#426)

* Adding a default to user creation (#429)

* Refactor the get users endpoint to also fetch respective projects and apps (#430)

* Allow searching inactive users by date created (#427)

* refactor: Allow searching inactive users by date created

* refactor: Allow searching inactive users by date created

* Update users.py

* Update users.py

* Feat: Handle Apps not found on the cluster issue (#432)

* Add more db app table fields

* Able to save extra app information

* Add app redeploy route

* Add todo comment

* Fix migration issues (#433)

* chore: change staging branch

* Fixing the GET users endpoint and projects_count to the user-profile information (#434)

* Fix app redeploy error (#435)

* Create namespace if it doesnt exist on app creation (#438)

* Ft update admin project list: add filters and metadata (#437)

* fix brocken exception error

* add metadata and filters to project list

* fix pagination on filters

* remove organization filter

* remove organization filter api-docs

---------

Co-authored-by: Mutegeki Henry <hmutegeki@Henrys-MacBook-Pro.local>

* Applying the is_beta and verified flags on both the user's lists and graph data (#436)

* Applying the is_beta and verified flags on both the user's lists and graph data

* Adding metadata to user listings

* Update api_docs.yml

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* Update api_docs.yml

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* Update api_docs.yml

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* Update api_docs.yml

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* Making metadata more readable

---------

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* (feat): add admin get apps route (#440)

* Add apps list and graph data

* remove /apps/summary route

* (feat) improve admin database details (#439)

* Add get db metadata

* Add filter by db floavour

* Add database graph endpoint

* chore: update certifi from 2022.12.7 to 2023.7.22 (#441)

* ch update certifi from 2022.12.7 to 2023.7.22

* update postgres auth env

* remove dataclasses

* chore: update requests (#442)

* chore: update flask from 1.1.1 to 2.0.3 (#443)

* chore: update flask from 1.1.1 to 2.0.3

* Downgrade click

* Adding the overall system endpoint (#446)

* Adding the overall system endpoint

* Update app/controllers/system_status.py

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* Update app/controllers/system_status.py

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* Update system_status.py

---------

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* feat: remove flask script usage (#450)

* Add flask click commands

* Update usage of manage.py through the application

* uninstall flask script

* feat: add project level app disable functionality (#448)

* fix project db checker functionality

* Fix resource cleanup

* Fix ingress ExtensionsV1beta1IngressSpec issue on app deployment

* Able to disable and enable apps

* Add app database attributes

* Able to save apps as disabled

* Return right status for disabled apps

* Add app diable and enable endpoints

* Apply disable and enable helper functions

* Remove admin project disable routes

* chore: update readme with docker compose setup (#449)

* Update readme file

* update docker compose default envs

* Add redis service to docker compose

* Remove unnecessary text in README.md

* Applying the search functionality for inactive users based on email and name. (#452)

* Applying the search functionality for inactive users based on email and name.

* Update app/controllers/users.py

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* Fixing indentation

---------

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* feat: add user disable and enable functionality (#453)

* chore add decription to apidocs for user auth endpoints

* Add project enable and disable helper functions

* Add user disable and enable routes

* Remove project admin disabled field

* Update user metadata

* Fixing the resend of email to collaborators through refactoring the invitation endpoint. (#454)

* Remove status endpoint (#451)

* removed the system status endpoint

* remove endpoint

* removed systemstatus in controllers and routes

* deleted two controller files

* restored system_status.py and removed status class

* restored systemstatusview import

* feat: add single database disable and enable endpoints (#455)

* Able to disable and enable database

* use disable and enable db helper functions

* feat: add admin disable functionality (#456)

* Implement admin disable to projects

* add admin disable to app level

* add admin disable to database level

* Add typing to disable and enable helper functions

* Add extra information to user details route (#458)

* Sending emails to users about the status of their accounts  (#459)

* Sending emails to users about the status of their projects and also adding emojis to lighten up the email message

* Improve-wordings

* Adding affected user to logs

* Removing emojis from email message

* Update templates/user/user_disable_enable.html

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* Adding affected user id

---------

Co-authored-by: Mubangizi Allan <mubangizia22@gmail.com>

* feat(CI/CD): add docker webhook endpoint listener (#461)

* Add docker webhook listener

* Add app image update logic

* cleanup the logic

* remove unncessary file

* Update logs info

* feat: add app logger (#462)

* Setup app logger

* Configure logger

* Add log disable and enable edge cases

* feat: update docker webhook url (#463)

* Rename webhook class

* Update webhook url

* Add module log levels

* Update newrelic version (#464)

* Update newrelic version

* Remove dataclass from pip

---------

Co-authored-by: “ttcollins” <“ttamalecollins@gmail.com”>
Co-authored-by: inno-asiimwe <asiimwe@outlook.com>
Co-authored-by: Tamale Talemwa Collins <51233620+ttcollins@users.noreply.github.com>
Co-authored-by: MutegekiHenry <henrymutegeki117@gmail.com>
Co-authored-by: Henry Mutegeki <36065782+MutegekiHenry@users.noreply.github.com>
Co-authored-by: e-ian <36891299+e-ian@users.noreply.github.com>
Co-authored-by: e-ian <ianemma70@gmail.com>
Co-authored-by: Henry Mutegeki <hmutegeki@Henrys-MacBook-Pro.local>
Co-authored-by: Awath Javar Abdat <awath.abdat7@gmail.com>
Co-authored-by: bashaashma <bashaashma@gmail.com>
Co-authored-by: Beijukabruno <105637789+Beijukabruno@users.noreply.github.com>
Co-authored-by: mubangizi <mubangizi22@gmail.com>
Co-authored-by: LanternNassi <71936382+LanternNassi@users.noreply.github.com>
Co-authored-by: denishjackson1 <72918564+denishjackson1@users.noreply.github.com>
Co-authored-by: jnsereko <58003327+jnsereko@users.noreply.github.com>
Co-authored-by: Mirembe Mariam <mirembemariam3@gmail.com>
  • Loading branch information
17 people committed Oct 18, 2023
1 parent 631f180 commit f03a1f4
Show file tree
Hide file tree
Showing 49 changed files with 3,129 additions and 1,172 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
name: staging


on:
push:
branches:
- develop-new
- develop

jobs:
build:
Expand All @@ -18,7 +17,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install (Buildx)
uses: docker/setup-buildx-action@v1

Expand All @@ -31,7 +30,7 @@ jobs:
uses: google-github-actions/setup-gcloud@v1
with:
project_id: crane-cloud-274413
install_components: 'gke-gcloud-auth-plugin'
install_components: "gke-gcloud-auth-plugin"

- name: Login (GCR)
run: gcloud auth configure-docker
Expand Down Expand Up @@ -75,7 +74,6 @@ jobs:
}
Staging:

name: Deploy (Staging)

needs:
Expand All @@ -96,7 +94,7 @@ jobs:
uses: google-github-actions/setup-gcloud@v1
with:
project_id: crane-cloud-274413
install_components: 'gke-gcloud-auth-plugin'
install_components: "gke-gcloud-auth-plugin"

- name: Login (Kubernetes Cluster)
uses: google-github-actions/get-gke-credentials@v1
Expand Down Expand Up @@ -131,5 +129,4 @@ jobs:
- name: Monitor Rollout
run: |
kubectl rollout status deployment/cranecloud-backend --timeout=300s --namespace cranecloud
kubectl rollout status deployment/cranecloud-backend --timeout=300s --namespace cranecloud
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${{ secrets.TEST_DATABASE_PASSWORD }}
POSTGRES_DB: ${{ secrets.TEST_DATABASE_NAME }}
POSTGRES_HOST_AUTH_METHOD: trust
options:
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
Expand Down
160 changes: 111 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,108 +1,170 @@
# Crane Cloud

![Test](https://github.com/crane-cloud/backend/actions/workflows/test.yml/badge.svg)
![Build](https://github.com/crane-cloud/backend/actions/workflows/staging.yml/badge.svg)
[![codecov](https://codecov.io/gh/crane-cloud/backend/branch/develop-new/graph/badge.svg?token=kkuF1X6MWx)](https://codecov.io/gh/crane-cloud/backend)
[![Test](https://github.com/crane-cloud/backend/actions/workflows/test.yml/badge.svg)](https://github.com/crane-cloud/backend/actions/workflows/test.yml)
[![Build](https://github.com/crane-cloud/backend/actions/workflows/staging.yml/badge.svg)](https://github.com/crane-cloud/backend/actions/workflows/staging.yml)
[![codecov](https://codecov.io/gh/crane-cloud/backend/branch/develop/graph/badge.svg?token=kkuF1X6MWx)](https://codecov.io/gh/crane-cloud/backend)

Managed Kubernetes Platform

### Project Setup
## Project Setup

Follow these steps to have a local running copy of the app.

##### Clone The Repo
### Clone The Repo

`git clone https://github.com/crane-cloud/backend.git`

If `master` is not up to date, `git checkout develop-new`. However, note that code on develop-new could be having some minor issues to sort.
```bash
git clone https://github.com/crane-cloud/backend.git
```

##### Install PostgreSQL

Here's a great resource to check out:
### Directly on your machine
---
#### Install PostgreSQL

[How To Install and Use PostgreSQL](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04)
Here's a great resource to check out: [How To Install and Use PostgreSQL](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04)

Create the two databases `cranecloud` (for development) and `cranecloud_test_db` (for unit testing).
Create the two databases:
- `cranecloud` (for development)
- `cranecloud_test_db` (for unit testing)

##### Create a Virtual Environment
#### Create a Virtual Environment

App was developed with `Python 3.6`.
App was developed with Python 3.6.

Make sure you have `pip` installed on your machine.

Create a pip virtual environment you can call it `venv`
Create a pip virtual environment called `venv`.

Activate the virtual environment.
Activate the virtual environment:

`. venv/bin/activate`
```bash
. venv/bin/activate
```

Install the dependencies.
Install the dependencies:

`pip install -r requirements.txt`
```bash
pip install -r requirements.txt
```

Create a `.env` file (which defines the environment variables used) at the root of the app.

Add the following details, customizing as needed.
Add the following details, customizing as needed:

```
```bash
export FLASK_APP=app.py
export FLASK_ENV=development
export FLASK_DEBUG=1
export FLASK_RUN_PORT=5000
export FLASK_APP_SECRET=<app_secret>
```

Run the application.
Run the application:

```bash
flask run
```

### Running application with Docker
---
`make` is a build automation tool that is used to manage the build process of a software project.

- In the project directory, running `make` shows you a list of commands to use.
- Run `make start` to start the application and required services.
- Run `make connect-to-container` to connect to the Flask application container after running `make start`.


---
> Application should be running on http://localhost:5000 and apidocs on http://localhost:5000/apidocs/#/
<!-- --- -->
## Finishing up

>To run with Docker, you have to ssh into the container first by running `make connect-to-container`, and then execute the following commands.
### Running Migrations

`flask run`
The application uses SQLAlchemy ORM to manage and run database migrations.

#### Running Migrations
To run migration upgrade against the database relations, use the following command:

The application uses sqlalchemy ORM to manange and run database migrations
```bash
flask db upgrade
```

Run `python manage.py db upgrade` command to run migration upgrade against the database relations
To run migrations in case there are changes in the schema, use the following command:

Run `python manage.py db migrate` command to run migrations incase there are changes in the schema
```bash
flask db migrate
```

##### Testing and Coverage
### Testing and Coverage

This app uses `nose` to run tests.

`nosetests --with-coverage --cover-package=routes` to run with coverage
To run tests with coverage:

or `nosetests` to run without coverage
```bash
nosetests --with-coverage --cover-package=routes
```

##### Creating default roles
To run tests without coverage:

To create the default roles
```bash
nosetests
```

`python manage.py create_roles`
### Creating default roles

##### Creating default admin account
To create the default roles, run:

To create an admin account run
```bash
flask create_roles
```

`python manage.py admin_user --email=<an email> --password=<the password> --confirm_password=<the password>`
### Creating default admin account

#### To add clusters locally
To create an admin account, run:

Run the application using `flask run` and visit `http://127.0.0.1:5000/apidocs/#/clusters/post_clusters`
```bash
flask admin_user --email=<email> --password=<password> --confirm_password=<password>
```

`{ "description": "string", "host": "string", "name": "string", "token": "string" }`
Reach out to backend team to get token and host values
### To add clusters locally

##### Add image repositories
Run the application using `flask run` and visit [http://127.0.0.1:5000/apidocs/#/clusters/post_clusters](http://127.0.0.1:5000/apidocs/#/clusters/post_clusters)

To add image repositories to the database run
Use the following JSON payload:

`python manage.py create_registries`
```json
{
"description": "string",
"host": "string",
"name": "string",
"token": "string"
}
```

##### Run celery worker and beat on linux with
Reach out to the backend team to get token and host values.

`celery -A server.celery worker --loglevel=info`
`celery -A server.celery beat --loglevel=info`
## Optional things
### Add image repositories

##### Run celery worker and beat on windows with
To add image repositories to the database, run:

`celery -A server.celery worker --pool=solo --loglevel=info`
`celery -A server.celery beat --loglevel=info`
```bash
flask create_registries
```
### Starting celery workers
#### Run celery worker and beat on Linux

```bash
celery -A server.celery worker --loglevel=info
celery -A server.celery beat --loglevel=info
```

#### Run celery worker and beat on Windows

```bash
celery -A server.celery worker --pool=solo --loglevel=info
celery -A server.celery beat --loglevel=info
```
Loading

0 comments on commit f03a1f4

Please sign in to comment.