- Table of Contents
- Architecture
- Development
- Deployment
- Project Structure
- API Documentation
- Cloud Computing Team
The architecture of this project can be seen in the image below.
- Clone this repository
git clone https://github.com/Traversee-ID/traversee-id-backend.git
- Create
.env
file with the following contents
PRIVATE_KEY="<FIREBASE_PRIVATE_KEY>"
PROJECT_ID="<FIREBASE_PROJECT_ID>"
PRIVATE_KEY_ID="<FIREBASE_PRIVATE_KEY_ID>"
CLIENT_EMAIL="<FIREBASE_CLIENT_EMAIL>"
CLIENT_ID="<FIREBASE_CLIENT_ID>"
CLIENT_X509_CERT_URL="<FIREBASE_CLIENT_X509_CERT_URL>"
DATABASE_URI="postgresql://<DB_USER>:<DB_PASSWORD>@<DB_HOST>:<DB_PORT>/<DB_NAME>"
RECOMMENDATIONS_SERVICE="<URL_RECOMMENDATIONS_SERVICE>"
SENTIMENTS_SERVICE="<URL_SENTIMENTS_SERVICE>"
- Install project dependencies
pip install -r requirements.txt
- Run the application
flask --app main run -p 8080
The unspecified aspects can be adjusted individually or using default values. Additionally, it also allows for enhancing various aspects such as Cloud SQL configuration.
- Enable Firebase Authentication
- Add Android app
- Generate Firebase Admin private key
- The required outcomes are
PRIVATE_KEY
,PROJECT_ID
,PRIVATE_KEY_ID
,CLIENT_EMAIL
,CLIENT_ID
, andCLIENT_X509_CERT_URL
- Create a PostgreSQL instance
- PostgreSQL version 13
- Connections with Public IP, specify CIDR ranges e.g. 0.0.0.0/0
- Create a new database
- Create a new user account
- The required outcomes is
DATABASE_URI
with content "postgresql://DB_USER
:DB_PASSWORD
@DB_HOST
:DB_PORT
/DB_NAME
"
- Create a bucket
- Standard default class
- Enforce public access prevention
- Fine-grained access control
- The required outcomes is
BUCKET_NAME
- Create two new service accounts
- Recommendation Service Invoker
- Cloud Run Invoker role
- Traversee Cloud Run Service
- Secret Manager Secret Accessor role
- Storage Object Admin role
- Recommendation Service Invoker
- An example can be seen in the image below
- Create a new job
- Frequency:
59 11,23 * * 0-6
(Every day at 11:59 and 23:59) - Target type:
HTTP
- URL:
<RECOMMENDATIONS_SERVICE>/reload
- HTTP method:
POST
- Auth header:
Add OIDC token
- Service account:
Recommendation Service Invoker
- Frequency:
- Recommendation Service
- The recommendation code service can be accessed here.
- Submit a build using Google Cloud Build
- Create a new service with the recommendation container image
- Environment variables from secrets:
DATABASE_URI
- Ingress control:
All
- Authentication:
Allow unauthenticated invocations
- Service account:
Traversee Cloud Run Service
- Environment variables from secrets:
- The required outcomes is
RECOMMENDATIONS_SERVICE
(URL recommendation service)
- Sentiment Service
- The sentiment code service can be accessed here.
- Submit a build using Google Cloud Build
- Create a new service with the sentiment container image
- Ingress control:
All
- Authentication:
Allow unauthenticated invocations
- Service account:
Traversee Cloud Run Service
- Ingress control:
- The required outcomes is
SENTIMENTS_SERVICE
(URL sentiment service)
- Main Service
- Clone this repository
- Submit a build using Google Cloud Build
- Create a new service with the main container image
- Environment variables from secrets:
PRIVATE_KEY
,PROJECT_ID
,PRIVATE_KEY_ID
,CLIENT_EMAIL
,CLIENT_ID
,CLIENT_X509_CERT_URL
,DATABASE_URI
,RECOMMENDATIONS_SERVICE
, andSENTIMENTS_SERVICE
- Ingress control:
All
- Authentication:
Allow unauthenticated invocations
- Service account:
Traversee Cloud Run Service
- Environment variables from secrets:
┌───api
│ ├───v1
│ │ ├───models
│ │ │ ├───__init__.py
│ │ │ ├───campaigns.py
│ │ │ ├───forums.py
│ │ │ ├───open_trips.py
│ │ │ └───tourisms.py
│ │ ├───routes
│ │ │ ├───__init__.py
│ │ │ ├───campaigns.py
│ │ │ ├───forums.py
│ │ │ ├───open_trips.py
│ │ │ ├───profiles.py
│ │ │ ├───sentiments.py
│ │ │ └───tourisms.py
│ │ ├───__init__.py
│ │ ├───decorator.py
│ │ ├───extensions.py
│ │ └───helper.py
├───credentials.py
└───main.py
The details of the API documentation can be accessed at here.
Name | Student ID | Contact |
---|---|---|
Muhammad Fikri Haryanto | C181DSX0783 | |
Imam Azka Ramadhan Aditia | C181DSX3667 |