- To run the flask app locally, run
./scripts/deploy_local.sh
frombackend_ddd
directory- Make sure to
source venv/bin/activate
inbackend_dd
before running the command to activate your virtual env
- Make sure to
- Install packages for backend using
pip install -r requirements.txt
frombackend_ddd
- To start the ngrok tunnel, run the command
ngrok http 5000
- Add auth token to get the verified http url or whatever that is but required warna weird errors
- Prod deployment
gcloud app deploy
- To connect to the PostgreSQL instance on the cloud, run
./cloud-sql-proxy cardpay-1:asia-south1:cardpay-dev -p 5433
- To setup AVD:
gcloud auth application-default login
- To run migrations run
pg-migrator postgres://postgres:"-3vjMTP4s>*aEDuG"@127.0.0.1:5433/cardpay-dev-db
inbackend_ddd/db/migrations
directory
- To create json serializable models for your dart classes run
flutter pub run build_runner build
in frontend-flutter directory - To add a package in flutter run
flutter pub add <package-name>
in frontend-flutter directory
- To run the script, run
npm run start
in the admin directory - To run the script on dev db, run
npm run start-dev
in the admin directory
- Increment the version in
pubspec.yaml
in frontend-flutter directory - Create an app bundle (android) using
flutter build appbundle
in frontend-flutter directory - Create an app bundle (iOS) using
flutter build ipa
in frontend-flutter directory
-
- Open the file
admin/src/index.ts
- Open the file
-
- Uncomment the line
saveFirestoreState();
- Uncomment the line
-
- Open the terminal in
admin
directory
- Open the terminal in
-
- Run the following command,
npm run start
to run the script
- Run the following command,
-
- A new file will be created with the name as the timestamp
-
- In the file
admin/data_analytics.py
, uncomment the linesaveTransactionsToCsv()
at the end of file
- In the file
-
- Run
python data_analytics.py
in the admin directory
- Run
-
- Viola! The
transactions.csv
will contain the updated transactions fresh from the database
- Viola! The
- To run the localhost server on dev db, set
RUN_DEV = true
ininitialize-firebase.tsx
in the services folder
- To deploy your cloud functions run
firebase deploy --only functions
in the backend directory - To run functions locally run
npm run serve
in the backend/functions directory - Run this command to sync backend with backend-dev
rsync -av --delete "backend/functions/src/" "backend-dev/functions/src"
- Functions structure:
- Log to display the arguments passed to the function
- Arguments check including authentication
- Log on all types of error occured
-
Run prod proxy
-
Create a backup of the prod db:
pg_dump -h localhost -p 5433 -U postgres -d cardpay-prod-db -f dumpfile.sql
-
Close prod proxy
-
Run dev proxy
-
Restore from backup to the dev db
psql -h localhost -p 5433 -U postgres -d cardpay-dev-db -f dumpfile.sql
-
Close dev proxy
- Install gcloud CLI
- Follow installation steps
- Setup credentials
./google-cloud-sdk/bin/gcloud auth application-default login
- Add project to path
export GCLOUD_PROJECT=cardpay-1
- Run
gcloud init
and initialize the development project - Replace the connections in db with dev ones from env
- Install python
- Create python venv
- Install requirements from
requirement.txt
- Install and setup Github SSH keys if not already done
- Install PostgreSQL
- Setup db
- Run migrations
- Setup ADC, Application default credentials
- Add
.env
,credentials-dev.json
,credentials-prod.json
- Install Datagrip
- Run the following command in
backend_ddd
to load test the APIs locust -f locust_our_system.py --headless -u 100 -r 5 -t 1m --html report_doha.html
200 OK The request succeeded. The result meaning of "success" depends on the HTTP method:
201 Created The request succeeded, and a new resource was created as a result. This is typically the response sent after POST requests, or some PUT requests.
400 Bad Request The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
401 Unauthorized Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.
404 Not Found The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web.
500 Internal Server Error The server has encountered a situation it does not know how to handle.