A COMP8755 Project - presented by Dajie Yang (u6513788) Supervised by Dr Peter Strazdins Research School of Computer Science - Australia National University Student Research Project Management System Back-end & Deployment
A COMP8755 Project - presented by Dajie Yang (u6513788)Supervised by Dr Peter Strazdins
Research School of Computer Science - Australia National University
Student Research Project Management System
Back-end & Deployment
Background• Single page application v.s. multi-page application
– Much shorter to no loading time– Render on client side to render on server side– Search Engine Optimization (SEO)
• Decouple web application– Server send raw data, client render it on receive– Parallel development– Isolate bugs to one side– Much more easy to test– More scalability
2
Background (cont.)
3
• Representational state transfer (REST) API as web service– Access and manipulate textual representations
(often in JSON) of resources– Use HTTP method to interact with the API– URL as API entries
• Continuous integration / continuous delivery– Merging works as often as possible– Perform all test on every push– Automatic pipeline for build, test, and deploy
Background (cont.)• Dockerization / Containerization
– OS-level virtualization, share host system’s kernel– Environment / dependency problem free– Portability– Easy management– Efficiency– Security
4
Normal Workflow
5
• Looks simple• Lots of
implications• Serious
permission issues
Database Schema (Design)
6
Database Schema (Implementation)
7
• Implement with Django ORM (Object Relational Mapping)• Many-to-many determine relation on weak entity
– Django ORM does not even support weak entity– Modify to diamond shape relation
Why Django• Mostly, for convenient
– Team member background– Learning curve– Documentation & Tutorial– Django ORM– Just enough performance
• Django REST Framework– RESTful API don’t need to render HTML page– DRF provide a convenient way to quickly create API– Documentation– Browsable API support
8
9
Layered Architecture in Back-end• Database Model
– Create / update– Query
• Business Logic– Permission checking– Data manipulation– Create database transaction
• API Entry– HTTP methods– Data validation
10
API Entries• <base url>/api/
– accounts/• users/• token/• token/refresh/• login/• logout/
– research_mgt/• users/
– <id>/set_course_convener/– <id>/set_formal_supervisor/
• courses/• assessment-templates/• contracts/
– export_csv– <id>/print/– <id>/submit/– <id>/approve/– <id>/supervise/
» approve/– <id>/assessments/– <id>/assessments/<id>/examine/
» approve/
11
Authentication• Authentication back-end
– Support existing ANU credential login through ANU LDAP service
– Automatic user information popping from ANU LDAP– Also have own user database to support external
• Token authentication & session authentication
12
Request Cycle
13
Permissions• Check permission on every single API entry• Ensure the pre-condition and post-condition must be met• Different permission for different user• Restricted query for different user• AssessmentExamineViewSet as an example:
–
• ContractViewSet as an example:– Superuser sees all contracts– Convener sees all was submitted contracts– Other users, only display contracts that they involve
14
Notifications & Action Logs
15
Testing & Continuous Integration• Unit test for individual API• Integration test for the
entire workflow• 92% coverage• 160+ pipelines with 66%
success ratio
16
Deployment with docker
17
Reference• Token Authentication: The Secret to Scalable User
Management• Docker vs Kubernetes – What Is the Difference?
18
Thank you
19