Skip to content

Commit

Permalink
Multi tenant implementation (#3937)
Browse files Browse the repository at this point in the history
* Preparing for multi tenant (#3639)

* Upgrade django, and remove wagtail

* Add flower for celery monitoring

* Add django-taggit

* Fix missing libraries

* Show theme based on site

* Update summary api

* Use site setting based on domain (#3640)

* Use site setting based on domain

* Update site_setting.py

* Add source_site to records, update search, fix tests (#3642)

* Add source_site to records, update search, fix tests

* Improve search and tests

* Taxa management improvement (#3643)

* Improve the layout of taxa management page

* Show taxa management page to normal user, add permissions handler, update tests

* Fix broken tests (#3645)

* Feature/update bio filter owner embargo (#3651)

* Bump django from 4.1.10 to 4.1.13 in /deployment/production (#3569)

Bumps [django](https://github.com/django/django) from 4.1.10 to 4.1.13.
- [Commits](django/django@4.1.10...4.1.13)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump gitpython from 3.1.35 to 3.1.37 in /deployment/docker (#3520)

Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.35 to 3.1.37.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](gitpython-developers/GitPython@3.1.35...3.1.37)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix search wetland sites by site code, fix db restore (#3646)

* Fix wetland site codes incorrect when uploaded as csv (#3647)

* Fix delete site visit (#3648)

* Feature delete records by source reference id (#3649)

* Add button

* Feature to delete records by source reference id

* Develop functionality to show occurrence data per month  (#3650)

* Add chart data by month for site dashboard

* Implement switch dashboard frequency in frontend

* Update bio query to include owner check with embargo date

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Taxa hierarchical user management (#3652)

* Automatically create taxonomic groups based on the expert level

* Add experts selection in taxon group edit

* Update JSONFIELD

* Fix search by site

* Fix add collection and search process

* Fix site visit list

* Update admin to show associated site

* Fix taxon management

* Initial implementation of tagging taxa (#3654)

* Initial implementation of tagging taxa

* Filter taxa by tags

* Add embargo date to sass form (#3655)

* Add cites api wrapper (#3661)

* Add gbif util to fetch species by area (#3678)

* Add view to harvest gbif species (#3679)

* Add view to harvest gbif species

* Improve find_species_by_area

* Add site to location context group (#3683)

* Build and push multi tenant tag

* Implement a user interface to allow species to be designated as the parent point for retrieving species data from GBIF. (#3684)

* Show map in harvest species (#3685)

* Feature to show non-biodiversity layers on different sites (#3692)

* Expert should be able to add taxon (#3693)

* Show taxon sub groups (#3694)

* Show taxon sub groups

* Improve the ux

* Add validation status, endemism, and origin to TaxonGroupTaxonomies table (#3695)

* API Endpoint and Model for Taxonomy Update Proposals (#3697)

* Backend API and model for reviewing taxon update proposals (#3700)

* Api to approve taxon update proposal

* Temp

* Add reviewer

* Improve taxon update review process

* Add reject test

* Additional observation sites for collection record (#3701)

* Additional observation sites for collection record

* Update search

* Update import gbif to update existing record to add current site id

* Update models for multi-tenant (#3703)

* Handle source site in occurrences upload (#3707)

* Update DATABASE setting for prod

* Refactor taxa management (#3710)

* UI for Managing Submodule in Taxon Management Page (#3711)

* Add devops build automation (#3712)

* Update landing page icons for FBIS (#3699)

* Add devops build automation

---------

Co-authored-by: Dimas Ciputra <[email protected]>

* Reload page after adding new taxon (#3715)

* Update UI for taxon approval workflow (#3716)

* Update UI for taxon approval workflow

* Update reject workflow

* Add feature to upload geojson boundary file (#3705)

* Add feature to upload geojson boundary file

* Logged in only

* Improve UI

* Fix migrations

* Excel download (#3722)

* Download excel (#3718)

* Update landing page icons for FBIS (#3699)

* add download excel

* remove csv file

---------

Co-authored-by: Dimas Ciputra <[email protected]>

* Improve excel download workflow (#3723)

* Fix migrations

* Add xls resource type to download request

---------

Co-authored-by: Faneva Andriamiadantsoa <[email protected]>

* Fix custom theme cache not invalidated (#3725)

* Add confidence score to bims tables (#3724)

* Add SASS migration (#3728)

* Fix layer upload, improve gbif species harvester (#3729)

* Fix unvalidated species returned in taxa list (#3730)

* Improve find_species_by_area (#3731)

* Update max limit in find_species_by_area

* Add additional sites field in non_biodiversity_layer (#3733)

* Import common names in gbif species harvester (#3736)

* Used defaultWMSSiteParameters for emptySite (#3734)

* Collect parent species in the harvester (#3737)

* Upload images in flat pages (#3738)

* Use FBIS Site legend (#3739)

* Improve harvest gbif species (#3740)

* Fix get_feature_info (#3741)

* Harvest species per feature (#3742)

* Fix get_feature_info

* Harvest gbif species per feature

* Fix taxon approval (#3743)

* Taxa management fixes and improvements (#3745)

* Harvest species by facet (#3747)

* Multi tenant fix and improvements (#3748)

* Update harvest gbif to use boundary model instead

* Update location context script to get correct geocontext keys

* Filter out extinct species

* Improve GBIF species harvester (#3749)

* Update parent if the parent is different from gbif (#3750)

* Only import occurrences with basisRecord HUMAN_OBSERVATION (#3751)

* Improve gbif occurrence harvester (#3753)

* Resume harvest functionality (#3758)

* Update landing page icons for FBIS (#3699)

* Fix print map not working (#3754)

* Update overview table in pesticide dashboard (#3727)

* update overview table in pesticide dashboard

* Update pesticide/templates/pesticide_dashboard.html

---------

Co-authored-by: Dimas Ciputra <[email protected]>

* Fix form update not submitted (#3755)

* Remove module info (#3757)

* Add function to resume harvest

---------

Co-authored-by: Faneva Andriamiadantsoa <[email protected]>

* Improve module summary

* Improve module summary query

* Add database routing

* Notification for specific site

* Update source collection

* Fix site legend (#3769)

* Improve taxa management (#3770)

* Update location_context_group command to fetch specific site (#3771)

* Implement role-based access control for biologicalcollectionrecord (#3773)

* Harvest occurrences by boundaries (#3774)

* Set uwsgi processes to 4

* Update uwsgi.ini

* Update get_location_context_data to fetch by site

* Update psycopg2 lib

* [feat] Add feature to upload polygon

* Add edit taxon form feature

* Fix tests

* Handle other fields

* Fix missing parent when updating taxon

* Create an api to download taxa list as pdf

* Ensure all taxonomy changes are times tamped and logged

* Improve taxa list download (#3833)

* Show download request modal

* Add ui to download pdf

* Source references by site (#3834)

* Show source references based on current site id

* Ensure source references are assigned to correct site

* Add auth background field in custom theme (#3836)

* Add settings to change site name and hide site visit (#3837)

* Fix add source reference not updating active sites

* Fix and improve gbif harvester (#3839)

* Update script to fix duplicate site visits (#3843)

* Fix module list and source reference list (#3845)

* Implement schema per tenant, add script to migrate data (#3848)

* Implement schema per tenant, add script to migrate data

* Fix source reference api

* Fix spatial scale filter

* Update module_summary

* Update prod multi-tenant database setting (#3851)

* Update scripts

* Fix location site view on multi-tenant (#3852)

* Fix bug where incorrect sites appear when searching with ecosystem (#3850) (#3853)

* Improve multi-tenant and fix tests (#3855)

* Improve multi-tenant and fix tests

* Fix broken tests

* Improve embargo implementation (#3856)

* Fix incorrect embargo date (#3859)

* Handle synonym and multiple common names in uploader (#3861)

* Add variety and forma to taxa upload logic (#3862)

* Add resend email backend (#3863)

Signed-off-by: Dimas <[email protected]>

* Fix custom theme in multi-tenant (#3864)

* Add the ability to include a subcategory within a subcategory in a taxon group (#3865)

* Update db replica implementation (#3866)

* Fix gbif species harvester (#3867)

* Fix db replica for multi tenant (#3868)

* Fix database config startup (#3869)

* Fix email sent from wrong tenant (#3870)

* Add FADA Taxa Templates 0.1 (#3885)

* Add FADA Taxa Templates 0.1

* Update FADA_template_0.1.csv

* Improve taxa validation workflow (#3871)

* Improve taxa validation workflow

* Update taxon validation workflow

* Fix taxa management js

* Fix data source filter (#3897)

* Fix site code generator (#3898)

* Remove abiotic form and fix download request page (#3899)

* Remove abiotic form and fix download request page

* Update SASS form

* Remove Life and Cultivar group from taxon ranks (#3900)

* Add cites api (#3726)

* add cites api

* Update cites.py

---------

Co-authored-by: Dimas Ciputra <[email protected]>
Co-authored-by: Dimas Ciputra <[email protected]>

* Implement cites api and dashboard (#3901)

* Add species plus link to cites dashboard (#3902)

* Clear search results when adding or removing occurrence/SASS (#3903)

* feat: Add RedirectHomePageMiddleware with SiteSetting-based redirection (#3914)

* feat: Add CustomLogo and Title in login modal (#3915)

* feat: Add CustomLogo and Title in login modal

* Add templates

* feat: Add celery beat to check and resume harvester sessions (#3917)

* Add celery beat to check and resume harvester sessions

* Add RotatingFileHandler

* feat: Make auto-resume feature multi-tenant aware (#3918)

* feat: Make auto-resume feature multi-tenant aware

* Improve query

* fix: Improve Visibility of Tooltips in Overview Table (#3919)

* feat: Add x to close the filter panel (#3923)

* feat: Enable Taxon Editing for Users Beyond the Creator (#3920)

* feat: Add flag to indicate if system need to update filters (#3928)

* fix: Change site name to park name for sanparks (#3929)

* Fix tests (#3930)

* feat: GeoContext harvester from admin page, with the log view (#3931)

* Add button to harvest geocontext in admin page

* Initiate geocontext harvester from admin, save the log to file

* Add api to show the logs

* fix: Error in set tenant scheme (#3932)

* fix: KeyError schema name (#3933)

* feat: Add Author When Adding New Taxon (#3934)

* fix: Missing overview in pesticide dashboard (#3935)

* patch: update from main (#3936)

* Remove django-nose

* Update db in docker-compose.yml

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Dimas <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Leon <[email protected]>
Co-authored-by: Faneva Andriamiadantsoa <[email protected]>
  • Loading branch information
4 people authored May 29, 2024
1 parent fb611a4 commit 5993586
Show file tree
Hide file tree
Showing 324 changed files with 11,970 additions and 3,417 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- multi-tenant
tags:
- '*'

Expand Down Expand Up @@ -39,3 +40,20 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
buildoptions: "--target prod"

build-and-push-multi-tenant:
if: github.ref == 'refs/heads/multi-tenant'
name: Build and Push Docker Image with Multi-Tenant Tag
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- name: Build and Publish the Docker Image as Multi-Tenant
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: kartoza/kbims_uwsgi:multi-tenant
context: .
dockerfile: deployment/docker/Dockerfile
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
buildoptions: "--target prod"

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,5 @@ deployment/geoserver_data
.tag.txt
node_modules/
bundles/
webpack-stats.json
webpack-stats.json
.celery_results/
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
![Staging Tag](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/lgkgh/889dd6c34a68d9461b1fd8cdb56b8a21/raw/bims_multitenant_build-tag.json)
![Staging Status](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/lgkgh/889dd6c34a68d9461b1fd8cdb56b8a21/raw/bims_multitenant_build-status.json)

## Welcome

Welcome to the Biodiversity Information Management System (BIMS) Source Code Repository
Expand All @@ -17,7 +20,7 @@ See a running instance at https://freshwaterbiodiversity.org/

## Project Activity

|Test Badge|
|Test Badge|

|Build Badge|

Expand All @@ -29,23 +32,23 @@ running on the host. HealthyRivers is a django app so it will help if you have
some knowledge of running a django site.

git clone git://github.com/kartoza/django-bims.git

make build

make permissions

make web

# Wait a few seconds for the DB to start before to do the next command

make migrate

make collectstatic

# Finally we can rebuild our search indexes if needed

make rebuildindex


So as to create your admin account:
```
Expand Down Expand Up @@ -82,7 +85,7 @@ Thank you to the individual contributors who have helped to build BIMS:
* Fanevanjanahary: [email protected]
* Anita Hapsari: [email protected]

.. |Test Badge| image:: https://github.com/kartoza/django-bims/actions/workflows/test.yml/badge.svg
.. |Test Badge| image:: https://github.com/kartoza/django-bims/actions/workflows/test.yml/badge.svg
.. |Build Badge| image:: https://github.com/kartoza/django-bims/actions/workflows/dockerimage.yml/badge.svg
.. _developer guide: https://github.com/kartoza/django-bims/blob/develop/README-dev.md
.. _docker: http://docker.com
Expand Down
5 changes: 3 additions & 2 deletions bims/adapters/account_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from allauth.account.utils import user_email
from allauth.account.utils import user_username

from bims.utils.domain import get_current_domain
from geonode.groups.models import GroupProfile
from invitations.adapters import BaseInvitationsAdapter
from preferences import preferences
Expand Down Expand Up @@ -132,7 +133,7 @@ def clean_password(self, password, user=None):
def respond_user_inactive(self, request, user):
# Sent email to superuser
try:
current_site = Site.objects.get_current()
current_site = get_current_domain()
profile = Profile.objects.get(user=user)
ctx = {
'username': user.username,
Expand All @@ -141,7 +142,7 @@ def respond_user_inactive(self, request, user):
'organization': user.organization,
'user_id': user.id,
'current_site': current_site,
'site_name': current_site.name,
'site_name': current_site,
'email': user.email,
'role': profile.get_role_display(),
'inviter': user,
Expand Down
Loading

0 comments on commit 5993586

Please sign in to comment.